# Conflicts:
#	yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/history/ProductBrowseHistoryController.java
#	yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/social/AppSocialUserController.java
#	yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApiImpl.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialClientController.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
This commit is contained in:
YunaiV
2024-07-31 23:49:21 +08:00
37 changed files with 589 additions and 81 deletions

View File

@@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.system.api.social;
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.api.social.dto.SocialWxQrcodeReqDTO;
import cn.iocoder.yudao.module.system.api.social.dto.*;
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
import javax.validation.Valid;
import java.util.List;
/**
* 社交应用的 API 接口
*
@@ -17,8 +17,8 @@ public interface SocialClientApi {
/**
* 获得社交平台的授权 URL
*
* @param socialType 社交平台的类型 {@link SocialTypeEnum}
* @param userType 用户类型
* @param socialType 社交平台的类型 {@link SocialTypeEnum}
* @param userType 用户类型
* @param redirectUri 重定向 URL
* @return 社交平台的授权 URL
*/
@@ -28,15 +28,17 @@ public interface SocialClientApi {
* 创建微信公众号 JS SDK 初始化所需的签名
*
* @param userType 用户类型
* @param url 访问的 URL 地址
* @param url 访问的 URL 地址
* @return 签名
*/
SocialWxJsapiSignatureRespDTO createWxMpJsapiSignature(Integer userType, String url);
//======================= 微信小程序独有 =======================
/**
* 获得微信小程序的手机信息
*
* @param userType 用户类型
* @param userType 用户类型
* @param phoneCode 手机授权码
* @return 手机信息
*/
@@ -50,4 +52,18 @@ public interface SocialClientApi {
*/
byte[] getWxaQrcode(@Valid SocialWxQrcodeReqDTO reqVO);
/**
* 获得微信小程订阅模板
*
* @return 小程序订阅消息模版
*/
List<SocialWxaSubscribeTemplateRespDTO> getWxaSubscribeTemplateList(Integer userType);
/**
* 发送微信小程序订阅消息
*
* @param reqDTO 请求
*/
void sendWxaSubscribeMessage(SocialWxaSubscribeMessageSendReqDTO reqDTO);
}

View File

@@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.system.api.social.dto;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
* 微信小程序订阅消息发送 Request DTO
*
* @author HUIHUI
*/
@Data
public class SocialWxaSubscribeMessageSendReqDTO {
/**
* 用户编号
*
* 关联 MemberUserDO 的 id 编号
* 关联 AdminUserDO 的 id 编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 用户类型
*
* 关联 {@link UserTypeEnum}
*/
@NotNull(message = "用户类型不能为空")
private Integer userType;
/**
* 消息模版标题
*/
@NotEmpty(message = "消息模版标题不能为空")
private String templateTitle;
/**
* 点击模板卡片后的跳转页面,仅限本小程序内的页面
*
* 支持带参数,(示例 index?foo=bar )。该字段不填则模板无跳转。
*/
private String page;
/**
* 模板内容的参数
*/
private Map<String, String> messages;
public SocialWxaSubscribeMessageSendReqDTO addMessage(String key, String value) {
if (messages == null) {
messages = new HashMap<>();
}
messages.put(key, value);
return this;
}
}

View File

@@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.system.api.social.dto;
import lombok.Data;
/**
* 小程序订阅消息模版 Response DTO
*
* @author HUIHUI
*/
@Data
public class SocialWxaSubscribeTemplateRespDTO {
/**
* 模版编号
*/
private String id;
/**
* 模版标题
*/
private String title;
/**
* 模版内容
*/
private String content;
/**
* 模板内容示例
*/
private String example;
/**
* 模版类型
*
* 2为一次性订阅
* 3为长期订阅
*/
private Integer type;
}

View File

@@ -117,8 +117,10 @@ public interface ErrorCodeConstants {
ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR = new ErrorCode(1_002_018_200, "获得手机号失败");
ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_QRCODE_ERROR = new ErrorCode(1_002_018_201, "获得小程序码失败");
ErrorCode SOCIAL_CLIENT_NOT_EXISTS = new ErrorCode(1_002_018_202, "社交客户端不存在");
ErrorCode SOCIAL_CLIENT_UNIQUE = new ErrorCode(1_002_018_203, "社交客户端已存在配置");
ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_SUBSCRIBE_TEMPLATE_ERROR = new ErrorCode(1_002_018_202, "获得小程序订阅消息模版失败");
ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_SUBSCRIBE_MESSAGE_ERROR = new ErrorCode(1_002_018_203, "发送小程序订阅消息失败");
ErrorCode SOCIAL_CLIENT_NOT_EXISTS = new ErrorCode(1_002_018_210, "社交客户端不存在");
ErrorCode SOCIAL_CLIENT_UNIQUE = new ErrorCode(1_002_018_211, "社交客户端已存在配置");
// ========== OAuth2 客户端 1-002-020-000 =========