system:同步多租户下,微信小程序、微信公众号,允许每个租户独立配置
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.system.api.social;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 社交应用的 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface SocialClientApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/social-client";
|
||||
|
||||
@GetMapping(PREFIX + "/get-authorize-url")
|
||||
@Operation(summary = "获得社交平台的授权 URL")
|
||||
@Parameters({
|
||||
@Parameter(name = "socialType", description = "社交平台的类型", example = "1", required = true),
|
||||
@Parameter(name = "userType", description = "用户类型", example = "1", required = true),
|
||||
@Parameter(name = "redirectUri", description = "重定向 URL", example = "https://www.iocoder.cn", required = true)
|
||||
})
|
||||
CommonResult<String> getAuthorizeUrl(@RequestParam("socialType") Integer socialType,
|
||||
@RequestParam("userType") Integer userType,
|
||||
@RequestParam("redirectUri") String redirectUri);
|
||||
|
||||
@GetMapping(PREFIX + "/create-wx-mp-jsapi-signature")
|
||||
@Operation(summary = "创建微信公众号 JS SDK 初始化所需的签名")
|
||||
@Parameters({
|
||||
@Parameter(name = "userType", description = "用户类型", example = "1", required = true),
|
||||
@Parameter(name = "url", description = "访问 URL", example = "https://www.iocoder.cn", required = true)
|
||||
})
|
||||
CommonResult<SocialWxJsapiSignatureRespDTO> createWxMpJsapiSignature(@RequestParam("userType") Integer userType,
|
||||
@RequestParam("url") String url);
|
||||
|
||||
@GetMapping(PREFIX + "/create-wx-ma-phone-number-info")
|
||||
@Operation(summary = "获得微信小程序的手机信息")
|
||||
@Parameters({
|
||||
@Parameter(name = "userType", description = "用户类型", example = "1", required = true),
|
||||
@Parameter(name = "phoneCode", description = "手机授权码", example = "yudao11", required = true)
|
||||
})
|
||||
CommonResult<SocialWxPhoneNumberInfoRespDTO> getWxMaPhoneNumberInfo(@RequestParam("userType") Integer userType,
|
||||
@RequestParam("phoneCode") String phoneCode);
|
||||
|
||||
}
|
||||
@@ -2,12 +2,13 @@ package cn.iocoder.yudao.module.system.api.social;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserUnbindReqDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -19,34 +20,25 @@ public interface SocialUserApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/social-user";
|
||||
|
||||
@GetMapping("PREFIX + /get-authorize-url")
|
||||
@Operation(summary = "获得社交平台的授权 URL")
|
||||
@Parameters({
|
||||
@Parameter(name = "type", description = "社交平台的类型", example = "1", required = true),
|
||||
@Parameter(name = "redirectUri", description = "重定向 URL", example = "https://www.iocoder.cn",required = true)
|
||||
})
|
||||
CommonResult<String> getAuthorizeUrl(@RequestParam("type") Integer type,
|
||||
@RequestParam("redirectUri") String redirectUri);
|
||||
|
||||
@PostMapping("PREFIX + /bind")
|
||||
@PostMapping(PREFIX + "/bind")
|
||||
@Operation(summary = "绑定社交用户")
|
||||
CommonResult<Boolean> bindSocialUser(@Valid @RequestBody SocialUserBindReqDTO reqDTO);
|
||||
CommonResult<String> bindSocialUser(@Valid @RequestBody SocialUserBindReqDTO reqDTO);
|
||||
|
||||
@DeleteMapping("PREFIX + /unbind")
|
||||
@DeleteMapping(PREFIX + "/unbind")
|
||||
@Operation(summary = "取消绑定社交用户")
|
||||
CommonResult<Boolean> unbindSocialUser(@Valid @RequestBody SocialUserUnbindReqDTO reqDTO);
|
||||
|
||||
@GetMapping("PREFIX + /get-bind-user-id")
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得社交用户的绑定用户编号")
|
||||
@Parameters({
|
||||
@Parameter(name = "userType", description = "用户类型", example = "2", required = true),
|
||||
@Parameter(name = "type", description = "社交平台的类型", example = "1", required = true),
|
||||
@Parameter(name = "socialType", description = "社交平台的类型", example = "1", required = true),
|
||||
@Parameter(name = "code", description = "授权码", required = true, example = "tudou"),
|
||||
@Parameter(name = "state", description = "state", required = true, example = "coke")
|
||||
})
|
||||
CommonResult<Long> getBindUserId(@RequestParam("userType") Integer userType,
|
||||
@RequestParam("type") Integer type,
|
||||
@RequestParam("code") String code,
|
||||
@RequestParam("state") String state);
|
||||
CommonResult<SocialUserRespDTO> getSocialUser(@RequestParam("userType") Integer userType,
|
||||
@RequestParam("socialType") Integer socialType,
|
||||
@RequestParam("code") String code,
|
||||
@RequestParam("state") String state);
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SocialUserBindReqDTO {
|
||||
*/
|
||||
@InEnum(SocialTypeEnum.class)
|
||||
@NotNull(message = "社交平台的类型不能为空")
|
||||
private Integer type;
|
||||
private Integer socialType;
|
||||
/**
|
||||
* 授权码
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.api.social.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 社交用户 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SocialUserRespDTO {
|
||||
|
||||
/**
|
||||
* 社交用户 openid
|
||||
*/
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* 关联的用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.system.api.social.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 微信公众号 JSAPI 签名 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class SocialWxJsapiSignatureRespDTO {
|
||||
|
||||
/**
|
||||
* 微信公众号的 appId
|
||||
*/
|
||||
private String appId;
|
||||
/**
|
||||
* 匿名串
|
||||
*/
|
||||
private String nonceStr;
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private Long timestamp;
|
||||
/**
|
||||
* URL
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 签名
|
||||
*/
|
||||
private String signature;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.api.social.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 微信小程序的手机信息 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class SocialWxPhoneNumberInfoRespDTO {
|
||||
|
||||
/**
|
||||
* 用户绑定的手机号(国外手机号会有区号)
|
||||
*/
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 没有区号的手机号
|
||||
*/
|
||||
private String purePhoneNumber;
|
||||
/**
|
||||
* 区号
|
||||
*/
|
||||
private String countryCode;
|
||||
|
||||
}
|
||||
@@ -119,6 +119,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode SOCIAL_USER_UNBIND_NOT_SELF = new ErrorCode(1_002_018_001, "社交解绑失败,非当前用户绑定");
|
||||
ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1_002_018_002, "社交授权失败,找不到对应的用户");
|
||||
|
||||
ErrorCode SOCIAL_APP_WEIXIN_MINI_APP_PHONE_CODE_ERROR = new ErrorCode(1_002_018_103, "获得手机号失败");
|
||||
|
||||
// ========== 系统敏感词 1-002-019-000 =========
|
||||
ErrorCode SENSITIVE_WORD_NOT_EXISTS = new ErrorCode(1_002_019_000, "系统敏感词在所有标签中都不存在");
|
||||
ErrorCode SENSITIVE_WORD_EXISTS = new ErrorCode(1_002_019_001, "系统敏感词已在标签中存在");
|
||||
|
||||
@@ -17,8 +17,9 @@ import java.util.Arrays;
|
||||
public enum SmsSceneEnum implements IntArrayValuable {
|
||||
|
||||
MEMBER_LOGIN(1, "user-sms-login", "会员用户 - 手机号登陆"),
|
||||
MEMBER_UPDATE_MOBILE(2, "user-sms-reset-password", "会员用户 - 修改手机"),
|
||||
MEMBER_FORGET_PASSWORD(3, "user-sms-update-mobile", "会员用户 - 忘记密码"),
|
||||
MEMBER_UPDATE_MOBILE(2, "user-update-mobile", "会员用户 - 修改手机"),
|
||||
MEMBER_UPDATE_PASSWORD(3, "user-update-mobile", "会员用户 - 修改密码"),
|
||||
MEMBER_RESET_PASSWORD(4, "user-reset-password", "会员用户 - 忘记密码"),
|
||||
|
||||
ADMIN_MEMBER_LOGIN(21, "admin-sms-login", "后台用户 - 手机号登录");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user