diff --git a/dy-java-applet/src/main/java/com/dyj/applet/DyAppletClient.java b/dy-java-applet/src/main/java/com/dyj/applet/DyAppletClient.java index a9f84f3..6428747 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/DyAppletClient.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/DyAppletClient.java @@ -3,8 +3,10 @@ package com.dyj.applet; import com.dyj.applet.domain.query.CreateQrCodeQuery; import com.dyj.applet.domain.query.GenerateSchemaQuery; import com.dyj.applet.domain.query.GenerateUrlLinkQuery; +import com.dyj.applet.domain.query.SendMsgQuery; import com.dyj.applet.domain.vo.*; import com.dyj.applet.handler.AppletTokenHandler; +import com.dyj.applet.handler.ChatMsgHandler; import com.dyj.applet.handler.LoginHandler; import com.dyj.applet.handler.SchemaHandler; import com.dyj.common.client.BaseClient; @@ -203,4 +205,61 @@ public class DyAppletClient extends BaseClient { public DySimpleResult createQrCode(CreateQrCodeQuery query) { return new SchemaHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).createQrCode(query); } -} + + /** + * 发送私信消息 + * + * @param query 入参 + * @return ChatMsgResponseVo + */ + public SendMsgResponseVo sendMessage(SendMsgQuery query) { + return new ChatMsgHandler(configuration().getAgentByTenantId(tenantId, clientKey)).sendMessage(query); + } + + /** + * 发送主动私信 + * + * @param query 入参 + * @return DySimpleResult + */ + public DySimpleResult authSendMsg(SendMsgQuery query) { + return new ChatMsgHandler(configuration().getAgentByTenantId(tenantId, clientKey)).authSendMsg(query); + } + + /** + * 查询主动私信用户授权状态 + * + * @param openId 用户ID + * @param cOpenId C端用户的open_id + * @param appId C端用户open_id所在的小程序 可不传 + * @return DySimpleResult + */ + public DySimpleResult queryImAuthStatus(String openId, String cOpenId, String appId) { + return new ChatMsgHandler(configuration().getAgentByTenantId(tenantId, clientKey)).queryImAuthStatus(openId, cOpenId, appId); + } + + /** + * 查询授权主动私信用户 + * + * @param openId 用户ID + * @param pageNum 页码 + * @param pageSize 每页数量 + * @return DySimpleResult + */ + public DySimpleResult queryAuthorizeUserList(String openId, Long pageNum, Long pageSize) { + return new ChatMsgHandler(configuration().getAgentByTenantId(tenantId, clientKey)).queryAuthorizeUserList(openId, pageNum, pageSize); + } + + /** + * 私信消息撤回 + * + * @param openId 用户ID + * @param msgId 消息ID + * @param conversationId 会话 ID:来源于私信 webhook,接收私信消息事件,对应 webhook 的 content 里的conversation_short_id 字段 + * @param conversationType 会话类型 1- 单聊 2- 群聊 + * @return DyResult + */ + public DyResult revokeMessage(String openId, String msgId, String conversationId, Integer conversationType) { + return new ChatMsgHandler(configuration().getAgentByTenantId(tenantId, clientKey)).revokeMessage(openId, msgId, conversationId, conversationType); + } +} \ No newline at end of file diff --git a/dy-java-applet/src/main/java/com/dyj/applet/client/BsClient.java b/dy-java-applet/src/main/java/com/dyj/applet/client/BsClient.java index 8c20a6a..12c26d9 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/client/BsClient.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/client/BsClient.java @@ -1,9 +1,9 @@ package com.dyj.applet.client; import com.dtflys.forest.annotation.BaseRequest; +import com.dtflys.forest.annotation.Header; import com.dtflys.forest.annotation.Post; import com.dtflys.forest.backend.ContentType; -import com.dyj.common.interceptor.BizTokenHeaderInterceptor; import com.dyj.common.domain.DyAppletResult; import java.util.List; @@ -18,6 +18,6 @@ public interface BsClient { /** * 经营能力当前状态查询 */ - @Post(value = "${businessScopes}", contentType = ContentType.APPLICATION_JSON ,interceptor = BizTokenHeaderInterceptor.class) - DyAppletResult> getBusinessScopes(); + @Post(value = "${businessScopes}", contentType = ContentType.APPLICATION_JSON) + DyAppletResult> getBusinessScopes(@Header("access-token") String accessToken); } diff --git a/dy-java-applet/src/main/java/com/dyj/applet/client/ChatMsgClient.java b/dy-java-applet/src/main/java/com/dyj/applet/client/ChatMsgClient.java index 6d64823..cd81d81 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/client/ChatMsgClient.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/client/ChatMsgClient.java @@ -1,7 +1,20 @@ package com.dyj.applet.client; import com.dtflys.forest.annotation.BaseRequest; +import com.dtflys.forest.annotation.JSONBody; +import com.dtflys.forest.annotation.Post; import com.dtflys.forest.backend.ContentType; +import com.dyj.applet.domain.query.ImAuthStatusQuery; +import com.dyj.applet.domain.query.ImAuthorizeUserListQuery; +import com.dyj.applet.domain.query.RevokeMsgQuery; +import com.dyj.applet.domain.query.SendMsgQuery; +import com.dyj.applet.domain.vo.AuthSendMsgVo; +import com.dyj.applet.domain.vo.ImAuthStatusVo; +import com.dyj.applet.domain.vo.ImAuthUserListVo; +import com.dyj.applet.domain.vo.SendMsgResponseVo; +import com.dyj.common.domain.DyResult; +import com.dyj.common.domain.DySimpleResult; +import com.dyj.common.domain.vo.BaseVo; import com.dyj.common.interceptor.BizTokenHeaderInterceptor; /** @@ -13,5 +26,47 @@ import com.dyj.common.interceptor.BizTokenHeaderInterceptor; @BaseRequest(baseURL = "${domain}", contentType = ContentType.APPLICATION_JSON, interceptor = BizTokenHeaderInterceptor.class) public interface ChatMsgClient { + /** + * 发送私信消息 + * + * @param query 入参 + * @return ChatMsgResponseVo + */ + @Post(url = "${sendMessage}") + SendMsgResponseVo sendMessage(@JSONBody SendMsgQuery query); + /** + * 发送主动私信 + * @param query 入参 + * @return DySimpleResult + */ + @Post(url = "${authSendMsg}") + DySimpleResult authSendMsg(@JSONBody SendMsgQuery query); + + + /** + * 查询主动私信用户授权状态 + * @param query 入参 + * @return DySimpleResult + */ + @Post(url = "${imAuthStatus}") + DySimpleResult queryImAuthStatus(@JSONBody ImAuthStatusQuery query); + + /** + * 查询授权主动私信用户 + * + * @param query + * @return DyResult + */ + @Post(url = "${queryAuthorizeUserList}") + DySimpleResult queryAuthorizeUserList(@JSONBody ImAuthorizeUserListQuery query); + + /** + * 私信消息撤回 + * + * @param query 包含消息查询条件的对象,用于指定要撤销的消息。 + * @return 返回一个动态结果对象,其中包含操作的结果信息。 + */ + @Post(url = "${revokeMessage}") + DyResult revokeMessage(@JSONBody RevokeMsgQuery query); } diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/AuthAttribution.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/AuthAttribution.java new file mode 100644 index 0000000..81b9c52 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/AuthAttribution.java @@ -0,0 +1,95 @@ +package com.dyj.applet.domain; + +/** + * 授权归因,不同的授权来源对应不同的归因字段 + * @author danmo + * @date 2024-04-08 17:23 + **/ +public class AuthAttribution { + + /** + * 主播id + */ + private String anchor_id; + /** + * 作者id + */ + private String author_id; + /** + * 群聊id + */ + private String conversation_id; + /** + * 消息发送者id + */ + private String from_att_uid; + /** + * 群id + */ + private String group_id; + /** + * 消息id + */ + private String message_id; + /** + * 直播房间id + */ + private String room_id; + + + public String getAnchor_id() { + return anchor_id; + } + + public void setAnchor_id(String anchor_id) { + this.anchor_id = anchor_id; + } + + public String getAuthor_id() { + return author_id; + } + + public void setAuthor_id(String author_id) { + this.author_id = author_id; + } + + public String getConversation_id() { + return conversation_id; + } + + public void setConversation_id(String conversation_id) { + this.conversation_id = conversation_id; + } + + public String getFrom_att_uid() { + return from_att_uid; + } + + public void setFrom_att_uid(String from_att_uid) { + this.from_att_uid = from_att_uid; + } + + public String getGroup_id() { + return group_id; + } + + public void setGroup_id(String group_id) { + this.group_id = group_id; + } + + public String getMessage_id() { + return message_id; + } + + public void setMessage_id(String message_id) { + this.message_id = message_id; + } + + public String getRoom_id() { + return room_id; + } + + public void setRoom_id(String room_id) { + this.room_id = room_id; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/ColorRGB.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/ColorRGB.java index 682935f..9d2d922 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/domain/ColorRGB.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/ColorRGB.java @@ -35,4 +35,40 @@ public class ColorRGB { public void setB(Integer b) { this.b = b; } + + public static ColorRGBBuilder builder() { + return new ColorRGBBuilder(); + } + + public static class ColorRGBBuilder { + private Integer r; + private Integer g; + private Integer b; + + public ColorRGBBuilder r + (Integer r) { + this.r = r; + return this; + } + + public ColorRGBBuilder g + (Integer g) { + this.g = g; + return this; + } + + public ColorRGBBuilder b + (Integer b) { + this.b = b; + return this; + } + + public ColorRGB build() { + ColorRGB colorRGB = new ColorRGB(); + colorRGB.setR(r); + colorRGB.setG(g); + colorRGB.setB(b); + return colorRGB; + } + } } diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/ImAuthUser.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/ImAuthUser.java new file mode 100644 index 0000000..31a3068 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/ImAuthUser.java @@ -0,0 +1,106 @@ +package com.dyj.applet.domain; + +/** + * @author danmo + * @date 2024-04-08 17:20 + **/ +public class ImAuthUser { + + /** + * 授权来源 + * micro_app 小程序 + * button组件 + * im_card 服务私信授权卡片 + * action_bar 会话页快捷入口 + * live_shelf_panel 直播间货架入口 + * micro_app_pendant 小程序内免研悬浮组件 + * mp_follow_account 小程序内关注后拉起主动私信授权 + */ + private String enter_from; + + /** + * C 端用户授权来源小程序 + */ + private String auth_user_source_app_id; + + /** + * 开发者在主动私信授权组件中自定义参数 + */ + private String data_im_extra; + + /** + * 用户在获取用户私信授权组件授权服务账号所在小程序当前页面的path参数 + */ + private String path; + + /** + * 用户在获取用户私信授权组件中授权服务账号所在小程序当前页面的query参数 + */ + private String query; + + /** + * 使用调用应用加密的 open_id + */ + private String target_open_id; + + /** + * 授权归因,不同的授权来源对应不同的归因字段 + */ + private AuthAttribution attribution; + + public String getEnter_from() { + return enter_from; + } + + public void setEnter_from(String enter_from) { + this.enter_from = enter_from; + } + + public String getAuth_user_source_app_id() { + return auth_user_source_app_id; + } + + public void setAuth_user_source_app_id(String auth_user_source_app_id) { + this.auth_user_source_app_id = auth_user_source_app_id; + } + + public String getData_im_extra() { + return data_im_extra; + } + + public void setData_im_extra(String data_im_extra) { + this.data_im_extra = data_im_extra; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public String getTarget_open_id() { + return target_open_id; + } + + public void setTarget_open_id(String target_open_id) { + this.target_open_id = target_open_id; + } + + public AuthAttribution getAttribution() { + return attribution; + } + + public void setAttribution(AuthAttribution attribution) { + this.attribution = attribution; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/CreateQrCodeQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/CreateQrCodeQuery.java index 0d91f11..c5d1751 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/CreateQrCodeQuery.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/CreateQrCodeQuery.java @@ -21,4 +21,136 @@ public class CreateQrCodeQuery extends BaseQuery { private ColorRGB line_color; private ColorRGB background; + + public String getApp_id() { + return app_id; + } + + public void setApp_id(String app_id) { + this.app_id = app_id; + } + + public String getApp_name() { + return app_name; + } + + public void setApp_name(String app_name) { + this.app_name = app_name; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public Integer getWidth() { + return width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + public Boolean getSet_icon() { + return set_icon; + } + + public void setSet_icon(Boolean set_icon) { + this.set_icon = set_icon; + } + + public ColorRGB getLine_color() { + return line_color; + } + + public void setLine_color(ColorRGB line_color) { + this.line_color = line_color; + } + + public ColorRGB getBackground() { + return background; + } + + public void setBackground(ColorRGB background) { + this.background = background; + } + + public static CreateQrCodeQueryBuilder builder() { + return new CreateQrCodeQueryBuilder(); + } + + public static class CreateQrCodeQueryBuilder { + private String appId; + private String appName; + private String path; + private Integer width; + private Boolean setIcon; + private ColorRGB lineColor; + private ColorRGB background; + + private Integer tenantId; + private String clientKey; + + public CreateQrCodeQueryBuilder appId(String appId) { + this.appId = appId; + return this; + } + + public CreateQrCodeQueryBuilder appName(String appName) { + this.appName = appName; + return this; + } + + public CreateQrCodeQueryBuilder path(String path) { + this.path = path; + return this; + } + + public CreateQrCodeQueryBuilder width(Integer width) { + this.width = width; + return this; + } + + public CreateQrCodeQueryBuilder setIcon(Boolean setIcon) { + this.setIcon = setIcon; + return this; + } + + public CreateQrCodeQueryBuilder lineColor(ColorRGB lineColor) { + this.lineColor = lineColor; + return this; + } + + public CreateQrCodeQueryBuilder background(ColorRGB background) { + this.background = background; + return this; + } + + public CreateQrCodeQueryBuilder tenantId(Integer tenantId) { + this.tenantId = tenantId; + return this; + } + + public CreateQrCodeQueryBuilder clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } + + public CreateQrCodeQuery build() { + CreateQrCodeQuery createQrCodeQuery = new CreateQrCodeQuery(); + createQrCodeQuery.setApp_id(appId); + createQrCodeQuery.setApp_name(appName); + createQrCodeQuery.setPath(path); + createQrCodeQuery.setWidth(width); + createQrCodeQuery.setSet_icon(setIcon); + createQrCodeQuery.setLine_color(lineColor); + createQrCodeQuery.setBackground(background); + createQrCodeQuery.setTenantId(tenantId); + createQrCodeQuery.setClientKey(clientKey); + return createQrCodeQuery; + } + } } diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ImAuthStatusQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ImAuthStatusQuery.java new file mode 100644 index 0000000..6acbac6 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ImAuthStatusQuery.java @@ -0,0 +1,83 @@ +package com.dyj.applet.domain.query; + +import com.dyj.common.domain.query.UserInfoQuery; + +/** + * @author danmo + * @date 2024-04-18 13:35 + **/ +public class ImAuthStatusQuery extends UserInfoQuery { + + /** + * C端用户的open_id + */ + private String c_open_id; + + /** + * C端用户open_id所在的小程序 + */ + private String app_id; + + public String getC_open_id() { + return c_open_id; + } + + public void setC_open_id(String c_open_id) { + this.c_open_id = c_open_id; + } + + public String getApp_id() { + return app_id; + } + + public void setApp_id(String app_id) { + this.app_id = app_id; + } + + public static ImAuthStatusQueryBuilder builder() { + return new ImAuthStatusQueryBuilder(); + } + + public static class ImAuthStatusQueryBuilder { + private String cOpenId; + private String appId; + private Integer tenantId; + private String clientKey; + private String openId; + + public ImAuthStatusQueryBuilder cOpenId(String cOpenId) { + this.cOpenId = cOpenId; + return this; + } + public ImAuthStatusQueryBuilder appId(String appId) { + this.appId = appId; + return this; + } + + public ImAuthStatusQueryBuilder tenantId(Integer tenantId) { + this.tenantId = tenantId; + return this; + } + + public ImAuthStatusQueryBuilder clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } + + public ImAuthStatusQueryBuilder openId(String openId) { + this.openId = openId; + return this; + } + + public ImAuthStatusQuery build() { + ImAuthStatusQuery imAuthStatusQuery = new ImAuthStatusQuery(); + imAuthStatusQuery.setC_open_id(cOpenId); + imAuthStatusQuery.setApp_id(appId); + imAuthStatusQuery.setTenantId(tenantId); + imAuthStatusQuery.setClientKey(clientKey); + imAuthStatusQuery.setOpen_id(openId); + return imAuthStatusQuery; + } + + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ImAuthorizeUserListQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ImAuthorizeUserListQuery.java new file mode 100644 index 0000000..da2857d --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ImAuthorizeUserListQuery.java @@ -0,0 +1,85 @@ +package com.dyj.applet.domain.query; + +import com.dyj.common.domain.query.UserInfoQuery; + +/** + * @author danmo + * @date 2024-04-08 17:16 + **/ +public class ImAuthorizeUserListQuery extends UserInfoQuery { + + private Long page_num; + + private Long page_size; + + + + public Long getPage_num() { + return page_num; + } + + public void setPage_num(Long page_num) { + this.page_num = page_num; + } + + public Long getPage_size() { + return page_size; + } + + public void setPage_size(Long page_size) { + this.page_size = page_size; + } + + public static AuthorizeUserListQueryBuilder builder() { + return new AuthorizeUserListQueryBuilder(); + } + + public static class AuthorizeUserListQueryBuilder { + private Long pageNum; + + private Long pageSize; + + private String openId; + + private String clientKey; + + private Integer tenantId; + + public AuthorizeUserListQueryBuilder pageNum(Long pageNum) { + this.pageNum = pageNum; + return this; + } + + public AuthorizeUserListQueryBuilder pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + public AuthorizeUserListQueryBuilder openId(String openId) { + this.openId = openId; + return this; + } + + public AuthorizeUserListQueryBuilder clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } + + public AuthorizeUserListQueryBuilder tenantId(Integer tenantId) { + this.tenantId = tenantId; + return this; + } + public ImAuthorizeUserListQuery build() { + ImAuthorizeUserListQuery authorizeUserListQuery = new ImAuthorizeUserListQuery(); + authorizeUserListQuery.setPage_num(pageNum); + authorizeUserListQuery.setPage_size(pageSize); + authorizeUserListQuery.setOpen_id(openId); + authorizeUserListQuery.setClientKey(clientKey); + authorizeUserListQuery.setTenantId(tenantId); + return authorizeUserListQuery; + } + } + + + +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/RevokeMsgQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/RevokeMsgQuery.java new file mode 100644 index 0000000..ffb5c1d --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/RevokeMsgQuery.java @@ -0,0 +1,101 @@ +package com.dyj.applet.domain.query; + +import com.dyj.common.domain.query.UserInfoQuery; + +/** + * @author danmo + * @date 2024-04-08 18:20 + **/ +public class RevokeMsgQuery extends UserInfoQuery { + + /** + * 会话 ID:来源于私信 webhook,接收私信消息事件,对应 webhook 的 content 里的conversation_short_id 字段 + */ + private String conversation_id; + + /** + * 会话类型 1- 单聊 2- 群聊 + */ + private Integer conversation_type; + + /** + * 消息 id:来源于私信 webhook 接收私信消息事件,对应 webhook 的 content 里的server_message_id 字段 + */ + private String msg_id; + + + public String getConversation_id() { + return conversation_id; + } + + public void setConversation_id(String conversation_id) { + this.conversation_id = conversation_id; + } + + public Integer getConversation_type() { + return conversation_type; + } + + public void setConversation_type(Integer conversation_type) { + this.conversation_type = conversation_type; + } + + public String getMsg_id() { + return msg_id; + } + + public void setMsg_id(String msg_id) { + this.msg_id = msg_id; + } + + public static RevokeMsgQueryBuilder builder() { + return new RevokeMsgQueryBuilder(); + } + + public static class RevokeMsgQueryBuilder { + private String conversationId; + private Integer conversationType; + private String msgId; + private String openId; + private Integer tenantId; + private String clientKey; + + public RevokeMsgQueryBuilder conversationId(String conversationId) { + this.conversationId = conversationId; + return this; + } + public RevokeMsgQueryBuilder conversationType(Integer conversationType) { + this.conversationType = conversationType; + return this; + } + public RevokeMsgQueryBuilder msgId(String msgId) { + this.msgId = msgId; + return this; + } + public RevokeMsgQueryBuilder openId(String openId) { + this.openId = openId; + return this; + } + public RevokeMsgQueryBuilder tenantId(Integer tenantId) { + this.tenantId = tenantId; + return this; + } + public RevokeMsgQueryBuilder clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } + + public RevokeMsgQuery build() { + RevokeMsgQuery revokeMsgQuery = new RevokeMsgQuery(); + revokeMsgQuery.setConversation_id(conversationId); + revokeMsgQuery.setConversation_type(conversationType); + revokeMsgQuery.setMsg_id(msgId); + revokeMsgQuery.setOpen_id(openId); + revokeMsgQuery.setTenantId(tenantId); + revokeMsgQuery.setClientKey(clientKey); + return revokeMsgQuery; + } +} + + +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/SendMsgQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/SendMsgQuery.java new file mode 100644 index 0000000..83eabf0 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/SendMsgQuery.java @@ -0,0 +1,185 @@ +package com.dyj.applet.domain.query; + +import com.dyj.common.domain.query.UserInfoQuery; + +import java.util.List; + +/** + * @author danmo + * @date 2024-04-08 13:37 + **/ +public class SendMsgQuery extends UserInfoQuery { + + /** + * 消息id,场景一、场景二必传 + * 场景一:来源于接收私信消息事件,对应 webhook 的 content 中 server_message_id 字段(有效期为24小时) + * 场景二:来源于接收用户进入私信会话页事件,对应 webhook 的 content 中 server_message_id 字段(有效期为24小时) + */ + private String msg_id; + + /** + * 会话 id,场景一、场景二必传 + * 场景一:来源于接收私信消息事件,对应webhook 的 content 里的 conversation_short_id 字段(长期有效) + * 场景二:来源于接收用户进入私信会话页事件,对应webhook 的 content 里的 conversation_short_id 字段(长期有效) + */ + private String conversation_id; + + /** + * 消息的接收方 open_id + */ + private String to_user_id; + + /** + * 消息体,场景一、场景二必传 + * 文本 content + * 图片 content + * 视频 content + * 留资卡片 content + * 小程序引导卡片 content + * 群邀请卡片 content + * 小程序券 content + * 主动私信卡片 content + */ + private T content; + + /** + * 私信场景 + * 场景一:默认场景,可选传入 im_replay_msg + * 场景二:用户主动进入私信会话页,必传 im_enter_direct_msg + * 场景三: B2B场景私信触达,必传 im_b2b_direct_message + * 场景四:主动私信持续触达,必传 im_authorize_message + */ + private String scene; + + /** + * 场景三, 场景四必传,最多支持三条消息 + * 场景三必须包含一条小程序卡片消息 + * 场景四必须包含一条小程序卡片/主动私信卡片/小程序券消息 + */ + private List content_list; + + public String getMsg_id() { + return msg_id; + } + + public void setMsg_id(String msg_id) { + this.msg_id = msg_id; + } + + public String getConversation_id() { + return conversation_id; + } + + public void setConversation_id(String conversation_id) { + this.conversation_id = conversation_id; + } + + public String getTo_user_id() { + return to_user_id; + } + + public void setTo_user_id(String to_user_id) { + this.to_user_id = to_user_id; + } + + public T getContent() { + return content; + } + + public void setContent(T content) { + this.content = content; + } + + public String getScene() { + return scene; + } + + public void setScene(String scene) { + this.scene = scene; + } + + public List getContent_list() { + return content_list; + } + + public void setContent_list(List content_list) { + this.content_list = content_list; + } + + public static SendMsgQueryBuilder builder() { + return new SendMsgQueryBuilder(); + } + public static class SendMsgQueryBuilder { + private String msgId; + private String conversationId; + private String toUserId; + private T content; + private String scene; + private List contentList; + + private Integer tenantId; + private String clientKey; + private String openId; + + public SendMsgQueryBuilder msgId(String msgId) { + this.msgId = msgId; + return this; + } + + public SendMsgQueryBuilder conversationId(String conversationId) { + this.conversationId = conversationId; + return this; + } + + public SendMsgQueryBuilder toUserId(String toUserId) { + this.toUserId = toUserId; + return this; + } + + public SendMsgQueryBuilder content(T content) { + this.content = content; + return this; + } + + public SendMsgQueryBuilder scene(String scene) { + this.scene = scene; + return this; + } + + public SendMsgQueryBuilder contentList(List contentList) { + this.contentList = contentList; + return this; + } + + public SendMsgQueryBuilder tenantId(Integer tenantId) { + this.tenantId = tenantId; + return this; + } + + public SendMsgQueryBuilder clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } + + public SendMsgQueryBuilder openId(String openId) { + this.openId = openId; + return this; + } + + + public SendMsgQuery build() { + SendMsgQuery sendMsgQuery = new SendMsgQuery(); + sendMsgQuery.setMsg_id(msgId); + sendMsgQuery.setConversation_id(conversationId); + sendMsgQuery.setTo_user_id(toUserId); + sendMsgQuery.setContent(content); + sendMsgQuery.setScene(scene); + sendMsgQuery.setContent_list(contentList); + sendMsgQuery.setTenantId(tenantId); + sendMsgQuery.setClientKey(clientKey); + sendMsgQuery.setOpen_id(openId); + return sendMsgQuery; + } + } + +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/AuthSendMsgVo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/AuthSendMsgVo.java new file mode 100644 index 0000000..a4b5fae --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/AuthSendMsgVo.java @@ -0,0 +1,18 @@ +package com.dyj.applet.domain.vo; + +/** + * @author danmo + * @date 2024-04-18 11:40 + **/ +public class AuthSendMsgVo { + + private String msg_id; + + public String getMsg_id() { + return msg_id; + } + + public void setMsg_id(String msg_id) { + this.msg_id = msg_id; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/ImAuthStatusVo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/ImAuthStatusVo.java new file mode 100644 index 0000000..852acd4 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/ImAuthStatusVo.java @@ -0,0 +1,97 @@ +package com.dyj.applet.domain.vo; + +import com.dyj.applet.domain.AuthAttribution; + +/** + * @author danmo + * @date 2024-04-18 13:39 + **/ +public class ImAuthStatusVo { + + /** + * 授权状态 + * 1 授权中 + * 2 未授权 + */ + private Integer status; + + /** + * 授权归因,不同的授权来源对应不同的归因字段 + */ + private AuthAttribution attribution; + + /** + * 在小程序跳转私信组件中开发者自定义参数 + */ + private String data_im_extra; + + /** + * 授权来源 + * micro_app 小程序 + * button组件 + * im_card 服务私信授权卡片 + * action_bar 会话页快捷入口 + * live_shelf_panel 直播间货架入口 + * micro_app_pendant 小程序内免研悬浮组件 + * mp_follow_account 小程序内关注后拉起主动私信授权 + */ + private String enter_from; + + /** + * 用户点击获取用户私信授权组件时所在小程序当前页面的path参数 + */ + private String path; + + /** + * 用户点击获取用户私信授权组件时所在小程序当前页面的query参数 + */ + private String query; + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public AuthAttribution getAttribution() { + return attribution; + } + + public void setAttribution(AuthAttribution attribution) { + this.attribution = attribution; + } + + public String getData_im_extra() { + return data_im_extra; + } + + public void setData_im_extra(String data_im_extra) { + this.data_im_extra = data_im_extra; + } + + public String getEnter_from() { + return enter_from; + } + + public void setEnter_from(String enter_from) { + this.enter_from = enter_from; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/ImAuthUserListVo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/ImAuthUserListVo.java new file mode 100644 index 0000000..ab6dcb6 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/ImAuthUserListVo.java @@ -0,0 +1,18 @@ +package com.dyj.applet.domain.vo; + +import com.dyj.applet.domain.ImAuthUser; +import com.dyj.common.domain.vo.BaseVo; + +import java.util.List; + +/** + * @author danmo + * @date 2024-04-08 17:18 + **/ +public class ImAuthUserListVo extends BaseVo { + + private List auth_user_list; + + + private Boolean has_more; +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/SendMsgResponseVo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/SendMsgResponseVo.java new file mode 100644 index 0000000..388b97e --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/SendMsgResponseVo.java @@ -0,0 +1,41 @@ +package com.dyj.applet.domain.vo; + +import com.dyj.common.domain.DyResult; +import com.dyj.common.domain.vo.BaseVo; + +import java.util.List; + +/** + * @author danmo + * @date 2024-04-09 10:20 + **/ +public class SendMsgResponseVo extends DyResult { + + /** + * 消息ID + */ + public String msg_id; + + /** + * 消息ID列表 + */ + public List msg_list; + + + public String getMsg_id() { + return msg_id; + } + + public void setMsg_id(String msg_id) { + this.msg_id = msg_id; + } + + public List getMsg_list() { + return msg_list; + } + + public void setMsg_list(List msg_list) { + this.msg_list = msg_list; + } + +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/handler/AbstractAppletHandler.java b/dy-java-applet/src/main/java/com/dyj/applet/handler/AbstractAppletHandler.java index d5ce871..b6bdcc8 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/handler/AbstractAppletHandler.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/handler/AbstractAppletHandler.java @@ -1,10 +1,12 @@ package com.dyj.applet.handler; +import com.dyj.applet.client.ChatMsgClient; import com.dyj.applet.client.LoginClient; import com.dyj.applet.client.SchemaClient; import com.dyj.common.client.AuthClient; import com.dyj.common.config.AgentConfiguration; import com.dyj.common.domain.query.BaseQuery; +import com.dyj.common.domain.query.UserInfoQuery; import com.dyj.spring.utils.SpringUtils; import java.util.Objects; @@ -33,6 +35,12 @@ public abstract class AbstractAppletHandler { return SpringUtils.getBean(SchemaClient.class); } + protected ChatMsgClient getChatMsgClient() { + return SpringUtils.getBean(ChatMsgClient.class); + } + + + protected BaseQuery baseQuery(){ return baseQuery(null); } @@ -45,4 +53,23 @@ public abstract class AbstractAppletHandler { query.setClientKey(agentConfiguration.getClientKey()); return query; } + + protected UserInfoQuery userInfoQuery(){ + return userInfoQuery(new UserInfoQuery()); + } + + protected UserInfoQuery userInfoQuery(String openId){ + UserInfoQuery query = new UserInfoQuery(); + query.setOpen_id(openId); + return userInfoQuery(query); + } + + protected UserInfoQuery userInfoQuery(UserInfoQuery query){ + if(Objects.isNull(query)){ + query = new UserInfoQuery(); + } + query.setTenantId(agentConfiguration.getTenantId()); + query.setClientKey(agentConfiguration.getClientKey()); + return query; + } } diff --git a/dy-java-applet/src/main/java/com/dyj/applet/handler/AppletTokenHandler.java b/dy-java-applet/src/main/java/com/dyj/applet/handler/AppletTokenHandler.java index 853fef2..ffb2db4 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/handler/AppletTokenHandler.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/handler/AppletTokenHandler.java @@ -59,7 +59,11 @@ public class AppletTokenHandler extends AbstractAppletHandler { * @return DyAppletResult */ public DyAppletResult getBizToken(String openId, String scope) { - return getAuthClient().getBizToken(BizTokenQuery.builder().clientKey(agentConfiguration.getClientKey()).clientSecret(agentConfiguration.getClientSecret()).openId(openId).scope(scope).build()); + DyAppletResult dyAppletResult = getAuthClient().getBizToken(BizTokenQuery.builder().clientKey(agentConfiguration.getClientKey()).clientSecret(agentConfiguration.getClientSecret()).openId(openId).scope(scope).build()); + if (Objects.nonNull(dyAppletResult) && dyAppletResult.getError_code() == 0) { + DyConfigUtils.getAgentTokenService().setBizToken(agentConfiguration.getTenantId(), agentConfiguration.getClientKey(), dyAppletResult.getData().getBiz_token(), dyAppletResult.getData().getBiz_expires_in(), dyAppletResult.getData().getBiz_refresh_token(), dyAppletResult.getData().getBiz_refresh_expires_in(), openId); + } + return dyAppletResult; } /** diff --git a/dy-java-applet/src/main/java/com/dyj/applet/handler/ChatMsgHandler.java b/dy-java-applet/src/main/java/com/dyj/applet/handler/ChatMsgHandler.java new file mode 100644 index 0000000..74dfe65 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/handler/ChatMsgHandler.java @@ -0,0 +1,93 @@ +package com.dyj.applet.handler; + +import com.dyj.applet.domain.query.ImAuthStatusQuery; +import com.dyj.applet.domain.query.ImAuthorizeUserListQuery; +import com.dyj.applet.domain.query.RevokeMsgQuery; +import com.dyj.applet.domain.query.SendMsgQuery; +import com.dyj.applet.domain.vo.AuthSendMsgVo; +import com.dyj.applet.domain.vo.ImAuthStatusVo; +import com.dyj.applet.domain.vo.ImAuthUserListVo; +import com.dyj.applet.domain.vo.SendMsgResponseVo; +import com.dyj.common.config.AgentConfiguration; +import com.dyj.common.domain.DyResult; +import com.dyj.common.domain.DySimpleResult; +import com.dyj.common.domain.vo.BaseVo; + +/** + * @author danmo + * @date 2024-04-18 13:48 + **/ +public class ChatMsgHandler extends AbstractAppletHandler { + + public ChatMsgHandler(AgentConfiguration agentConfiguration) { + super(agentConfiguration); + } + + /** + * 发送私信消息 + * + * @param query 入参 + * @return ChatMsgResponseVo + */ + public SendMsgResponseVo sendMessage(SendMsgQuery query) { + query.setTenantId(agentConfiguration.getTenantId()); + query.setClientKey(agentConfiguration.getClientKey()); + return getChatMsgClient().sendMessage(query); + } + + /** + * 发送主动私信 + * + * @param query 入参 + * @return DySimpleResult + */ + public DySimpleResult authSendMsg(SendMsgQuery query) { + query.setTenantId(agentConfiguration.getTenantId()); + query.setClientKey(agentConfiguration.getClientKey()); + return getChatMsgClient().authSendMsg(query); + } + + /** + * 查询主动私信用户授权状态 + * + * @param openId 用户ID + * @param cOpenId C端用户的open_id + * @param appId C端用户open_id所在的小程序 可不传 + * @return DySimpleResult + */ + public DySimpleResult queryImAuthStatus(String openId, String cOpenId, String appId) { + ImAuthStatusQuery query = ImAuthStatusQuery.builder().openId(openId).cOpenId(cOpenId).appId(appId) + .clientKey(agentConfiguration.getClientKey()).tenantId(agentConfiguration.getTenantId()).build(); + return getChatMsgClient().queryImAuthStatus(query); + } + + /** + * 查询授权主动私信用户 + * + * @param openId 用户ID + * @param pageNum 页码 + * @param pageSize 每页数量 + * @return DySimpleResult + */ + public DySimpleResult queryAuthorizeUserList(String openId, Long pageNum, Long pageSize) { + return getChatMsgClient().queryAuthorizeUserList(ImAuthorizeUserListQuery.builder() + .openId(openId).pageNum(pageNum).pageSize(pageSize) + .clientKey(agentConfiguration.getClientKey()).tenantId(agentConfiguration.getTenantId()).build()); + } + + /** + * 私信消息撤回 + * + * @param openId 用户ID + * @param msgId 消息ID + * @param conversationId 会话 ID:来源于私信 webhook,接收私信消息事件,对应 webhook 的 content 里的conversation_short_id 字段 + * @param conversationType 会话类型 1- 单聊 2- 群聊 + * @return DyResult + */ + public DyResult revokeMessage(String openId, String msgId, String conversationId, Integer conversationType) { + return getChatMsgClient().revokeMessage(RevokeMsgQuery.builder() + .openId(openId).msgId(msgId).conversationId(conversationId).conversationType(conversationType) + .clientKey(agentConfiguration.getClientKey()).tenantId(agentConfiguration.getTenantId()) + .build()); + } +} diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/AppletCardMsg.java b/dy-java-common/src/main/java/com/dyj/common/domain/AppletCardMsg.java similarity index 98% rename from dy-java-web/src/main/java/com/dyj/web/domain/AppletCardMsg.java rename to dy-java-common/src/main/java/com/dyj/common/domain/AppletCardMsg.java index 79f303d..13ef4a9 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/AppletCardMsg.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/AppletCardMsg.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/AppletCouponMsg.java b/dy-java-common/src/main/java/com/dyj/common/domain/AppletCouponMsg.java similarity index 98% rename from dy-java-web/src/main/java/com/dyj/web/domain/AppletCouponMsg.java rename to dy-java-common/src/main/java/com/dyj/common/domain/AppletCouponMsg.java index 33decf6..a163342 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/AppletCouponMsg.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/AppletCouponMsg.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/AuthPrivateMessageCardMsg.java b/dy-java-common/src/main/java/com/dyj/common/domain/AuthPrivateMessageCardMsg.java similarity index 99% rename from dy-java-web/src/main/java/com/dyj/web/domain/AuthPrivateMessageCardMsg.java rename to dy-java-common/src/main/java/com/dyj/common/domain/AuthPrivateMessageCardMsg.java index 8fcf3f6..ff3237d 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/AuthPrivateMessageCardMsg.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/AuthPrivateMessageCardMsg.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/CardMsg.java b/dy-java-common/src/main/java/com/dyj/common/domain/CardMsg.java similarity index 97% rename from dy-java-web/src/main/java/com/dyj/web/domain/CardMsg.java rename to dy-java-common/src/main/java/com/dyj/common/domain/CardMsg.java index cedb34e..a7c203d 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/CardMsg.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/CardMsg.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/ImageMsg.java b/dy-java-common/src/main/java/com/dyj/common/domain/ImageMsg.java similarity index 97% rename from dy-java-web/src/main/java/com/dyj/web/domain/ImageMsg.java rename to dy-java-common/src/main/java/com/dyj/common/domain/ImageMsg.java index 0d10ea6..8fe07b9 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/ImageMsg.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/ImageMsg.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/InvitationMsg.java b/dy-java-common/src/main/java/com/dyj/common/domain/InvitationMsg.java similarity index 98% rename from dy-java-web/src/main/java/com/dyj/web/domain/InvitationMsg.java rename to dy-java-common/src/main/java/com/dyj/common/domain/InvitationMsg.java index 16e9521..645a839 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/InvitationMsg.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/InvitationMsg.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/MsgContent.java b/dy-java-common/src/main/java/com/dyj/common/domain/MsgContent.java similarity index 91% rename from dy-java-web/src/main/java/com/dyj/web/domain/MsgContent.java rename to dy-java-common/src/main/java/com/dyj/common/domain/MsgContent.java index 0e46acc..5770c70 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/MsgContent.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/MsgContent.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/TextMsg.java b/dy-java-common/src/main/java/com/dyj/common/domain/TextMsg.java similarity index 97% rename from dy-java-web/src/main/java/com/dyj/web/domain/TextMsg.java rename to dy-java-common/src/main/java/com/dyj/common/domain/TextMsg.java index e17f0b5..25bda35 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/TextMsg.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/TextMsg.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/VideoMsg.java b/dy-java-common/src/main/java/com/dyj/common/domain/VideoMsg.java similarity index 97% rename from dy-java-web/src/main/java/com/dyj/web/domain/VideoMsg.java rename to dy-java-common/src/main/java/com/dyj/common/domain/VideoMsg.java index 5a3157c..5163107 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/VideoMsg.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/VideoMsg.java @@ -1,4 +1,4 @@ -package com.dyj.web.domain; +package com.dyj.common.domain; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.MediaTypeEnum; diff --git a/dy-java-common/src/main/java/com/dyj/common/domain/vo/DataAndExtraBodyVo.java b/dy-java-common/src/main/java/com/dyj/common/domain/vo/DataAndExtraBodyVo.java new file mode 100644 index 0000000..e798004 --- /dev/null +++ b/dy-java-common/src/main/java/com/dyj/common/domain/vo/DataAndExtraBodyVo.java @@ -0,0 +1,27 @@ +package com.dyj.common.domain.vo; + +import com.dyj.common.domain.DyExtra; + +public class DataAndExtraBodyVo { + private T data; + + private DyExtra extra_body; + + public T getData() { + return data; + } + + public DataAndExtraBodyVo setData(T data) { + this.data = data; + return this; + } + + public DyExtra getExtra_body() { + return extra_body; + } + + public DataAndExtraBodyVo setExtra_body(DyExtra extra_body) { + this.extra_body = extra_body; + return this; + } +} diff --git a/dy-java-common/src/main/java/com/dyj/common/enums/DyAppletUrlPathEnum.java b/dy-java-common/src/main/java/com/dyj/common/enums/DyAppletUrlPathEnum.java index 4327bc4..9d02411 100644 --- a/dy-java-common/src/main/java/com/dyj/common/enums/DyAppletUrlPathEnum.java +++ b/dy-java-common/src/main/java/com/dyj/common/enums/DyAppletUrlPathEnum.java @@ -32,7 +32,11 @@ public enum DyAppletUrlPathEnum { //生成QRCodeV2 CREATE_QR_CODE("createQrCode", "/api/apps/v1/qrcode/create/"), + //发送主动私信 + AUTHORIZE_SEND_MSG("authSendMsg","/im/authorize/send/msg/"), + //查询主动私信用户授权状态 + IM_AUTHORIZE_STATUS("imAuthStatus","/im/authorize/status/"), ; diff --git a/dy-java-common/src/main/java/com/dyj/common/enums/DyWebUrlPathEnum.java b/dy-java-common/src/main/java/com/dyj/common/enums/DyWebUrlPathEnum.java index 7d4f6e2..7a2e7f1 100644 --- a/dy-java-common/src/main/java/com/dyj/common/enums/DyWebUrlPathEnum.java +++ b/dy-java-common/src/main/java/com/dyj/common/enums/DyWebUrlPathEnum.java @@ -466,6 +466,23 @@ public enum DyWebUrlPathEnum { */ HOT_VIDEO_LIST("hotVideoList", "/hotsearch/videos/"), + /** + * 获取抖音星图达人热榜 + */ + STAR_HOTLIST("starHotlist", "/star/hot_list/"), + + /** + * 获取抖音星图达人指数 + */ + STAR_AUTHOR_SCORE("starAuthorScore", "/star/author_score/"), + + + /** + * 获取抖音星图达人指数数据V2 + */ + STAR_AUTHOR_SCORE_V2("starAuthorScoreV2", "/star/author_score_v2/"), + + ; diff --git a/dy-java-common/src/main/java/com/dyj/common/interceptor/BizTokenHeaderInterceptor.java b/dy-java-common/src/main/java/com/dyj/common/interceptor/BizTokenHeaderInterceptor.java index ec3966b..fdd4803 100644 --- a/dy-java-common/src/main/java/com/dyj/common/interceptor/BizTokenHeaderInterceptor.java +++ b/dy-java-common/src/main/java/com/dyj/common/interceptor/BizTokenHeaderInterceptor.java @@ -20,7 +20,6 @@ import java.util.Objects; **/ public class BizTokenHeaderInterceptor implements Interceptor { - @Override public boolean beforeExecute(ForestRequest request) { Integer tenantId = null; @@ -44,6 +43,7 @@ public class BizTokenHeaderInterceptor implements Interceptor { throw new RuntimeException("access-token is null"); } request.addHeader("access-token", bizToken.getBiz_token()); + request.replaceOrAddQuery("open_id", openId); return true; } diff --git a/dy-java-common/src/main/java/com/dyj/common/service/IAgentTokenService.java b/dy-java-common/src/main/java/com/dyj/common/service/IAgentTokenService.java index 2491fd1..283456d 100644 --- a/dy-java-common/src/main/java/com/dyj/common/service/IAgentTokenService.java +++ b/dy-java-common/src/main/java/com/dyj/common/service/IAgentTokenService.java @@ -19,7 +19,7 @@ public interface IAgentTokenService { BizTokenVo getBizToken(Integer tenantId, String clientKey, String openId); - void setBizToken(Integer tenantId, String clientKey, String bizToken, Long bizExpiresIn, String bizRefreshToken, Long bizRefreshExpiresIn); + void setBizToken(Integer tenantId, String clientKey, String bizToken, Long bizExpiresIn, String bizRefreshToken, Long bizRefreshExpiresIn, String openId); //String getOpenId() throws OpenIdIsNullException; } diff --git a/dy-java-common/src/main/java/com/dyj/common/service/impl/CacheAgentTokenServiceImpl.java b/dy-java-common/src/main/java/com/dyj/common/service/impl/CacheAgentTokenServiceImpl.java index 2205b4a..fb5a1c6 100644 --- a/dy-java-common/src/main/java/com/dyj/common/service/impl/CacheAgentTokenServiceImpl.java +++ b/dy-java-common/src/main/java/com/dyj/common/service/impl/CacheAgentTokenServiceImpl.java @@ -59,9 +59,7 @@ public class CacheAgentTokenServiceImpl implements IAgentTokenService { } @Override - public void setBizToken(Integer tenantId, String clientKey, String bizToken, Long bizExpiresIn, String bizRefreshToken, Long bizRefreshExpiresIn) { + public void setBizToken(Integer tenantId, String clientKey, String bizToken, Long bizExpiresIn, String bizRefreshToken, Long bizRefreshExpiresIn, String openId) { } - - } diff --git a/dy-java-examples/dy-java-examples-springboot/src/main/java/com/dyj/examples/service/RedisAgentTokenService.java b/dy-java-examples/dy-java-examples-springboot/src/main/java/com/dyj/examples/service/RedisAgentTokenService.java index 13c8fd9..3ea2c7f 100644 --- a/dy-java-examples/dy-java-examples-springboot/src/main/java/com/dyj/examples/service/RedisAgentTokenService.java +++ b/dy-java-examples/dy-java-examples-springboot/src/main/java/com/dyj/examples/service/RedisAgentTokenService.java @@ -78,7 +78,7 @@ public class RedisAgentTokenService implements IAgentTokenService { } @Override - public void setBizToken(Integer tenantId, String clientKey, String bizToken, Long bizExpiresIn, String bizRefreshToken, Long bizRefreshExpiresIn) { + public void setBizToken(Integer tenantId, String clientKey, String bizToken, Long bizExpiresIn, String bizRefreshToken, Long bizRefreshExpiresIn, String openId) { } } diff --git a/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/ChatMsgTest.java b/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/ChatMsgTest.java index 6282b1c..ac613c7 100644 --- a/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/ChatMsgTest.java +++ b/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/ChatMsgTest.java @@ -4,7 +4,7 @@ package com.dyj.examples; import com.alibaba.fastjson.JSONArray; import com.dyj.common.domain.DyResult; import com.dyj.web.DyWebClient; -import com.dyj.web.domain.TextMsg; +import com.dyj.common.domain.TextMsg; import com.dyj.web.domain.query.AuthorizeUserListQuery; import com.dyj.web.domain.query.RevokeMsgQuery; import com.dyj.web.domain.query.SendMsgQuery; diff --git a/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/DataExternalTest.java b/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/DataExternalTest.java index 3637808..c56760a 100644 --- a/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/DataExternalTest.java +++ b/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/DataExternalTest.java @@ -264,4 +264,33 @@ public class DataExternalTest { System.out.println(JSON.toJSONString(webClient.hotVideoList(""))); } + /** + * 获取抖音星图达人热榜 + */ + @Test + public void starHotlist(){ + DyWebClient webClient = new DyWebClient(); + System.out.println(JSON.toJSONString(webClient.starHotlist(1L))); + } + + /** + * 获取抖音星图达人指数 + */ + @Test + public void starAuthorScore(){ + DyWebClient webClient = new DyWebClient(); + DyResult accessToken = webClient.accessToken(code); + System.out.println(JSON.toJSONString(accessToken)); + System.out.println(JSON.toJSONString(webClient.starAuthorScore(openId))); + } + + /** + * 获取抖音星图达人指数数据V2 + */ + @Test + public void starAuthorScoreV2(){ + DyWebClient webClient = new DyWebClient(); + System.out.println(JSON.toJSONString(webClient.starAuthorScoreV2(""))); + } + } diff --git a/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/GroupTest.java b/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/GroupTest.java index f1381ea..4c7dca9 100644 --- a/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/GroupTest.java +++ b/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/GroupTest.java @@ -4,7 +4,7 @@ package com.dyj.examples; import com.alibaba.fastjson.JSONObject; import com.dyj.common.enums.GroupSettingTypeEnum; import com.dyj.web.DyWebClient; -import com.dyj.web.domain.TextMsg; +import com.dyj.common.domain.TextMsg; import com.dyj.web.domain.query.*; import com.dyj.web.domain.vo.CreateFansGroupVo; import com.dyj.web.domain.vo.FansGroupSettingVo; diff --git a/dy-java-web/src/main/java/com/dyj/web/DyWebClient.java b/dy-java-web/src/main/java/com/dyj/web/DyWebClient.java index 1e90797..457b449 100644 --- a/dy-java-web/src/main/java/com/dyj/web/DyWebClient.java +++ b/dy-java-web/src/main/java/com/dyj/web/DyWebClient.java @@ -1114,4 +1114,31 @@ public class DyWebClient extends BaseClient { public DyResult hotVideoList(String hotSentence){ return new DataExternalHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId,clientKey)).hotVideoList(hotSentence); } + + /** + * 获取抖音星图达人热榜 + * @param hotListType 达人热榜类型 * `1` - 星图指数榜 * `2` - 涨粉指数榜 * `3` - 性价比指数榜 * `4` - 种草指数榜 * `5` - 精选指数榜 * `6` - 传播指数榜 选填 + * @return + */ + public DataAndExtraBodyVo starHotlist(Long hotListType){ + return new DataExternalHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId,clientKey)).starHotlist(hotListType); + } + + /** + * 获取抖音星图达人指数 + * @param openId 通过/oauth/access_token/获取,用户唯一标志 选填 + * @return + */ + public DataAndExtraBodyVo starAuthorScore(String openId){ + return new DataExternalHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId,clientKey)).starAuthorScore(openId); + } + + /** + * 获取抖音星图达人指数数据V2 + * @param uniqueId 达人抖音号 选填 + * @return + */ + public DataAndExtraBodyVo starAuthorScoreV2(String uniqueId){ + return new DataExternalHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId,clientKey)).starAuthorScoreV2(uniqueId); + } } diff --git a/dy-java-web/src/main/java/com/dyj/web/client/DataExternalClient.java b/dy-java-web/src/main/java/com/dyj/web/client/DataExternalClient.java index 6c5ee25..25e5387 100644 --- a/dy-java-web/src/main/java/com/dyj/web/client/DataExternalClient.java +++ b/dy-java-web/src/main/java/com/dyj/web/client/DataExternalClient.java @@ -7,6 +7,7 @@ import com.dtflys.forest.annotation.Var; import com.dtflys.forest.backend.ContentType; import com.dyj.common.domain.DyResult; import com.dyj.common.domain.DySimpleResult; +import com.dyj.common.domain.vo.DataAndExtraBodyVo; import com.dyj.common.interceptor.ClientTokenInterceptor; import com.dyj.web.domain.*; import com.dyj.common.domain.query.UserInfoQuery; @@ -197,4 +198,27 @@ public interface DataExternalClient { */ @Get(value = "${hotVideoList}", interceptor = ClientTokenInterceptor.class) DyResult hotVideoList(@Query("hot_sentence") String hotSentence); + + /** + * 获取抖音星图达人热榜 + * @param hotListType 达人热榜类型 * `1` - 星图指数榜 * `2` - 涨粉指数榜 * `3` - 性价比指数榜 * `4` - 种草指数榜 * `5` - 精选指数榜 * `6` - 传播指数榜 选填 + * @return + */ + @Get(value = "${starHotlist}", interceptor = ClientTokenInterceptor.class) + DataAndExtraBodyVo starHotlist(@Query("hot_list_type") Long hotListType); + + /** + * 获取抖音星图达人指数 + * @return + */ + @Get(value = "${starAuthorScore}", interceptor = TokenHeaderInterceptor.class) + DataAndExtraBodyVo starAuthorScore(@Var("query") UserInfoQuery query); + + /** + * 获取抖音星图达人指数数据V2 + * @param uniqueId 达人抖音号 选填 + * @return + */ + @Get(value = "${starAuthorScoreV2}", interceptor = ClientTokenInterceptor.class) + DataAndExtraBodyVo starAuthorScoreV2(@Query("unique_id") String uniqueId); } diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/StarAuthorScoreResult.java b/dy-java-web/src/main/java/com/dyj/web/domain/StarAuthorScoreResult.java new file mode 100644 index 0000000..1799641 --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/domain/StarAuthorScoreResult.java @@ -0,0 +1,128 @@ +package com.dyj.web.domain; + +import com.dyj.common.domain.vo.BaseVo; + +/** + * 获取抖音星图达人指数返回值 + */ +public class StarAuthorScoreResult extends BaseVo { + + /** + * 合作指数 选填 + */ + private Double cooperation_score; + /** + * 性价比指数 选填 + */ + private Double cp_score; + + /** + * 粉丝数 选填 + */ + private Long follower; + /** + * 涨粉指数 选填 + */ + private Double growth_score; + /** + * 达人昵称 选填 + */ + private String nick_name; + /** + * 种草指数 选填 + */ + private Double shop_score; + /** + * 传播指数 选填 + */ + private Double spread_score; + /** + * 星图指数 选填 + */ + private Double star_score; + /** + * 达人指数更新时间戳 选填 + */ + private Long update_timestamp; + + public Double getCooperation_score() { + return cooperation_score; + } + + public StarAuthorScoreResult setCooperation_score(Double cooperation_score) { + this.cooperation_score = cooperation_score; + return this; + } + + public Double getCp_score() { + return cp_score; + } + + public StarAuthorScoreResult setCp_score(Double cp_score) { + this.cp_score = cp_score; + return this; + } + + public Long getFollower() { + return follower; + } + + public StarAuthorScoreResult setFollower(Long follower) { + this.follower = follower; + return this; + } + + public Double getGrowth_score() { + return growth_score; + } + + public StarAuthorScoreResult setGrowth_score(Double growth_score) { + this.growth_score = growth_score; + return this; + } + + public String getNick_name() { + return nick_name; + } + + public StarAuthorScoreResult setNick_name(String nick_name) { + this.nick_name = nick_name; + return this; + } + + public Double getShop_score() { + return shop_score; + } + + public StarAuthorScoreResult setShop_score(Double shop_score) { + this.shop_score = shop_score; + return this; + } + + public Double getSpread_score() { + return spread_score; + } + + public StarAuthorScoreResult setSpread_score(Double spread_score) { + this.spread_score = spread_score; + return this; + } + + public Double getStar_score() { + return star_score; + } + + public StarAuthorScoreResult setStar_score(Double star_score) { + this.star_score = star_score; + return this; + } + + public Long getUpdate_timestamp() { + return update_timestamp; + } + + public StarAuthorScoreResult setUpdate_timestamp(Long update_timestamp) { + this.update_timestamp = update_timestamp; + return this; + } +} diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/StarAuthorScoreV2Result.java b/dy-java-web/src/main/java/com/dyj/web/domain/StarAuthorScoreV2Result.java new file mode 100644 index 0000000..796f904 --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/domain/StarAuthorScoreV2Result.java @@ -0,0 +1,128 @@ +package com.dyj.web.domain; + +import com.dyj.common.domain.vo.BaseVo; + +/** + * 获取抖音星图达人指数数据V2返回值 + */ +public class StarAuthorScoreV2Result extends BaseVo { + + /** + * 合作指数 选填 + */ + private Double cooperation_score; + /** + * 性价比指数 选填 + */ + private Double cp_score; + + /** + * 涨粉指数 选填 + */ + private Double growth_score; + /** + * 达人昵称 选填 + */ + private String nick_name; + /** + * 种草指数 选填 + */ + private Double shop_score; + /** + * 传播指数 选填 + */ + private Double spread_score; + /** + * 星图指数 选填 + */ + private Double star_score; + /** + * 达人抖音号 选填 + */ + private String unique_id; + /** + * 达人指数更新时间戳 选填 + */ + private Long update_timestamp; + + public Double getCooperation_score() { + return cooperation_score; + } + + public StarAuthorScoreV2Result setCooperation_score(Double cooperation_score) { + this.cooperation_score = cooperation_score; + return this; + } + + public Double getCp_score() { + return cp_score; + } + + public StarAuthorScoreV2Result setCp_score(Double cp_score) { + this.cp_score = cp_score; + return this; + } + + public Double getGrowth_score() { + return growth_score; + } + + public StarAuthorScoreV2Result setGrowth_score(Double growth_score) { + this.growth_score = growth_score; + return this; + } + + public String getNick_name() { + return nick_name; + } + + public StarAuthorScoreV2Result setNick_name(String nick_name) { + this.nick_name = nick_name; + return this; + } + + public Double getShop_score() { + return shop_score; + } + + public StarAuthorScoreV2Result setShop_score(Double shop_score) { + this.shop_score = shop_score; + return this; + } + + public Double getSpread_score() { + return spread_score; + } + + public StarAuthorScoreV2Result setSpread_score(Double spread_score) { + this.spread_score = spread_score; + return this; + } + + public Double getStar_score() { + return star_score; + } + + public StarAuthorScoreV2Result setStar_score(Double star_score) { + this.star_score = star_score; + return this; + } + + public String getUnique_id() { + return unique_id; + } + + public StarAuthorScoreV2Result setUnique_id(String unique_id) { + this.unique_id = unique_id; + return this; + } + + public Long getUpdate_timestamp() { + return update_timestamp; + } + + public StarAuthorScoreV2Result setUpdate_timestamp(Long update_timestamp) { + this.update_timestamp = update_timestamp; + return this; + } +} diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/StarHotListData.java b/dy-java-web/src/main/java/com/dyj/web/domain/StarHotListData.java new file mode 100644 index 0000000..4802291 --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/domain/StarHotListData.java @@ -0,0 +1,88 @@ +package com.dyj.web.domain; + +import java.util.List; + +/** + * 获取抖音星图达人热榜返回值下的list里的值 + */ +public class StarHotListData { + + /** + * 粉丝数 选填 + */ + private Long follower; + /** + * 达人昵称 选填 + */ + private String nick_name; + /** + * 热榜排名 选填 + */ + private Long rank; + /** + * 热榜类型对应的热榜指数 选填 + */ + private Double score; + /** + * 抖音号 选填 + */ + private String unique_id; + /** + * 选填 + */ + private List tags; + + public Long getFollower() { + return follower; + } + + public StarHotListData setFollower(Long follower) { + this.follower = follower; + return this; + } + + public String getNick_name() { + return nick_name; + } + + public StarHotListData setNick_name(String nick_name) { + this.nick_name = nick_name; + return this; + } + + public Long getRank() { + return rank; + } + + public StarHotListData setRank(Long rank) { + this.rank = rank; + return this; + } + + public Double getScore() { + return score; + } + + public StarHotListData setScore(Double score) { + this.score = score; + return this; + } + + public String getUnique_id() { + return unique_id; + } + + public StarHotListData setUnique_id(String unique_id) { + this.unique_id = unique_id; + return this; + } + + public List getTags() { + return tags; + } + + public StarHotListData setTags(List tags) { + this.tags = tags; + return this; + } +} diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/StarHotResult.java b/dy-java-web/src/main/java/com/dyj/web/domain/StarHotResult.java new file mode 100644 index 0000000..ad76a4a --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/domain/StarHotResult.java @@ -0,0 +1,61 @@ +package com.dyj.web.domain; + +import com.dyj.common.domain.vo.BaseVo; + +import java.util.List; + +public class StarHotResult extends BaseVo { + + /** + * 热榜类型说明 选填 + */ + private String hot_list_description; + /** + * 达人热榜类型 选填 + */ + private Long hot_list_type; + /** + * 达人热榜更新时间戳 选填 + */ + private Long hot_list_update_timestamp; + /** + * 选填 + */ + private List list; + + public String getHot_list_description() { + return hot_list_description; + } + + public StarHotResult setHot_list_description(String hot_list_description) { + this.hot_list_description = hot_list_description; + return this; + } + + public Long getHot_list_type() { + return hot_list_type; + } + + public StarHotResult setHot_list_type(Long hot_list_type) { + this.hot_list_type = hot_list_type; + return this; + } + + public Long getHot_list_update_timestamp() { + return hot_list_update_timestamp; + } + + public StarHotResult setHot_list_update_timestamp(Long hot_list_update_timestamp) { + this.hot_list_update_timestamp = hot_list_update_timestamp; + return this; + } + + public List getList() { + return list; + } + + public StarHotResult setList(List list) { + this.list = list; + return this; + } +} diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/query/FansGroupSettingQuery.java b/dy-java-web/src/main/java/com/dyj/web/domain/query/FansGroupSettingQuery.java index c2e6769..118ee6c 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/query/FansGroupSettingQuery.java +++ b/dy-java-web/src/main/java/com/dyj/web/domain/query/FansGroupSettingQuery.java @@ -2,7 +2,7 @@ package com.dyj.web.domain.query; import com.dyj.common.domain.query.UserInfoQuery; import com.dyj.common.enums.GroupSettingTypeEnum; -import com.dyj.web.domain.MsgContent; +import com.dyj.common.domain.MsgContent; import java.util.List; diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/query/SendGroupMsgQuery.java b/dy-java-web/src/main/java/com/dyj/web/domain/query/SendGroupMsgQuery.java index 1625205..57cc7ca 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/query/SendGroupMsgQuery.java +++ b/dy-java-web/src/main/java/com/dyj/web/domain/query/SendGroupMsgQuery.java @@ -1,7 +1,7 @@ package com.dyj.web.domain.query; import com.dyj.common.domain.query.UserInfoQuery; -import com.dyj.web.domain.MsgContent; +import com.dyj.common.domain.MsgContent; /** * @author danmo diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/query/SendMsgQuery.java b/dy-java-web/src/main/java/com/dyj/web/domain/query/SendMsgQuery.java index 9219fde..ae663b8 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/query/SendMsgQuery.java +++ b/dy-java-web/src/main/java/com/dyj/web/domain/query/SendMsgQuery.java @@ -1,7 +1,6 @@ package com.dyj.web.domain.query; import com.dyj.common.domain.query.UserInfoQuery; -import com.dyj.web.domain.MsgContent; import java.util.List; @@ -9,7 +8,7 @@ import java.util.List; * @author danmo * @date 2024-04-08 13:37 **/ -public class SendMsgQuery extends UserInfoQuery { +public class SendMsgQuery extends UserInfoQuery { /** * 消息id,场景一、场景二必传 @@ -41,7 +40,7 @@ public class SendMsgQuery extends UserInfoQuery { * 小程序券 content * 主动私信卡片 content */ - private MsgContent content; + private T content; /** * 私信场景 @@ -57,7 +56,7 @@ public class SendMsgQuery extends UserInfoQuery { * 场景三必须包含一条小程序卡片消息 * 场景四必须包含一条小程序卡片/主动私信卡片/小程序券消息 */ - private List content_list; + private List content_list; public String getMsg_id() { return msg_id; @@ -83,11 +82,11 @@ public class SendMsgQuery extends UserInfoQuery { this.to_user_id = to_user_id; } - public MsgContent getContent() { + public T getContent() { return content; } - public void setContent(MsgContent content) { + public void setContent(T content) { this.content = content; } @@ -99,24 +98,24 @@ public class SendMsgQuery extends UserInfoQuery { this.scene = scene; } - public List getContent_list() { + public List getContent_list() { return content_list; } - public void setContent_list(List content_list) { + public void setContent_list(List content_list) { this.content_list = content_list; } public static SendMsgQueryBuilder builder() { return new SendMsgQueryBuilder(); } - public static class SendMsgQueryBuilder { + public static class SendMsgQueryBuilder { private String msgId; private String conversationId; private String toUserId; - private MsgContent content; + private T content; private String scene; - private List contentList; + private List contentList; private Integer tenantId; private String clientKey; @@ -137,7 +136,7 @@ public class SendMsgQuery extends UserInfoQuery { return this; } - public SendMsgQueryBuilder content(MsgContent content) { + public SendMsgQueryBuilder content(T content) { this.content = content; return this; } @@ -147,7 +146,7 @@ public class SendMsgQuery extends UserInfoQuery { return this; } - public SendMsgQueryBuilder contentList(List contentList) { + public SendMsgQueryBuilder contentList(List contentList) { this.contentList = contentList; return this; } diff --git a/dy-java-web/src/main/java/com/dyj/web/handler/DataExternalHandler.java b/dy-java-web/src/main/java/com/dyj/web/handler/DataExternalHandler.java index 1ef18d8..ad9c50d 100644 --- a/dy-java-web/src/main/java/com/dyj/web/handler/DataExternalHandler.java +++ b/dy-java-web/src/main/java/com/dyj/web/handler/DataExternalHandler.java @@ -4,6 +4,7 @@ package com.dyj.web.handler; import com.dyj.common.config.AgentConfiguration; import com.dyj.common.domain.DyResult; import com.dyj.common.domain.DySimpleResult; +import com.dyj.common.domain.vo.DataAndExtraBodyVo; import com.dyj.web.domain.*; import com.dyj.web.domain.ApiFansDataBindFansData; import com.dyj.web.domain.vo.*; @@ -242,4 +243,31 @@ public class DataExternalHandler extends AbstractWebHandler{ return getDataExternalClient().hotVideoList(hotSentence); } + /** + * 获取抖音星图达人热榜 + * @param hotListType 达人热榜类型 * `1` - 星图指数榜 * `2` - 涨粉指数榜 * `3` - 性价比指数榜 * `4` - 种草指数榜 * `5` - 精选指数榜 * `6` - 传播指数榜 选填 + * @return + */ + public DataAndExtraBodyVo starHotlist(Long hotListType){ + return getDataExternalClient().starHotlist(hotListType); + } + + /** + * 获取抖音星图达人指数 + * @param openId 通过/oauth/access_token/获取,用户唯一标志 选填 + * @return + */ + public DataAndExtraBodyVo starAuthorScore(String openId){ + return getDataExternalClient().starAuthorScore(userInfoQuery(openId)); + } + + /** + * 获取抖音星图达人指数数据V2 + * @param uniqueId 达人抖音号 选填 + * @return + */ + public DataAndExtraBodyVo starAuthorScoreV2(String uniqueId){ + return getDataExternalClient().starAuthorScoreV2(uniqueId); + } + }