mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-26 11:51:55 +08:00
[feat] 新增通过微信unionId注册的功能
This commit is contained in:
@@ -11,6 +11,8 @@ import com.ruoyi.system.api.RemoteUserService;
|
||||
import com.ruoyi.system.api.domain.SysUser;
|
||||
import com.ruoyi.system.api.model.LoginUser;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
@@ -29,7 +31,12 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||
{
|
||||
@NotNull
|
||||
@Override
|
||||
public R<LoginUser> infoById_Inner(Long userId, @NotNull String source) {
|
||||
public R<LoginUser> getById_Inner(Long userId, @NotNull String source) {
|
||||
return R.fail("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<LoginUser> getByWxUnionId_Inner(String unionid, String source) {
|
||||
return R.fail("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@@ -41,7 +48,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public R<LoginUser> getUserInfoByPhoneNumber_Inner(@NotNull String phoneNumber, @NotNull String source) {
|
||||
public R<LoginUser> getByPhoneNumber_Inner(@NotNull String phoneNumber, @NotNull String source) {
|
||||
return R.fail("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@@ -67,6 +74,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||
public R<LoginUser> edit_Inner(@NotNull LoginUser user, @NotNull String source) {
|
||||
return R.fail("修改用户信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> registerUserByWxUnionId_Inner(Map<String, String> params, String source) {
|
||||
return R.fail("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.ruoyi.system.api.domain.SysUser;
|
||||
import com.ruoyi.system.api.model.LoginUser;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface InnerRemoteUserService {
|
||||
/**
|
||||
* 通过用户ID查询用户信息
|
||||
@@ -16,8 +18,17 @@ public interface InnerRemoteUserService {
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/inner/user/detail/{userId}")
|
||||
R<LoginUser> infoById_Inner(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
R<LoginUser> getById_Inner(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户信息
|
||||
*
|
||||
* @param unionid 用户微信unionid
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/inner/user/detail/wx/unionid/{unionid}")
|
||||
R<LoginUser> getByWxUnionId_Inner(@PathVariable("unionid") String unionid, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 通过手机号查询用户信息
|
||||
@@ -27,7 +38,7 @@ public interface InnerRemoteUserService {
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/inner/user/info/phoneNumber/{phoneNumber:\\d+}")
|
||||
R<LoginUser> getUserInfoByPhoneNumber_Inner(@PathVariable("phoneNumber") String phoneNumber, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
R<LoginUser> getByPhoneNumber_Inner(@PathVariable("phoneNumber") String phoneNumber, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 通过手机号查询用户信息
|
||||
@@ -41,4 +52,14 @@ public interface InnerRemoteUserService {
|
||||
|
||||
@PutMapping("/inner/user")
|
||||
R<LoginUser> edit_Inner(@RequestBody LoginUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
* @param params 包含微信unionId和deptId
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/inner/user/register/wx/unionid")
|
||||
public R<Boolean> registerUserByWxUnionId_Inner(@RequestBody Map<String, String> params, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
Reference in New Issue
Block a user