From 9ec2f8b60f60929fed4c6ec4c3e2000e1f399eb7 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 8 Jan 2023 18:57:36 +0800 Subject: [PATCH] =?UTF-8?q?mp=EF=BC=9A=E6=A2=B3=E7=90=86=20message=20?= =?UTF-8?q?=E7=9A=84=E5=89=8D=E7=AB=AF=E5=92=8C=E5=90=8E=E7=AB=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/message/MpMessageController.http | 5 + .../admin/message/MpMessageController.java | 30 +- .../admin/message/vo/MpMessageBaseVO.java | 181 ++++++++-- yudao-ui-admin/src/api/mp/message.js | 27 ++ yudao-ui-admin/src/api/wechatMp/wxFansMsg.js | 54 --- .../src/views/mp/components/LICENSE | 21 ++ yudao-ui-admin/src/views/mp/message/index.vue | 233 ++++++++++++ .../src/views/wechatMp/wxFansMsg/index.vue | 318 ---------------- .../src/views/wechatMp/wxFansMsgRes/index.vue | 235 ------------ .../wechatMp/wxNewsArticleItem/index.vue | 340 ------------------ .../views/wechatMp/wxNewsTemplate/index.vue | 254 ------------- .../views/wechatMp/wxReceiveText/index.vue | 258 ------------- .../views/wechatMp/wxSubscribeText/index.vue | 249 ------------- .../views/wechatMp/wxTextTemplate/index.vue | 235 ------------ 14 files changed, 457 insertions(+), 1983 deletions(-) create mode 100644 yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpMessageController.http create mode 100644 yudao-ui-admin/src/api/mp/message.js delete mode 100644 yudao-ui-admin/src/api/wechatMp/wxFansMsg.js create mode 100644 yudao-ui-admin/src/views/mp/components/LICENSE create mode 100644 yudao-ui-admin/src/views/mp/message/index.vue delete mode 100644 yudao-ui-admin/src/views/wechatMp/wxFansMsg/index.vue delete mode 100644 yudao-ui-admin/src/views/wechatMp/wxFansMsgRes/index.vue delete mode 100644 yudao-ui-admin/src/views/wechatMp/wxNewsArticleItem/index.vue delete mode 100644 yudao-ui-admin/src/views/wechatMp/wxNewsTemplate/index.vue delete mode 100644 yudao-ui-admin/src/views/wechatMp/wxReceiveText/index.vue delete mode 100644 yudao-ui-admin/src/views/wechatMp/wxSubscribeText/index.vue delete mode 100644 yudao-ui-admin/src/views/wechatMp/wxTextTemplate/index.vue diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpMessageController.http b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpMessageController.http new file mode 100644 index 000000000..6979d593a --- /dev/null +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpMessageController.http @@ -0,0 +1,5 @@ +### 请求 /mp/message/page 接口 => 成功 +GET {{baseUrl}}/mp/message/page?accountId=1&pageNo=1&pageSize=10 +Content-Type: application/json +Authorization: Bearer {{token}} +tenant-id: {{adminTenentId}} diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpMessageController.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpMessageController.java index 413d2621f..443891b24 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpMessageController.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpMessageController.java @@ -1,25 +1,25 @@ package cn.iocoder.yudao.module.mp.controller.admin.message; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.mp.controller.admin.message.vo.MpMessagePageReqVO; +import cn.iocoder.yudao.module.mp.controller.admin.message.vo.MpMessageRespVO; +import cn.iocoder.yudao.module.mp.convert.message.MpMessageConvert; import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO; -import org.springframework.web.bind.annotation.*; +import cn.iocoder.yudao.module.mp.service.message.MpMessageService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; - -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.annotations.*; - -import javax.validation.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import javax.validation.Valid; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import cn.iocoder.yudao.module.mp.controller.admin.message.vo.*; -import cn.iocoder.yudao.module.mp.convert.message.MpMessageConvert; -import cn.iocoder.yudao.module.mp.service.message.MpMessageService; - @Api(tags = "管理后台 - 粉丝消息表") @RestController @RequestMapping("/mp/message") @@ -31,7 +31,7 @@ public class MpMessageController { @GetMapping("/page") @ApiOperation("获得粉丝消息表分页") - @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:query')") + @PreAuthorize("@ss.hasPermission('mp:message:query')") public CommonResult> getWxFansMsgPage(@Valid MpMessagePageReqVO pageVO) { PageResult pageResult = mpMessageService.getWxFansMsgPage(pageVO); return success(MpMessageConvert.INSTANCE.convertPage(pageResult)); diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/MpMessageBaseVO.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/MpMessageBaseVO.java index a30de6c52..32e406814 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/MpMessageBaseVO.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/MpMessageBaseVO.java @@ -1,7 +1,14 @@ package cn.iocoder.yudao.module.mp.controller.admin.message.vo; -import lombok.*; -import io.swagger.annotations.*; +import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; +import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO; +import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO; +import cn.iocoder.yudao.module.mp.enums.message.MpMessageSendFromEnum; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; +import me.chanjar.weixin.common.api.WxConsts; + +import java.util.List; /** * 粉丝消息表 Base VO,提供给添加、修改、详细的子 VO 使用 @@ -10,37 +17,161 @@ import io.swagger.annotations.*; @Data public class MpMessageBaseVO { - @ApiModelProperty(value = "用户标识") + /** + * 微信公众号消息 id + */ + private Long msgId; + /** + * 微信公众号 ID + * + * 关联 {@link MpAccountDO#getId()} + */ + private Long accountId; + /** + * 微信公众号 appid + * + * 冗余 {@link MpAccountDO#getAppId()} + */ + private String appId; + /** + * 微信用户编号 + * + * 关联 {@link MpUserDO#getId()} + */ + private Long userId; + /** + * 用户标识 + * + * 冗余 {@link MpUserDO#getOpenid()} + */ private String openid; - @ApiModelProperty(value = "昵称") - private byte[] nickname; + /** + * 消息类型 + * + * 枚举 {@link WxConsts.XmlMsgType} + */ + private String type; + /** + * 消息来源 + * + * 枚举 {@link MpMessageSendFromEnum} + */ + private Integer sendFrom; - @ApiModelProperty(value = "头像地址") - private String headimgUrl; + // ========= 普通消息内容 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html - @ApiModelProperty(value = "微信账号ID") - private String wxAccountId; - - @ApiModelProperty(value = "消息类型") - private String msgType; - - @ApiModelProperty(value = "内容") + /** + * 消息内容 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 TEXT + */ private String content; - @ApiModelProperty(value = "最近一条回复内容") - private String resContent; - - @ApiModelProperty(value = "是否已回复") - private String isRes; - - @ApiModelProperty(value = "微信素材ID") + /** + * 通过素材管理中的接口上传多媒体文件,得到的 id + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 IMAGE、VOICE、VIDEO + */ private String mediaId; + /** + * 媒体文件的 URL + */ + private String mediaUrl; + /** + * 语音识别后文本 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 VOICE + */ + private String recognition; + /** + * 语音格式,如 amr,speex 等 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 VOICE + */ + private String format; + /** + * 标题 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 VIDEO、MUSIC、LINK + */ + private String title; + /** + * 描述 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 VIDEO、MUSIC + */ + private String description; - @ApiModelProperty(value = "微信图片URL") - private String picUrl; + /** + * 缩略图的媒体 id,通过素材管理中的接口上传多媒体文件,得到的 id + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 VIDEO + */ + private String thumbMediaId; + /** + * 缩略图的媒体 URL + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 VIDEO + */ + private String thumbMediaUrl; - @ApiModelProperty(value = "本地图片路径") - private String picPath; + /** + * 点击图文消息跳转链接 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 LINK + */ + private String url; + + /** + * 地理位置维度 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 LOCATION + */ + private Double locationX; + /** + * 地理位置经度 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 LOCATION + */ + private Double locationY; + /** + * 地图缩放大小 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 LOCATION + */ + private Double scale; + /** + * 详细地址 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 LOCATION + * + * 例如说杨浦区黄兴路 221-4 号临 + */ + private String label; + + /** + * 图文消息数组 + * + * 消息类型为 {@link WxConsts.XmlMsgType} 的 NEWS + */ + @TableField(typeHandler = MpMessageDO.ArticleTypeHandler.class) + private List articles; + + // ========= 事件推送 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_event_pushes.html + + /** + * 事件类型 + * + * 枚举 {@link WxConsts.EventType} + */ + private String event; + /** + * 事件 Key + * + * 1. {@link WxConsts.EventType} 的 SCAN:qrscene_ 为前缀,后面为二维码的参数值 + * 2. {@link WxConsts.EventType} 的 CLICK:与自定义菜单接口中 KEY 值对应 + */ + private String eventKey; } diff --git a/yudao-ui-admin/src/api/mp/message.js b/yudao-ui-admin/src/api/mp/message.js new file mode 100644 index 000000000..2eef1a044 --- /dev/null +++ b/yudao-ui-admin/src/api/mp/message.js @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +// 创建粉丝消息表 +export function createMessage(data) { + return request({ + url: '/mp/message/create', + method: 'post', + data: data + }) +} + +// 获得粉丝消息表 +export function getMessage(id) { + return request({ + url: '/mp/message/get?id=' + id, + method: 'get' + }) +} + +// 获得粉丝消息表 分页 +export function getMessagePage(query) { + return request({ + url: '/mp/message/page', + method: 'get', + params: query + }) +} diff --git a/yudao-ui-admin/src/api/wechatMp/wxFansMsg.js b/yudao-ui-admin/src/api/wechatMp/wxFansMsg.js deleted file mode 100644 index 39cd932e7..000000000 --- a/yudao-ui-admin/src/api/wechatMp/wxFansMsg.js +++ /dev/null @@ -1,54 +0,0 @@ -import request from '@/utils/request' - -// 创建粉丝消息表 -export function createWxFansMsg(data) { - return request({ - url: '/wechatMp/wx-fans-msg/create', - method: 'post', - data: data - }) -} - -// 更新粉丝消息表 -export function updateWxFansMsg(data) { - return request({ - url: '/wechatMp/wx-fans-msg/update', - method: 'put', - data: data - }) -} - -// 删除粉丝消息表 -export function deleteWxFansMsg(id) { - return request({ - url: '/wechatMp/wx-fans-msg/delete?id=' + id, - method: 'delete' - }) -} - -// 获得粉丝消息表 -export function getWxFansMsg(id) { - return request({ - url: '/wechatMp/wx-fans-msg/get?id=' + id, - method: 'get' - }) -} - -// 获得粉丝消息表 分页 -export function getWxFansMsgPage(query) { - return request({ - url: '/wechatMp/wx-fans-msg/page', - method: 'get', - params: query - }) -} - -// 导出粉丝消息表 Excel -export function exportWxFansMsgExcel(query) { - return request({ - url: '/wechatMp/wx-fans-msg/export-excel', - method: 'get', - params: query, - responseType: 'blob' - }) -} diff --git a/yudao-ui-admin/src/views/mp/components/LICENSE b/yudao-ui-admin/src/views/mp/components/LICENSE new file mode 100644 index 000000000..1118c8f6f --- /dev/null +++ b/yudao-ui-admin/src/views/mp/components/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 JooLun + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/yudao-ui-admin/src/views/mp/message/index.vue b/yudao-ui-admin/src/views/mp/message/index.vue new file mode 100644 index 000000000..98a75273e --- /dev/null +++ b/yudao-ui-admin/src/views/mp/message/index.vue @@ -0,0 +1,233 @@ + + + diff --git a/yudao-ui-admin/src/views/wechatMp/wxFansMsg/index.vue b/yudao-ui-admin/src/views/wechatMp/wxFansMsg/index.vue deleted file mode 100644 index 217b182fb..000000000 --- a/yudao-ui-admin/src/views/wechatMp/wxFansMsg/index.vue +++ /dev/null @@ -1,318 +0,0 @@ - - - diff --git a/yudao-ui-admin/src/views/wechatMp/wxFansMsgRes/index.vue b/yudao-ui-admin/src/views/wechatMp/wxFansMsgRes/index.vue deleted file mode 100644 index c9fcd4ec9..000000000 --- a/yudao-ui-admin/src/views/wechatMp/wxFansMsgRes/index.vue +++ /dev/null @@ -1,235 +0,0 @@ - - - diff --git a/yudao-ui-admin/src/views/wechatMp/wxNewsArticleItem/index.vue b/yudao-ui-admin/src/views/wechatMp/wxNewsArticleItem/index.vue deleted file mode 100644 index a9d0681e4..000000000 --- a/yudao-ui-admin/src/views/wechatMp/wxNewsArticleItem/index.vue +++ /dev/null @@ -1,340 +0,0 @@ - - - diff --git a/yudao-ui-admin/src/views/wechatMp/wxNewsTemplate/index.vue b/yudao-ui-admin/src/views/wechatMp/wxNewsTemplate/index.vue deleted file mode 100644 index 18e6dbb08..000000000 --- a/yudao-ui-admin/src/views/wechatMp/wxNewsTemplate/index.vue +++ /dev/null @@ -1,254 +0,0 @@ - - - diff --git a/yudao-ui-admin/src/views/wechatMp/wxReceiveText/index.vue b/yudao-ui-admin/src/views/wechatMp/wxReceiveText/index.vue deleted file mode 100644 index b9621ff6f..000000000 --- a/yudao-ui-admin/src/views/wechatMp/wxReceiveText/index.vue +++ /dev/null @@ -1,258 +0,0 @@ - - - diff --git a/yudao-ui-admin/src/views/wechatMp/wxSubscribeText/index.vue b/yudao-ui-admin/src/views/wechatMp/wxSubscribeText/index.vue deleted file mode 100644 index f7c7aefa0..000000000 --- a/yudao-ui-admin/src/views/wechatMp/wxSubscribeText/index.vue +++ /dev/null @@ -1,249 +0,0 @@ - - - diff --git a/yudao-ui-admin/src/views/wechatMp/wxTextTemplate/index.vue b/yudao-ui-admin/src/views/wechatMp/wxTextTemplate/index.vue deleted file mode 100644 index 5b794166a..000000000 --- a/yudao-ui-admin/src/views/wechatMp/wxTextTemplate/index.vue +++ /dev/null @@ -1,235 +0,0 @@ - - -