feat(0): [java]-[wechat-ferry-mvn]-1.查询所有联系人接口修改
2.发送消息入参字段统一
This commit is contained in:
parent
96e8fbea19
commit
217b7fe632
@ -13,21 +13,25 @@ import com.wechat.ferry.entity.TResponse;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpDatabaseSqlReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpDatabaseTableReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpGroupMemberReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendCardMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpPatOnePatMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendEmojiMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendFileMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendImageMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendRichTextMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendTextMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendXmlMsgReq;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpContactsResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpLoginInfoResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendFileMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendImageMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendPatOnePatMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendRichTextMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendTextMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendXmlMsgResp;
|
||||
import com.wechat.ferry.enums.ResponseCodeEnum;
|
||||
import com.wechat.ferry.service.WeChatDllService;
|
||||
|
||||
@ -151,10 +155,10 @@ public class WeChatDllController {
|
||||
return TResponse.ok(ResponseCodeEnum.SUCCESS, resp);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发送卡片消息", notes = "sendCardMsg")
|
||||
@PostMapping(value = "/send/cardMsg")
|
||||
public TResponse<WxPpSendCardMsgResp> sendCardMsg(@Validated @RequestBody WxPpSendCardMsgReq request) {
|
||||
WxPpSendCardMsgResp resp = weChatDllService.sendCardMsg(request);
|
||||
@ApiOperation(value = "发送XML消息", notes = "sendXmlMsg")
|
||||
@PostMapping(value = "/send/xmlMsg")
|
||||
public TResponse<WxPpSendXmlMsgResp> sendXmlMsg(@Validated @RequestBody WxPpSendXmlMsgReq request) {
|
||||
WxPpSendXmlMsgResp resp = weChatDllService.sendXmlMsg(request);
|
||||
return TResponse.ok(ResponseCodeEnum.SUCCESS, resp);
|
||||
}
|
||||
|
||||
@ -165,7 +169,21 @@ public class WeChatDllController {
|
||||
return TResponse.ok(ResponseCodeEnum.SUCCESS, resp);
|
||||
}
|
||||
|
||||
// @ApiOperation(value = "拍一拍群友", notes = "queryMsgTypeList")
|
||||
@ApiOperation(value = "发送富文本消息", notes = "sendRichTextMsg")
|
||||
@PostMapping(value = "/send/richTextMsg")
|
||||
public TResponse<WxPpSendRichTextMsgResp> sendRichTextMsg(@Validated @RequestBody WxPpSendRichTextMsgReq request) {
|
||||
WxPpSendRichTextMsgResp resp = weChatDllService.sendRichTextMsg(request);
|
||||
return TResponse.ok(ResponseCodeEnum.SUCCESS, resp);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "拍一拍群友", notes = "patOnePat")
|
||||
@PostMapping(value = "/patOnePat")
|
||||
public TResponse<WxPpSendPatOnePatMsgResp> patOnePat(@Validated @RequestBody WxPpPatOnePatMsgReq request) {
|
||||
WxPpSendPatOnePatMsgResp resp = weChatDllService.patOnePat(request);
|
||||
return TResponse.ok(ResponseCodeEnum.SUCCESS, resp);
|
||||
}
|
||||
|
||||
// @ApiOperation(value = "撤回消息", notes = "queryMsgTypeList")
|
||||
// @PostMapping(value = "/list/msgType")
|
||||
// public TResponse<Object> queryMsgTypeList() {
|
||||
// return TResponse.ok(ResponseCodeEnum.SUCCESS, list);
|
||||
@ -189,12 +207,14 @@ public class WeChatDllController {
|
||||
// return TResponse.ok(ResponseCodeEnum.SUCCESS, list);
|
||||
// }
|
||||
//
|
||||
// @ApiOperation(value = "查询数据库", notes = "queryMsgTypeList")
|
||||
|
||||
// @ApiOperation(value = "通过好友申请", notes = "queryMsgTypeList")
|
||||
// @PostMapping(value = "/list/msgType")
|
||||
// public TResponse<Object> queryMsgTypeList() {
|
||||
// return TResponse.ok(ResponseCodeEnum.SUCCESS, list);
|
||||
// public TResponse<WxPpSendPatOnePatMsgResp> friendApply(@Validated @RequestBody WxPpPatOnePatMsgReq request) {
|
||||
// // WxPpSendPatOnePatMsgResp resp = weChatDllService.patOnePat(request);
|
||||
// return TResponse.ok(ResponseCodeEnum.SUCCESS, resp);
|
||||
// }
|
||||
//
|
||||
|
||||
// @ApiOperation(value = "获取朋友圈消息", notes = "queryMsgTypeList")
|
||||
// @PostMapping(value = "/list/msgType")
|
||||
// public TResponse<Object> queryMsgTypeList() {
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.wechat.ferry.entity.vo.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求入参-个微发送拍一拍消息
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024-10-06 15:50
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "wxPpPatOnePatMsgReq", description = "个微发送拍一拍消息请求入参")
|
||||
public class WxPpPatOnePatMsgReq {
|
||||
|
||||
/**
|
||||
* 消息接收人
|
||||
* 消息接收人,私聊为 wxid(wxid_xxxxxxxxxxxxxx)
|
||||
* 群聊为 roomid(xxxxxxxxxx@chatroom)
|
||||
*/
|
||||
@ApiModelProperty(value = "消息接收人")
|
||||
private String recipient;
|
||||
|
||||
/**
|
||||
* 要拍的wxid
|
||||
*/
|
||||
@ApiModelProperty(value = "要拍的wxid")
|
||||
private String patUser;
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package com.wechat.ferry.entity.vo.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求入参-个微发送卡片消息
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024-10-04 23:11
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "wxPpSendCardMsgReq", description = "个微发送卡片消息请求入参")
|
||||
public class WxPpSendCardMsgReq {
|
||||
|
||||
/**
|
||||
* 消息接收人
|
||||
* 消息接收人,私聊为 wxid(wxid_xxxxxxxxxxxxxx)
|
||||
* 群聊为 roomid(xxxxxxxxxx@chatroom)
|
||||
*/
|
||||
@ApiModelProperty(value = "消息接收人")
|
||||
private String recipient;
|
||||
|
||||
/**
|
||||
* XML报文
|
||||
*/
|
||||
@ApiModelProperty(value = "XML报文")
|
||||
private String xml;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
@ApiModelProperty(value = "路径")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty(value = "类型")
|
||||
private Integer type;
|
||||
|
||||
}
|
@ -15,10 +15,10 @@ import lombok.Data;
|
||||
public class WxPpSendEmojiMsgReq {
|
||||
|
||||
/**
|
||||
* 路径
|
||||
* 资源路径-本地表情路径
|
||||
*/
|
||||
@ApiModelProperty(value = "路径")
|
||||
private String path;
|
||||
@ApiModelProperty(value = "资源路径-本地表情路径")
|
||||
private String resourcePath;
|
||||
|
||||
/**
|
||||
* 消息接收人
|
||||
|
@ -15,10 +15,10 @@ import lombok.Data;
|
||||
public class WxPpSendFileMsgReq {
|
||||
|
||||
/**
|
||||
* 图片地址
|
||||
* 资源路径-本地文件路径
|
||||
*/
|
||||
@ApiModelProperty(value = "图片地址")
|
||||
private String path;
|
||||
@ApiModelProperty(value = "资源路径-本地文件路径")
|
||||
private String resourcePath;
|
||||
|
||||
/**
|
||||
* 消息接收人
|
||||
|
@ -15,10 +15,12 @@ import lombok.Data;
|
||||
public class WxPpSendImageMsgReq {
|
||||
|
||||
/**
|
||||
* 图片地址
|
||||
* 资源路径-本地图片地址
|
||||
* 如:`C:/Projs/WeChatRobot/TEQuant.jpeg`
|
||||
* 或 `https://raw.githubusercontent.com/lich0821/WeChatFerry/master/assets/TEQuant.jpg`
|
||||
*/
|
||||
@ApiModelProperty(value = "图片地址")
|
||||
private String path;
|
||||
@ApiModelProperty(value = "资源路径-本地图片地址")
|
||||
private String resourcePath;
|
||||
|
||||
/**
|
||||
* 消息接收人
|
||||
|
@ -0,0 +1,61 @@
|
||||
package com.wechat.ferry.entity.vo.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求入参-个微发送富文本消息
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024-10-06 15:40
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "wxPpSendRichTextMsgReq", description = "个微发送富文本消息请求入参")
|
||||
public class WxPpSendRichTextMsgReq {
|
||||
|
||||
/**
|
||||
* 消息接收人
|
||||
* 消息接收人,私聊为 wxid(wxid_xxxxxxxxxxxxxx)
|
||||
* 群聊为 roomid(xxxxxxxxxx@chatroom)
|
||||
*/
|
||||
@ApiModelProperty(value = "消息接收人")
|
||||
private String recipient;
|
||||
|
||||
/**
|
||||
* 左下显示的名字
|
||||
*/
|
||||
@ApiModelProperty(value = "左下显示的名字")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 填公众号id 可以显示对应的头像(gh_ 开头的)
|
||||
*/
|
||||
@ApiModelProperty(value = "资源路径-封面图片路径")
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 标题,最多两行
|
||||
*/
|
||||
@ApiModelProperty(value = "标题,最多两行")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 摘要,三行
|
||||
*/
|
||||
@ApiModelProperty(value = "摘要,三行")
|
||||
private String digest;
|
||||
|
||||
/**
|
||||
* 点击后跳转的链接
|
||||
*/
|
||||
@ApiModelProperty(value = "点击后跳转的链接")
|
||||
private String jumpUrl;
|
||||
|
||||
/**
|
||||
* 缩略图的链接
|
||||
*/
|
||||
@ApiModelProperty(value = "缩略图的链接")
|
||||
private String thumbnailUrl;
|
||||
|
||||
}
|
@ -19,6 +19,7 @@ public class WxPpSendTextMsgReq {
|
||||
/**
|
||||
* 消息文本
|
||||
* 消息内容(如果是 @ 消息则需要有跟 @ 的人数量相同的 @)
|
||||
* 换行使用 `\\\\n` (单杠)
|
||||
*/
|
||||
@ApiModelProperty(value = "消息文本")
|
||||
private String msgText;
|
||||
|
@ -0,0 +1,43 @@
|
||||
package com.wechat.ferry.entity.vo.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求入参-个微发送XML消息
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024-10-04 23:11
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "wxPpSendXmlMsgReq", description = "个微发送XML消息请求入参")
|
||||
public class WxPpSendXmlMsgReq {
|
||||
|
||||
/**
|
||||
* 消息接收人
|
||||
* 消息接收人,私聊为 wxid(wxid_xxxxxxxxxxxxxx)
|
||||
* 群聊为 roomid(xxxxxxxxxx@chatroom)
|
||||
*/
|
||||
@ApiModelProperty(value = "消息接收人")
|
||||
private String recipient;
|
||||
|
||||
/**
|
||||
* XML报文内容
|
||||
*/
|
||||
@ApiModelProperty(value = "XML报文内容")
|
||||
private String xmlContent;
|
||||
|
||||
/**
|
||||
* 资源路径-封面图片路径
|
||||
*/
|
||||
@ApiModelProperty(value = "资源路径-封面图片路径")
|
||||
private String resourcePath;
|
||||
|
||||
/**
|
||||
* xml类型,如:0x21 为小程序
|
||||
*/
|
||||
@ApiModelProperty(value = "xml类型")
|
||||
private Integer xmlType;
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.wechat.ferry.entity.vo.response;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求出参-个微发送拍一拍消息
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024/10/06 15:52
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "wxPpSendPatOnePatMsgResp", description = "个微发送拍一拍消息请求出参")
|
||||
public class WxPpSendPatOnePatMsgResp {
|
||||
|
||||
/**
|
||||
* 类型编号
|
||||
*/
|
||||
@ApiModelProperty(value = "类型编号")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.wechat.ferry.entity.vo.response;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求出参-个微发送富文本消息
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024/10/06 15:46
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "wxPpSendRichTextMsgResp", description = "个微发送富文本消息请求出参")
|
||||
public class WxPpSendRichTextMsgResp {
|
||||
|
||||
/**
|
||||
* 类型编号
|
||||
*/
|
||||
@ApiModelProperty(value = "类型编号")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String name;
|
||||
|
||||
}
|
@ -5,14 +5,14 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求出参-个微发送卡片消息
|
||||
* 请求出参-个微发送XML消息
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024/10/04 23:11
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "wxPpSendCardMsgResp", description = "个微发送卡片消息请求出参")
|
||||
public class WxPpSendCardMsgResp {
|
||||
@ApiModel(value = "wxPpSendCardMsgResp", description = "个微发送XML消息请求出参")
|
||||
public class WxPpSendXmlMsgResp {
|
||||
|
||||
/**
|
||||
* 类型编号
|
@ -33,9 +33,14 @@ public enum WxContactsTypeEnum {
|
||||
GROUP("3", "群组", "@chatroom"),
|
||||
|
||||
/**
|
||||
* 4-公众号
|
||||
* 4-官方杂号
|
||||
*/
|
||||
OFFICIAL_ACCOUNT("4", "公众号", "gh_"),
|
||||
OFFICIAL_MIXED_NO("4", "官方杂号", null),
|
||||
|
||||
/**
|
||||
* 5-公众号
|
||||
*/
|
||||
OFFICIAL_ACCOUNT("5", "公众号", "gh_"),
|
||||
|
||||
/**
|
||||
* 未匹配上
|
||||
|
@ -5,21 +5,25 @@ import java.util.List;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpDatabaseSqlReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpDatabaseTableReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpGroupMemberReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendCardMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpPatOnePatMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendEmojiMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendFileMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendImageMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendRichTextMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendTextMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendXmlMsgReq;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpContactsResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpLoginInfoResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendFileMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendImageMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendPatOnePatMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendRichTextMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendTextMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendXmlMsgResp;
|
||||
|
||||
/**
|
||||
* 业务接口-对接原本DLL的接口
|
||||
@ -158,7 +162,7 @@ public interface WeChatDllService {
|
||||
WxPpSendFileMsgResp sendFileMsg(WxPpSendFileMsgReq request);
|
||||
|
||||
/**
|
||||
* 发送卡片消息
|
||||
* 发送XML消息
|
||||
*
|
||||
* @param request 请求入参
|
||||
* @return 消息发送返回
|
||||
@ -166,7 +170,7 @@ public interface WeChatDllService {
|
||||
* @author chandler
|
||||
* @date 2024-10-04 23:15
|
||||
*/
|
||||
WxPpSendCardMsgResp sendCardMsg(WxPpSendCardMsgReq request);
|
||||
WxPpSendXmlMsgResp sendXmlMsg(WxPpSendXmlMsgReq request);
|
||||
|
||||
/**
|
||||
* 发送表情消息
|
||||
@ -179,4 +183,26 @@ public interface WeChatDllService {
|
||||
*/
|
||||
WxPpSendEmojiMsgResp sendEmojiMsg(WxPpSendEmojiMsgReq request);
|
||||
|
||||
/**
|
||||
* 发送富文本消息
|
||||
*
|
||||
* @param request 请求入参
|
||||
* @return 消息发送返回
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024-10-06 15:48
|
||||
*/
|
||||
WxPpSendRichTextMsgResp sendRichTextMsg(WxPpSendRichTextMsgReq request);
|
||||
|
||||
/**
|
||||
* 拍一拍
|
||||
*
|
||||
* @param request 请求入参
|
||||
* @return 消息发送返回
|
||||
*
|
||||
* @author chandler
|
||||
* @date 2024-10-06 15:54
|
||||
*/
|
||||
WxPpSendPatOnePatMsgResp patOnePat(WxPpPatOnePatMsgReq request);
|
||||
|
||||
}
|
||||
|
@ -20,22 +20,26 @@ import com.wechat.ferry.entity.proto.Wcf;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpDatabaseSqlReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpDatabaseTableReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpGroupMemberReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendCardMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpPatOnePatMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendEmojiMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendFileMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendImageMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendRichTextMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendTextMsgReq;
|
||||
import com.wechat.ferry.entity.vo.request.WxPpSendXmlMsgReq;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpContactsResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpDatabaseFieldResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpLoginInfoResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendFileMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendImageMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendPatOnePatMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendRichTextMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendTextMsgResp;
|
||||
import com.wechat.ferry.entity.vo.response.WxPpSendXmlMsgResp;
|
||||
import com.wechat.ferry.enums.SexEnum;
|
||||
import com.wechat.ferry.enums.WxContactsTypeEnum;
|
||||
import com.wechat.ferry.handle.WeChatSocketClient;
|
||||
@ -135,18 +139,59 @@ public class WeChatDllServiceImpl implements WeChatDllService {
|
||||
vo.setSex(SexEnum.getCodeMap(String.valueOf(rpcContact.getGender())).getCode());
|
||||
vo.setSexLabel(SexEnum.getCodeMap(String.valueOf(rpcContact.getGender())).getName());
|
||||
}
|
||||
// 是否为企业微信
|
||||
// 微信类型
|
||||
if (!ObjectUtils.isEmpty(rpcContact.getWxid())) {
|
||||
List<String> mixedNoList = new ArrayList<>();
|
||||
// 朋友推荐消息
|
||||
mixedNoList.add("fmessage");
|
||||
// 语音记事本
|
||||
mixedNoList.add("medianote");
|
||||
// 漂流瓶
|
||||
mixedNoList.add("floatbottle");
|
||||
// 文件传输助手
|
||||
mixedNoList.add("filehelper");
|
||||
// 新闻
|
||||
mixedNoList.add("newsapp");
|
||||
// 微信公众平台 weixingongzhong
|
||||
mixedNoList.add("weixinguanhaozhushou");
|
||||
// 微信团队
|
||||
mixedNoList.add("weixin");
|
||||
// 微信支付 wxzhifu
|
||||
mixedNoList.add("gh_3dfda90e39d6");
|
||||
// 微信公开课 wx-gongkaike
|
||||
mixedNoList.add("gh_c46cbbfa1de9");
|
||||
// 微信公开课 wx-gongkaike
|
||||
mixedNoList.add("gh_c46cbbfa1de9");
|
||||
// 微信运动 WeRun-WeChat
|
||||
mixedNoList.add("gh_43f2581f6fd6");
|
||||
// 微信游戏 game
|
||||
mixedNoList.add("gh_25d9ac85a4bc");
|
||||
// 微信游戏 game
|
||||
mixedNoList.add("gh_25d9ac85a4bc");
|
||||
// 微信开发者
|
||||
mixedNoList.add("gh_56fc3b00cc4f");
|
||||
// 微信搜一搜 wechat_search
|
||||
mixedNoList.add("gh_f08f54ae25a4");
|
||||
// 微信搜一搜 wechat_search
|
||||
mixedNoList.add("gh_f08f54ae25a4");
|
||||
if (rpcContact.getWxid().endsWith(WxContactsTypeEnum.WORK.getAffix())) {
|
||||
// 企微
|
||||
vo.setType(WxContactsTypeEnum.WORK.getCode());
|
||||
vo.setTypeLabel(WxContactsTypeEnum.WORK.getName());
|
||||
} else if (rpcContact.getWxid().endsWith(WxContactsTypeEnum.GROUP.getAffix())) {
|
||||
// 群聊
|
||||
vo.setType(WxContactsTypeEnum.GROUP.getCode());
|
||||
vo.setTypeLabel(WxContactsTypeEnum.GROUP.getName());
|
||||
} else if (mixedNoList.contains(rpcContact.getWxid())) {
|
||||
// 官方杂号
|
||||
vo.setType(WxContactsTypeEnum.OFFICIAL_MIXED_NO.getCode());
|
||||
vo.setTypeLabel(WxContactsTypeEnum.OFFICIAL_MIXED_NO.getName());
|
||||
} else if (rpcContact.getWxid().startsWith(WxContactsTypeEnum.OFFICIAL_ACCOUNT.getAffix())) {
|
||||
// 微信公众号
|
||||
vo.setType(WxContactsTypeEnum.OFFICIAL_ACCOUNT.getCode());
|
||||
vo.setTypeLabel(WxContactsTypeEnum.OFFICIAL_ACCOUNT.getName());
|
||||
} else {
|
||||
// 个微
|
||||
vo.setType(WxContactsTypeEnum.PERSON.getCode());
|
||||
vo.setTypeLabel(WxContactsTypeEnum.PERSON.getName());
|
||||
}
|
||||
@ -293,6 +338,7 @@ public class WeChatDllServiceImpl implements WeChatDllService {
|
||||
atUser = String.join(",", request.getAtUsers());
|
||||
}
|
||||
}
|
||||
// 0 为成功,其他失败
|
||||
int state = wechatSocketClient.sendText(request.getMsgText(), request.getRecipient(), atUser);
|
||||
log.info("[发送消息]-[文本消息]-处理结束");
|
||||
return null;
|
||||
@ -301,25 +347,43 @@ public class WeChatDllServiceImpl implements WeChatDllService {
|
||||
@Override
|
||||
public WxPpSendImageMsgResp sendImageMsg(WxPpSendImageMsgReq request) {
|
||||
WxPpSendImageMsgResp resp = new WxPpSendImageMsgResp();
|
||||
int state = wechatSocketClient.sendImage(request.getPath(), request.getRecipient());
|
||||
int state = wechatSocketClient.sendImage(request.getResourcePath(), request.getRecipient());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxPpSendFileMsgResp sendFileMsg(WxPpSendFileMsgReq request) {
|
||||
int state = wechatSocketClient.sendFile(request.getPath(), request.getRecipient());
|
||||
int state = wechatSocketClient.sendFile(request.getResourcePath(), request.getRecipient());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxPpSendCardMsgResp sendCardMsg(WxPpSendCardMsgReq request) {
|
||||
int state = wechatSocketClient.sendXml(request.getRecipient(), request.getXml(), request.getPath(), request.getType());
|
||||
public WxPpSendXmlMsgResp sendXmlMsg(WxPpSendXmlMsgReq request) {
|
||||
int state = wechatSocketClient.sendXml(request.getRecipient(), request.getXmlContent(), request.getResourcePath(), request.getXmlType());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxPpSendEmojiMsgResp sendEmojiMsg(WxPpSendEmojiMsgReq request) {
|
||||
int state = wechatSocketClient.sendEmotion(request.getPath(), request.getRecipient());
|
||||
int state = wechatSocketClient.sendEmotion(request.getResourcePath(), request.getRecipient());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxPpSendRichTextMsgResp sendRichTextMsg(WxPpSendRichTextMsgReq request) {
|
||||
Wcf.RichText richTextMsg = Wcf.RichText.newBuilder().setName(request.getName()).setAccount(request.getAccount()).setTitle(request.getTitle())
|
||||
.setDigest(request.getDigest()).setUrl(request.getJumpUrl()).setThumburl(request.getThumbnailUrl()).setReceiver(request.getRecipient())
|
||||
.build();
|
||||
Wcf.Request wcfReq = Wcf.Request.newBuilder().setFuncValue(Wcf.Functions.FUNC_SEND_RICH_TXT_VALUE).setRt(richTextMsg).build();
|
||||
Wcf.Response rsp = wechatSocketClient.sendCmd(wcfReq);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxPpSendPatOnePatMsgResp patOnePat(WxPpPatOnePatMsgReq request) {
|
||||
Wcf.PatMsg patMsg = Wcf.PatMsg.newBuilder().setRoomid(request.getRecipient()).setWxid(request.getPatUser()).build();
|
||||
Wcf.Request wcfReq = Wcf.Request.newBuilder().setFuncValue(Wcf.Functions.FUNC_SEND_PAT_MSG_VALUE).setPm(patMsg).build();
|
||||
Wcf.Response rsp = wechatSocketClient.sendCmd(wcfReq);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@ -13,8 +12,6 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.wechat.ferry.config.WeChatFerryProperties;
|
||||
import com.wechat.ferry.entity.dto.WxPpMsgDTO;
|
||||
import com.wechat.ferry.service.WeChatDllService;
|
||||
import com.wechat.ferry.service.WeChatExtService;
|
||||
import com.wechat.ferry.service.WeChatMsgService;
|
||||
import com.wechat.ferry.utils.HttpClientUtil;
|
||||
|
||||
@ -30,20 +27,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Service
|
||||
public class WeChatMsgServiceImpl implements WeChatMsgService {
|
||||
|
||||
private WeChatDllService weChatDllService;
|
||||
|
||||
@Autowired
|
||||
public void setWeChatDllService(WeChatDllService weChatDllService) {
|
||||
this.weChatDllService = weChatDllService;
|
||||
}
|
||||
|
||||
private WeChatExtService weChatExtService;
|
||||
|
||||
@Autowired
|
||||
public void setWeChatExtService(WeChatExtService weChatExtService) {
|
||||
this.weChatExtService = weChatExtService;
|
||||
}
|
||||
|
||||
@Resource
|
||||
private WeChatFerryProperties weChatFerryProperties;
|
||||
|
||||
@ -58,7 +41,6 @@ public class WeChatMsgServiceImpl implements WeChatMsgService {
|
||||
// 指定处理的群聊
|
||||
if (weChatFerryProperties.getOpenMsgGroups().contains(dto.getRoomId())) {
|
||||
// TODO 这里可以拓展自己需要的功能
|
||||
weChatExtService.instructSign(dto);
|
||||
}
|
||||
}
|
||||
log.debug("[收到消息]-[消息内容]-打印:{}", dto);
|
||||
|
Loading…
Reference in New Issue
Block a user