...
|
...
|
@@ -104,6 +104,7 @@ public class CocacolaServiceImpl implements ICocacolaService { |
|
|
ApiResponse response = validRegCode(code, area, mobile);
|
|
|
if (Constant.CODE_SUCCESS != response.getCode()) {
|
|
|
log.warn("validCodeAndSendCode error validCode is error with code={}, area={}, mobile={}", code, area, mobile);
|
|
|
response.setMessage("验证码错误");
|
|
|
return response;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -223,33 +224,39 @@ 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();
|
|
|
registerReqBO.setArea(area);
|
|
|
registerReqBO.setProfile(mobile);
|
|
|
registerReqBO.setPassword(RandomUtil.autoGetPassword());
|
|
|
registerReqBO.setPassword(RandomUtil.getCharAndNumr(6, 2));
|
|
|
registerReqBO.setClient_type(client_type);
|
|
|
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);
|
...
|
...
|
|