mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 07:11:52 +08:00
【新增】SYSTEM: 发送微信小程序订阅消息测试接口
This commit is contained in:
parent
63e319e663
commit
8054847b05
@ -13,4 +13,9 @@ public interface MessageTemplateConstants {
|
||||
String BROKERAGE_WITHDRAW_AUDIT_APPROVE = "brokerage_withdraw_audit_approve"; // 佣金提现(审核通过)
|
||||
String BROKERAGE_WITHDRAW_AUDIT_REJECT = "brokerage_withdraw_audit_reject"; // 佣金提现(审核不通过)
|
||||
|
||||
//======================= 订阅消息模版 =======================
|
||||
|
||||
String ORDER_AFTERSALE_CHANGE = "售后进度通知";
|
||||
String MONEY_CHANGE = "充值成功通知";
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.api.social.dto;
|
||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -65,6 +66,14 @@ public class SocialWxSubscribeMessageReqDTO {
|
||||
* 描述: 模板内容,不填则下发空模板
|
||||
* </pre>
|
||||
*/
|
||||
private List<KeyValue<String, String>> data;
|
||||
private List<KeyValue<String, String>> messages;
|
||||
|
||||
public SocialWxSubscribeMessageReqDTO addData(String key, String value) {
|
||||
if (messages == null) {
|
||||
messages = new ArrayList<>();
|
||||
}
|
||||
messages.add(new KeyValue<>(key, value));
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
### 请求 /system/social-client/send-subscribe-message 接口 => 发送测试订阅消息
|
||||
POST {{baseUrl}}/system/social-client/send-subscribe-message
|
||||
Authorization: Bearer {{token}}
|
||||
#Authorization: Bearer test100
|
||||
tenant-id: {{adminTenentId}}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.socail;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxSubscribeMessageReqDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientSaveReqVO;
|
||||
@ -11,13 +12,12 @@ import cn.iocoder.yudao.module.system.service.social.SocialClientService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 社交客户端")
|
||||
@ -70,4 +70,16 @@ public class SocialClientController {
|
||||
return success(BeanUtils.toBean(pageResult, SocialClientRespVO.class));
|
||||
}
|
||||
|
||||
//======================= TODO 测试发送订阅消息 =======================
|
||||
|
||||
@PostMapping("/send-subscribe-message")
|
||||
public void testSendSubscribeMessage() {
|
||||
SocialWxSubscribeMessageReqDTO reqDTO = new SocialWxSubscribeMessageReqDTO().setLang("zh_CN")
|
||||
.setMiniprogramState("developer").setTemplateId("W4ybDTIwCfKHtMKR7fSfx83DtmVKEeXQo3Ti7GCw4_4")
|
||||
.setToUser("oKNkb4xxw2H135-MVPKtEMkumK08");
|
||||
reqDTO.addData("character_string1", "11111111").addData("amount2", "6666").addData("time3", "2024-01-01 10:10:10")
|
||||
.addData("phrase4", "成功");
|
||||
socialClientService.sendSubscribeMessage(reqDTO);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
try {
|
||||
WxMaSubscribeService subscribeService = service.getSubscribeService();
|
||||
WxMaSubscribeMessage message = BeanUtils.toBean(reqDTO, WxMaSubscribeMessage.class);
|
||||
reqDTO.getData().forEach(item-> message.addData(new WxMaSubscribeMessage.MsgData(item.getKey(), item.getValue())));
|
||||
reqDTO.getMessages().forEach(item-> message.addData(new WxMaSubscribeMessage.MsgData(item.getKey(), item.getValue())));
|
||||
subscribeService.sendSubscribeMsg(message);
|
||||
}catch (WxErrorException e) {
|
||||
log.error("[sendSubscribeMessage][发送小程序订阅消息]", e);
|
||||
|
Loading…
Reference in New Issue
Block a user