|
|
@@ -14,11 +14,13 @@ import com.ylx.lottery.service.LotteryCountService;
|
|
|
import com.ylx.massage.domain.CommentUserAudit;
|
|
|
import com.ylx.massage.domain.TCommentUser;
|
|
|
import com.ylx.massage.domain.TOrder;
|
|
|
+import com.ylx.massage.domain.TWxUser;
|
|
|
import com.ylx.massage.enums.OrderStatusEnum;
|
|
|
import com.ylx.massage.mapper.TCommentUserMapper;
|
|
|
import com.ylx.massage.service.TCommentUserAuditService;
|
|
|
import com.ylx.massage.service.TCommentUserService;
|
|
|
import com.ylx.massage.service.TOrderService;
|
|
|
+import com.ylx.massage.service.TWxUserService;
|
|
|
import com.ylx.point.domain.dto.ApiAddPointsDTO;
|
|
|
import com.ylx.point.service.IPointAccountService;
|
|
|
import com.ylx.usercenter.domain.dto.UnifiedUserCenterDTO;
|
|
|
@@ -59,6 +61,8 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
|
|
|
private UnifiedUserCenterService unifiedUserCenterService;
|
|
|
@Resource
|
|
|
private IPointAccountService pointAccountService;
|
|
|
+ @Resource
|
|
|
+ private TWxUserService wxUserService;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -114,7 +118,7 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
|
|
|
grantLotteryCountForComment(wxLoginUser);
|
|
|
|
|
|
// 已绑定一账通 → 异步同步抽奖次数
|
|
|
- syncLotteryCountIfNeeded(wxLoginUser);
|
|
|
+ syncLotteryCountIfNeeded(wxLoginUser.getId());
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -188,13 +192,20 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
|
|
|
lotteryCountLogService.save(log);
|
|
|
}
|
|
|
|
|
|
- private void syncLotteryCountIfNeeded(WxLoginUser wxLoginUser) {
|
|
|
- if (ObjectUtil.equals(wxLoginUser.getIsBind(), 1)
|
|
|
- && StringUtils.isNotBlank(wxLoginUser.getLocalLiveUserId())) {
|
|
|
+ private void syncLotteryCountIfNeeded(String id) {
|
|
|
+
|
|
|
+ // 避免用户绑定本地生活用户后,token中数据未能更新,导致不能同步抽奖次数
|
|
|
+ TWxUser user = this.wxUserService.getById(id);
|
|
|
+ if (ObjectUtil.isNull(user)) {
|
|
|
+ throw new ServiceException("用户不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ObjectUtil.equals(user.getIsBind(), 1)
|
|
|
+ && StringUtils.isNotBlank(user.getLocalLiveUserId())) {
|
|
|
|
|
|
UnifiedUserCenterDTO dto = new UnifiedUserCenterDTO();
|
|
|
- dto.setSourceUserId(wxLoginUser.getLocalLiveUserId());
|
|
|
- dto.setTargetUserId(wxLoginUser.getId());
|
|
|
+ dto.setSourceUserId(user.getLocalLiveUserId());
|
|
|
+ dto.setTargetUserId(user.getId());
|
|
|
|
|
|
// 👇 加上这个 if 判断,只有当当前存在活跃事务时,才去注册 afterCommit 回调
|
|
|
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|