|
|
@@ -133,7 +133,7 @@ public class WeChatServiceImpl implements WeChatService{
|
|
|
params.put("keyword3", WechatTemplateMsg.item("点击查看详情", "#173177"));
|
|
|
params.put("remark", WechatTemplateMsg.item(WeChatUtil.TEMPLATE_REMARK.replace("cmpCode", messageModel.getCmpCode()), null));
|
|
|
|
|
|
- wechatTemplateMsg.setUrl("https://www.usoftmall.com/mobile/applyPurchase/list/businessOpportunity?enuu=" + messageModel.getReceiverEnuu());
|
|
|
+ wechatTemplateMsg.setUrl("https://www.usoftmall.com/mobile/wechat?url=mobile/applyPurchase/list/businessOpportunity?enuu=" + messageModel.getReceiverEnuu());
|
|
|
wechatTemplateMsg.setTouser(user.getOpenId());
|
|
|
wechatTemplateMsg.setData(params);
|
|
|
String json = HttpReqUtil.doPost(sendTemplateUrl, FlexJsonUtils.toJsonDeep(wechatTemplateMsg));
|
|
|
@@ -163,10 +163,13 @@ public class WeChatServiceImpl implements WeChatService{
|
|
|
*/
|
|
|
@Override
|
|
|
public ModelMap bindUser(UserVo user) {
|
|
|
- logger.info("微信绑定用户 userUU: {}", user.getUserUU());
|
|
|
+ logger.info("微信绑定用户 userTel: {}", user.getUserTel());
|
|
|
ModelMap result = new ModelMap();
|
|
|
+ if(StringUtils.isEmpty(user.getOpenId())){
|
|
|
+ throw new IllegalOperatorException("找不到OpenId!");
|
|
|
+ }
|
|
|
// 账户中心校验手机号和密码是否正确
|
|
|
- if (StringUtils.isEmpty(user) || StringUtils.isEmpty(user.getUserTel()) || StringUtils.isEmpty(user.getUserPwd()) || StringUtils.isEmpty(user.getOpenId())) {
|
|
|
+ if (StringUtils.isEmpty(user)|| StringUtils.isEmpty(user.getUserTel()) || StringUtils.isEmpty(user.getUserPwd())) {
|
|
|
if (StringUtils.isEmpty(user.getCode())) {
|
|
|
throw new IllegalOperatorException("信息不完整!");
|
|
|
} else {
|
|
|
@@ -194,9 +197,13 @@ public class WeChatServiceImpl implements WeChatService{
|
|
|
if (!StringUtils.isEmpty(oldUser.getOpenId())) {
|
|
|
throw new IllegalOperatorException("该用户已经绑定微信号");
|
|
|
}
|
|
|
- pass = AccountUtils.fuzzyCheckPassword(userView);
|
|
|
- if (!pass) {
|
|
|
- throw new IllegalOperatorException("手机号或密码不正确");
|
|
|
+ if(!StringUtils.isEmpty(user.getCode()) ){
|
|
|
+ logger.info("通过手机验证码绑定");
|
|
|
+ }else {
|
|
|
+ pass = AccountUtils.fuzzyCheckPassword(userView);
|
|
|
+ if (!pass) {
|
|
|
+ throw new IllegalOperatorException("手机号或密码不正确");
|
|
|
+ }
|
|
|
}
|
|
|
oldUser.setOpenId(user.getOpenId());
|
|
|
User newUser = userDao.save(oldUser);
|
|
|
@@ -223,7 +230,7 @@ public class WeChatServiceImpl implements WeChatService{
|
|
|
*/
|
|
|
@Override
|
|
|
public void sendSMS(String mobile, String code) {
|
|
|
- redisTemplate.opsForValue().set(mobile, mobile, SMS_EXPIRES_IN, TimeUnit.SECONDS);
|
|
|
+ redisTemplate.opsForValue().set(mobile, code, SMS_EXPIRES_IN, TimeUnit.SECONDS);
|
|
|
logger.info("用户:{},验证码:{},redis's key:{},redis's expires_in:{}", mobile, code, mobile, SMS_EXPIRES_IN);
|
|
|
MessageUtils.sendSms(mobile, code);
|
|
|
}
|