fix[用户中心]:优化登录等录逻辑
This commit is contained in:
+3
-3
@@ -121,10 +121,10 @@ public class SysUserController {
|
||||
*
|
||||
* @param openId openId
|
||||
*/
|
||||
@GetMapping(value = "/users-anon/wxOpenId", params = "openId")
|
||||
@GetMapping(value = "/users-anon/wxOpenId", params = {"openId","mobile"})
|
||||
@Operation(summary = "根据WxOpenId查询用户")
|
||||
public SysUser findByWxOpenId(String openId) throws Exception {
|
||||
return appUserService.findByWxOpenid(openId);
|
||||
public SysUser findByWxOpenId(String openId,String mobile) throws Exception {
|
||||
return appUserService.findByWxOpenid(openId,mobile);
|
||||
}
|
||||
|
||||
@GetMapping("/users/{id}")
|
||||
|
||||
+7
-7
@@ -1,15 +1,15 @@
|
||||
package com.central.user.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.central.common.service.ISuperService;
|
||||
import com.central.user.model.SysUserExcel;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.common.model.SysRole;
|
||||
import com.central.common.model.SysUser;
|
||||
import com.central.common.service.ISuperService;
|
||||
import com.central.user.model.SysUserExcel;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
@@ -29,7 +29,7 @@ public interface ISysUserService extends ISuperService<SysUser> {
|
||||
|
||||
SysUser findByMobile(String username);
|
||||
|
||||
SysUser findByWxOpenid(String wxOpenid) throws Exception;
|
||||
SysUser findByWxOpenid(String wxOpenid,String mobile) throws Exception;
|
||||
|
||||
/**
|
||||
* 通过SysUser 把roles和permissions也查询出来
|
||||
|
||||
+2
-1
@@ -71,7 +71,7 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser findByWxOpenid(String wxOpenid) throws Exception {
|
||||
public SysUser findByWxOpenid(String wxOpenid,String mobile) throws Exception {
|
||||
SysUser sysUser = this.selectByOpenId(wxOpenid);
|
||||
if (ObjectUtils.isEmpty(sysUser)) {
|
||||
sysUser = new SysUser();
|
||||
@@ -80,6 +80,7 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
|
||||
sysUser.setType(UserType.APP.name());
|
||||
sysUser.setPassword(wxOpenid);
|
||||
sysUser.setEnabled(Boolean.TRUE);
|
||||
sysUser.setMobile(mobile);
|
||||
}
|
||||
String username = sysUser.getUsername();
|
||||
boolean result = super.saveOrUpdateIdempotency(sysUser, lock
|
||||
|
||||
Reference in New Issue
Block a user