消息订阅模板绑定问题修复

This commit is contained in:
liyj 2025-09-23 18:14:10 +08:00
parent c01dd85fdb
commit 328e4b676e

View File

@ -5,8 +5,8 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.suisung.mall.account.mapper.AccountUserBindConnectMapper; import com.suisung.mall.account.mapper.AccountUserBindConnectMapper;
import com.suisung.mall.account.service.AccountUserBaseService; import com.suisung.mall.account.service.AccountUserBaseService;
import com.suisung.mall.account.service.AccountUserBindConnectService; import com.suisung.mall.account.service.AccountUserBindConnectService;
@ -538,9 +538,9 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
log.info("jsonObject:{}", jsonObject); log.info("jsonObject:{}", jsonObject);
String openId=jsonObject.getStr("FromUserName");//用户openid String openId=jsonObject.getStr("FromUserName");//用户openid
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>(); QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("bind_id",openId) queryWrapper.eq("bind_openid",openId)
.eq("user_type", CommonConstant.USER_TYPE_NORMAL) .eq("user_type", CommonConstant.USER_TYPE_NORMAL)
.eq("bind_type",15) .in("bind_type",Arrays.asList(1,15))
.eq("bind_active", CommonConstant.Enable); .eq("bind_active", CommonConstant.Enable);
AccountUserBindConnect accountUserBindConnect= findOne(queryWrapper); AccountUserBindConnect accountUserBindConnect= findOne(queryWrapper);
if (accountUserBindConnect != null) { if (accountUserBindConnect != null) {
@ -551,7 +551,12 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
String SubscribeStatusString= object.getStr("SubscribeStatusString");//订阅结果accept接收reject拒收参考地址https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html#%E8%AE%A2%E9%98%85%E6%B6%88%E6%81%AF%E8%AF%AD%E9%9F%B3%E6%8F%90%E9%86%92 String SubscribeStatusString= object.getStr("SubscribeStatusString");//订阅结果accept接收reject拒收参考地址https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html#%E8%AE%A2%E9%98%85%E6%B6%88%E6%81%AF%E8%AF%AD%E9%9F%B3%E6%8F%90%E9%86%92
if(SubscribeStatusString.equals("accept")){ if(SubscribeStatusString.equals("accept")){
accountUserBindConnect.setBind_tmpl(templateId); accountUserBindConnect.setBind_tmpl(templateId);
updateById(accountUserBindConnect); UpdateWrapper<AccountUserBindConnect> updateWrapper = new UpdateWrapper<>(accountUserBindConnect);
updateWrapper.set("bind_id",accountUserBindConnect.getBind_id());
updateWrapper.set("bind_type",accountUserBindConnect.getBind_type());
updateWrapper.set("user_id",accountUserBindConnect.getUser_id());
updateWrapper.set("user_type",accountUserBindConnect.getUser_type());
update(updateWrapper);
} }
} }
} }