wx.api 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. import "../base.api"
  2. import "./agent.api"
  3. import "./label_relationship.api"
  4. type (
  5. // The response data of wx information | Wx信息
  6. WxInfo {
  7. BaseIDInfo
  8. // Status 1: normal 2: ban | 状态 1 正常 2 禁用
  9. Status *uint8 `json:"status,optional"`
  10. // 服务器id
  11. ServerId *uint64 `json:"serverId,optional"`
  12. // 服务器名称
  13. ServerName *string `json:"serverName,optional"`
  14. // 端口号
  15. Port *string `json:"port,optional"`
  16. // 进程号
  17. ProcessId *string `json:"processId,optional"`
  18. // 回调地址
  19. Callback *string `json:"callback,optional"`
  20. // 微信id
  21. Wxid *string `json:"wxid,optional"`
  22. // 微信账号
  23. Account *string `json:"account,optional"`
  24. // 微信昵称
  25. Nickname *string `json:"nickname,optional"`
  26. // 手机号
  27. Tel *string `json:"tel,optional"`
  28. // 微信头像
  29. HeadBig *string `json:"headBig,optional"`
  30. // 组织ID
  31. OrganizationId *uint64 `json:"organizationId,optional"`
  32. // 组织名称
  33. OrganizationName *string `json:"organizationName,optional"`
  34. // 模式ID
  35. AgentId *uint64 `json:"agentId,optional"`
  36. // 模式信息
  37. AgentInfo *AgentInfo `json:"agentInfo,optional"`
  38. // 大模型服务地址
  39. ApiBase *string `json:"apiBase,optional"`
  40. // 大模型服务密钥
  41. ApiKey *string `json:"apiKey,optional"`
  42. // 白名单
  43. AllowList []ContactInfo `json:"allowList,optional"`
  44. // 群白名单
  45. GroupAllowList []ContactInfo `json:"groupAllowList,optional"`
  46. // 黑名单
  47. BlockList []ContactInfo `json:"blockList,optional"`
  48. // 群黑名单
  49. GroupBlockList []ContactInfo `json:"groupBlockList,optional"`
  50. // 使用token总数
  51. TotalTokens *uint64 `json:"totalTokens,optional"`
  52. }
  53. UpdateBlockAndAllowListReq {
  54. BaseIDInfo
  55. // 白名单
  56. AllowList []string `json:"allowList,optional"`
  57. // 群白名单
  58. GroupAllowList []string `json:"groupAllowList,optional"`
  59. // 黑名单
  60. BlockList []string `json:"blockList,optional"`
  61. // 群黑名单
  62. GroupBlockList []string `json:"groupBlockList,optional"`
  63. }
  64. // The response data of wx list | Wx列表数据
  65. WxListResp {
  66. BaseDataInfo
  67. // Wx list data | Wx列表数据
  68. Data WxListInfo `json:"data"`
  69. }
  70. // Wx list data | Wx列表数据
  71. WxListInfo {
  72. BaseListInfo
  73. // The API list data | Wx列表数据
  74. Data []WxInfo `json:"data"`
  75. }
  76. // Get wx list request params | Wx列表请求参数
  77. WxListReq {
  78. PageInfo
  79. // 服务器id
  80. ServerId *uint64 `json:"serverId,optional"`
  81. // 租户id
  82. OrganizationId *uint64 `json:"organizationId,optional"`
  83. // 租户名称
  84. OrganizationName *string `json:"organizationName,optional"`
  85. // 端口号
  86. Port *string `json:"port,optional"`
  87. // 进程号
  88. ProcessId *string `json:"processId,optional"`
  89. // 回调地址
  90. Callback *string `json:"callback,optional"`
  91. }
  92. // Get wx list request params | Wx列表请求参数
  93. WxSelectListReq {
  94. // 租户id
  95. OrganizationId *uint64 `json:"organizationId,optional"`
  96. }
  97. // The response data of wx list | Wx列表数据
  98. WxSelectListResp {
  99. BaseDataInfo
  100. // Wx list data | Wx列表数据
  101. Data []WxSelectListInfo `json:"data"`
  102. }
  103. WxSelectListInfo {
  104. BaseIDInfo
  105. // 微信id
  106. Wxid *string `json:"wxid,optional"`
  107. // 微信昵称
  108. Nickname *string `json:"nickname,optional"`
  109. }
  110. // Wx information response | Wx信息返回体
  111. WxInfoResp {
  112. BaseDataInfo
  113. // Wx information | Wx数据
  114. Data WxInfo `json:"data"`
  115. }
  116. // 获取黑白名单列表返回体
  117. AllowBlockListResp {
  118. BaseDataInfo
  119. // Wx information | Wx数据
  120. Data AllowBlockListRespData `json:"data"`
  121. }
  122. // AllowBlockListRespData
  123. AllowBlockListRespData {
  124. // 白名单
  125. AllowList []*AllowBlockData `json:"allowList,optional"`
  126. // 群白名单
  127. GroupAllowList []*AllowBlockData `json:"groupAllowList,optional"`
  128. // 黑名单
  129. BlockList []*AllowBlockData `json:"blockList,optional"`
  130. // 群黑名单
  131. GroupBlockList []*AllowBlockData `json:"groupBlockList,optional"`
  132. }
  133. // AllowBlockData
  134. AllowBlockData {
  135. // 微信id 公众号微信ID
  136. Wxid string `json:"wxid,optional"`
  137. // 微信昵称 群备注名称
  138. Nickname string `json:"nickname,optional"`
  139. }
  140. )
  141. @server(
  142. jwt: Auth
  143. group: Wx
  144. middleware: Authority
  145. )
  146. service Wechat {
  147. // Create wx information | 创建Wx
  148. @handler createWx
  149. post /wx/create (WxInfo) returns (BaseMsgResp)
  150. // Check wx information | 检查并更新Wx状态
  151. @handler checkWx
  152. post /wx/check (WxInfo) returns (BaseMsgResp)
  153. // Update wx information | 更新Wx
  154. @handler updateWx
  155. post /wx/update (WxInfo) returns (BaseMsgResp)
  156. // Update wx information | 更新黑白名单
  157. @handler updateBlockAndAllowList
  158. post /wx/updateBlockAndAllowList (UpdateBlockAndAllowListReq) returns (BaseMsgResp)
  159. // Delete wx information | 删除Wx信息
  160. @handler deleteWx
  161. post /wx/delete (IDReq) returns (BaseMsgResp)
  162. // Get wx list | 获取Wx列表
  163. @handler getWxList
  164. post /wx/list (WxListReq) returns (WxListResp)
  165. // Get wx list | 获取Wx列表
  166. @handler getSelectWxList
  167. post /wx/selectList (WxSelectListReq) returns (WxSelectListResp)
  168. // Get wx allow and block list | 获取黑白名单列表
  169. @handler getWxAllowBlockList
  170. post /wx/getWxAllowBlockList (IDReq) returns (AllowBlockListResp)
  171. // Get wx by ID | 通过ID获取Wx
  172. @handler getWxById
  173. post /wx (IDReq) returns (WxInfoResp)
  174. }