Authored by ping

Merge branch 'cocacola' into dev

... ... @@ -224,9 +224,11 @@ public class CocacolaServiceImpl implements ICocacolaService {
bo.setArea(area);
bo.setCheckSSO(true);
ProfileInfoRsp result = service.call("users.getUserprofileByEmailOrMobile", bo, ProfileInfoRsp.class);
log.info("call users.getUserprofileByEmailOrMobile result is {}", result);
// 查询用户不存在
JSONObject json = new JSONObject();
if (result == null || result.getUid() == 0) {
log.info("user not exists with mobile={}", mobile);
json.put("newUser", true);
// 2.调用注册
RegisterReqBO registerReqBO = new RegisterReqBO();
... ... @@ -237,20 +239,24 @@ public class CocacolaServiceImpl implements ICocacolaService {
RegisterRspBO model = null;
try {
model = service.call("users.register", registerReqBO, RegisterRspBO.class);
log.info("call register result is {}", model);
json.put("password", registerReqBO.getPassword());
// 3.记录新注册用户 领取人数
yhValueOperations.increment(Constant.USED_REGISTER_GET_TIME_MEM_KEY + mobile, 1);
yhRedisTemplate.longExpire(Constant.USED_REGISTER_GET_TIME_MEM_KEY + mobile, 30, TimeUnit.DAYS);
} catch (Exception e) {
log.warn("Redis exception. check get times. area is {}, mobile is {}, client_type={},exception is {}", area, mobile, client_type, e.getMessage());
return new ApiResponse(603, "领取优惠券失败");
}
try {
yhValueOperations.increment(Constant.USED_REGISTER_GET_TIME_MEM_KEY + mobile, 1);
yhRedisTemplate.longExpire(Constant.USED_REGISTER_GET_TIME_MEM_KEY + mobile, 30, TimeUnit.DAYS);
} catch (Exception e) {
log.warn("cocacola set redis error with mobile is {}", mobile);
}
json.put("uid", model.getUid());
}
// 3.已注册用户,redis记录领取人数
else {
log.info("user has exists with mobile={}", mobile);
json.put("newUser", false);
try {
yhValueOperations.increment(Constant.USED_REGISTER_GET_TIME_MEM_KEY + mobile, 1);
... ...