【同步】BOOT 和 CLOUD 的功能
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package cn.iocoder.yudao.module.mp.service.handler.user;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.module.mp.framework.mp.core.context.MpContextHolder;
|
||||
import cn.iocoder.yudao.module.mp.service.message.MpAutoReplyService;
|
||||
import cn.iocoder.yudao.module.mp.service.user.MpUserService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.error.WxMpErrorMsgEnum;
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
@@ -13,7 +16,6 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -40,6 +42,13 @@ public class SubscribeHandler implements WxMpMessageHandler {
|
||||
wxMpUser = weixinService.getUserService().userInfo(wxMessage.getFromUser());
|
||||
} catch (WxErrorException e) {
|
||||
log.error("[handle][粉丝({})] 获取粉丝信息失败!", wxMessage.getFromUser(), e);
|
||||
// 特殊情况(个人账号,无接口权限):https://t.zsxq.com/cLFq5
|
||||
if (ObjUtil.equal(e.getError().getErrorCode(), WxMpErrorMsgEnum.CODE_48001)) {
|
||||
wxMpUser = new WxMpUser();
|
||||
wxMpUser.setOpenId(wxMessage.getFromUser());
|
||||
wxMpUser.setSubscribe(true);
|
||||
wxMpUser.setSubscribeTime(System.currentTimeMillis() / 1000L);
|
||||
}
|
||||
}
|
||||
|
||||
// 第二步,保存粉丝信息
|
||||
|
||||
@@ -157,7 +157,7 @@ public class MpTagServiceImpl implements MpTagService {
|
||||
});
|
||||
// 情况三,部分标签已经不存在了,删除
|
||||
if (CollUtil.isNotEmpty(tagMap)) {
|
||||
mpTagMapper.deleteBatchIds(convertList(tagMap.values(), MpTagDO::getId));
|
||||
mpTagMapper.deleteByIds(convertList(tagMap.values(), MpTagDO::getId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class MpUserServiceImpl implements MpUserService {
|
||||
|
||||
@Override
|
||||
public List<MpUserDO> getUserList(Collection<Long> ids) {
|
||||
return mpUserMapper.selectBatchIds(ids);
|
||||
return mpUserMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user