| @@ -98,6 +98,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("wx_logic_permission".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_score_rules".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @@ -86,6 +86,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("wx_user_channel".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_score_rules".equals(tableName)) { | |||
| return true; | |||
| } | |||
| // wx_profit_sharing_receiver | |||
| // wx_profit_sharing_result | |||
| return false; | |||
| @@ -16,6 +16,8 @@ import com.iformall.utils.IPUtil; | |||
| import com.iformall.utils.MaUtil; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.web.bind.WebDataBinder; | |||
| import org.springframework.web.bind.annotation.InitBinder; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -47,6 +49,10 @@ public class BaseController { | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| @Qualifier("cuserTokenRedisTemplate") | |||
| RedisTemplate<String, WxCUser> cUserTokenRedisTemplate; | |||
| @InitBinder | |||
| public void InitBinder(WebDataBinder dataBinder) { | |||
| dataBinder.registerCustomEditor(Date.class, new PropertyEditorSupport() { | |||
| @@ -224,6 +230,10 @@ public class BaseController { | |||
| user.setUserId(basicInfo.getId()); | |||
| wxCUserService.updateUserId(user); | |||
| } | |||
| String key = Constant.tokenPrev + user.getOpenId(); | |||
| if(cUserTokenRedisTemplate.hasKey(key)){ | |||
| cUserTokenRedisTemplate.delete(key); | |||
| } | |||
| } | |||
| public String getIpAddr() { | |||
| @@ -6,6 +6,7 @@ import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxMsgValidationcode; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -76,6 +77,11 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| // 更新到basicinfo | |||
| saveToBasicInfo(user); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_PHONE,user); | |||
| String key = Constant.tokenPrev + user.getOpenId(); | |||
| if(cUserTokenRedisTemplate.hasKey(key)){ | |||
| cUserTokenRedisTemplate.delete(key); | |||
| } | |||
| } | |||
| return rd; | |||
| } | |||
| @@ -29,6 +29,8 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.context.request.RequestContextHolder; | |||
| import org.springframework.web.context.request.ServletRequestAttributes; | |||
| @@ -98,6 +100,7 @@ public class WxUserGrantController extends BaseController { | |||
| @Autowired | |||
| WxMallService mallService; | |||
| /** | |||
| * 微信消息服务验证 | |||
| * | |||
| @@ -557,6 +560,11 @@ public class WxUserGrantController extends BaseController { | |||
| user.setLanguage(userInfo.getLanguage()); | |||
| wxCUserService.saveOrUpdate(updateUser); | |||
| String key = Constant.tokenPrev + user.getOpenId(); | |||
| if(cUserTokenRedisTemplate.hasKey(key)){ | |||
| cUserTokenRedisTemplate.delete(key); | |||
| } | |||
| if(bFirstNickName) { | |||
| // 首次获取昵称 | |||
| // 成长值 | |||
| @@ -86,6 +86,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("wx_user_channel".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_score_rules".equals(tableName)) { | |||
| return true; | |||
| } | |||
| // wx_profit_sharing_receiver | |||
| // wx_profit_sharing_result | |||
| return false; | |||
| @@ -16,11 +16,14 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCUserMapper; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpUser; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| @@ -48,6 +51,10 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| @Autowired | |||
| private MqBaseProducer mqBaseProducer; | |||
| @Autowired | |||
| @Qualifier("cuserTokenRedisTemplate") | |||
| RedisTemplate<String, WxCUser> cUserTokenRedisTemplate; | |||
| @Override | |||
| public PageInfo<WxCUser> listAsPage(WxCUser record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.findList(record)); | |||
| @@ -171,6 +178,10 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| userL.setScene(record.getScene()); | |||
| userL.setUpdateDate(curr); | |||
| int ret = wxCUserMapper.updateById(userL); | |||
| String key = Constant.tokenPrev + record.getOpenId(); | |||
| if(cUserTokenRedisTemplate.hasKey(key)){ | |||
| cUserTokenRedisTemplate.delete(key); | |||
| } | |||
| return ret; | |||
| } | |||
| @@ -183,6 +194,10 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| userL.setLatitude(record.getLatitude()); | |||
| userL.setUpdateDate(curr); | |||
| int ret = wxCUserMapper.updateById(userL); | |||
| String key = Constant.tokenPrev + record.getOpenId(); | |||
| if(cUserTokenRedisTemplate.hasKey(key)){ | |||
| cUserTokenRedisTemplate.delete(key); | |||
| } | |||
| return ret; | |||
| } | |||
| @@ -194,6 +209,10 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| userL.setExtraInfo(record.getExtraInfo()); | |||
| userL.setUpdateDate(curr); | |||
| int ret = wxCUserMapper.updateById(userL); | |||
| String key = Constant.tokenPrev + record.getOpenId(); | |||
| if(cUserTokenRedisTemplate.hasKey(key)){ | |||
| cUserTokenRedisTemplate.delete(key); | |||
| } | |||
| return ret; | |||
| } | |||
| @@ -291,7 +310,10 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| } | |||
| } | |||
| } | |||
| String key = Constant.tokenPrev + user.getOpenId(); | |||
| if(cUserTokenRedisTemplate.hasKey(key)){ | |||
| cUserTokenRedisTemplate.delete(key); | |||
| } | |||
| return score; | |||
| } | |||
| @@ -318,4 +340,6 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| public void updateUserId(WxCUser user) { | |||
| wxCUserMapper.updateUserId(user); | |||
| } | |||
| } | |||
| @@ -8,6 +8,7 @@ import com.iformall.mapper.WxScoreHistoryMapper; | |||
| import com.iformall.mapper.WxScoreRulesMapper; | |||
| import com.iformall.service.WxCUserTokenService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import com.iformall.utils.Constant; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -23,8 +24,6 @@ import java.util.concurrent.TimeUnit; | |||
| public class WxCUserTokenServiceImpl implements WxCUserTokenService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| private String tokenPrev = "weapp:token:"; | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @@ -35,7 +34,7 @@ public class WxCUserTokenServiceImpl implements WxCUserTokenService { | |||
| @Override | |||
| public WxCUser getByToken(String token) { | |||
| logger.info("获取用户信息start ..." + token); | |||
| String key = tokenPrev + token; | |||
| String key = Constant.tokenPrev + token; | |||
| ValueOperations<String, WxCUser> operations = cUserTokenRedisTemplate.opsForValue(); | |||
| // 缓存 | |||
| @@ -69,7 +68,7 @@ public class WxCUserTokenServiceImpl implements WxCUserTokenService { | |||
| user.setUpdateDate(curr); | |||
| ret = wxCUserMapper.updateById(user); | |||
| } | |||
| String key = tokenPrev + user.getToken(); | |||
| String key = Constant.tokenPrev + user.getToken(); | |||
| // 缓存已存在,删除 | |||
| boolean hasKey = cUserTokenRedisTemplate.hasKey(key); | |||
| if(hasKey) { | |||
| @@ -22,6 +22,8 @@ public class Constant { | |||
| public final static int EXPIRE = H_EXPIRE * 24; | |||
| // C端token | |||
| public static final String tokenPrev = "weapp:token:"; | |||
| public static final String LOGIN_USER_KEY = "LOGIN_USER_KEY"; | |||
| public static final String LOGIN_MEMBER_KEY = "LOGIN_MEMBER_KEY"; | |||
| public static final String TENANT_ID = "TENANT_ID"; | |||