|
|
@@ -6,12 +6,13 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.zhongzheng.common.core.bo.WxLoginResultBo;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
|
|
|
-import com.zhongzheng.common.utils.AES;
|
|
|
-import com.zhongzheng.common.utils.SnowflakeIdUtils;
|
|
|
-import com.zhongzheng.common.utils.TelPhoneUtils;
|
|
|
+import com.zhongzheng.common.utils.*;
|
|
|
+import com.zhongzheng.common.utils.ip.IpUtils;
|
|
|
+import com.zhongzheng.modules.course.mapper.CourseSectionMapper;
|
|
|
import com.zhongzheng.modules.user.bo.UserAddBo;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
import com.zhongzheng.modules.user.entity.ClientLoginUser;
|
|
|
+import com.zhongzheng.modules.user.mapper.UserMapper;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
import com.zhongzheng.modules.wx.bo.WxLoginBody;
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
@@ -47,6 +48,9 @@ public class WxLoginService
|
|
|
@Autowired
|
|
|
private IUserService iUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserMapper userMapper;
|
|
|
+
|
|
|
public String login(WxLoginBody loginBody) {
|
|
|
String unionId = getWxUnionId(loginBody.getCode());
|
|
|
User user = iUserService.queryByUnionId(unionId);
|
|
|
@@ -63,6 +67,9 @@ public class WxLoginService
|
|
|
if(user==null){
|
|
|
throw new CustomException("unionId不存在");
|
|
|
}
|
|
|
+ user.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
+ user.setLastLoginTime(DateUtils.getNowTime());
|
|
|
+ userMapper.updateById(user);
|
|
|
ClientLoginUser loginUser = new ClientLoginUser();
|
|
|
loginUser.setUser(user);
|
|
|
return wxTokenService.createToken(loginUser);
|
|
|
@@ -88,6 +95,8 @@ public class WxLoginService
|
|
|
bo.setSex(1);
|
|
|
bo.setStatus(1);
|
|
|
bo.setRegisterPlat("1");
|
|
|
+ bo.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
+ bo.setLastLoginTime(DateUtils.getNowTime());
|
|
|
return iUserService.insertByAddBo(bo);
|
|
|
}
|
|
|
|