@jiexiaoyin/wecom-api 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -0
- package/config.example.json +7 -0
- package/config.js +76 -0
- package/docs/approval-templates.example.json +11 -0
- package/docs/nginx-mirror.md +193 -0
- package/openclaw.plugin.json +15 -0
- package/package.json +34 -0
- package/plugin.cjs +172 -0
- package/plugin.ts +136 -0
- package/skills/wecom-api/SKILL.md +40 -0
- package/skills/wecom-api/index.js +288 -0
- package/skills/wecom-api/openclaw.plugin.json +10 -0
- package/src/callback-helper.js +198 -0
- package/src/config.cjs +286 -0
- package/src/core/permission.js +479 -0
- package/src/crypto.js +130 -0
- package/src/index.js +199 -0
- package/src/modules/addressbook/index.js +413 -0
- package/src/modules/addressbook_cache/index.js +365 -0
- package/src/modules/advanced/index.js +159 -0
- package/src/modules/app/index.js +102 -0
- package/src/modules/approval/index.js +146 -0
- package/src/modules/auth/index.js +103 -0
- package/src/modules/callback/index.js +1180 -0
- package/src/modules/chain/index.js +193 -0
- package/src/modules/checkin/index.js +142 -0
- package/src/modules/checkin_rules/index.js +251 -0
- package/src/modules/contact/index.js +481 -0
- package/src/modules/contact_stats/index.js +349 -0
- package/src/modules/custom/index.js +140 -0
- package/src/modules/customer/index.js +51 -0
- package/src/modules/disk/index.js +245 -0
- package/src/modules/document/index.js +282 -0
- package/src/modules/hr/index.js +93 -0
- package/src/modules/intelligence/index.js +346 -0
- package/src/modules/kf/index.js +74 -0
- package/src/modules/live/index.js +122 -0
- package/src/modules/media/index.js +183 -0
- package/src/modules/meeting/index.js +665 -0
- package/src/modules/message/index.js +402 -0
- package/src/modules/messenger/index.js +208 -0
- package/src/modules/moments/index.js +161 -0
- package/src/modules/msgaudit/index.js +24 -0
- package/src/modules/notify/index.js +81 -0
- package/src/modules/oceanengine/index.js +199 -0
- package/src/modules/openchat/index.js +197 -0
- package/src/modules/phone/index.js +45 -0
- package/src/modules/room/index.js +178 -0
- package/src/modules/schedule/index.js +246 -0
- package/src/modules/school/index.js +199 -0
- package/src/modules/security/index.js +223 -0
- package/src/modules/sensitive/index.js +170 -0
- package/src/modules/thirdparty/index.js +145 -0
- package/src/sdk/index.js +269 -0
- package/src/utils/callback-helper.js +198 -0
- package/test/callback-crypto.test.js +55 -0
- package/test/crypto.test.js +85 -0
- package/test/permission.test.js +115 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 数据与智能专区模块
|
|
3
|
+
* API 章节:十二
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const WeComSDK = require('../../sdk');
|
|
7
|
+
|
|
8
|
+
class Intelligence extends WeComSDK {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ========== 基础接口 ==========
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 设置公钥
|
|
17
|
+
* @param {string} publicKey 公钥
|
|
18
|
+
*/
|
|
19
|
+
async setPublicKey(publicKey) {
|
|
20
|
+
return this.post('/managle/setpublickey', { public_key: publicKey });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 获取授权存档的成员列表
|
|
25
|
+
*/
|
|
26
|
+
async getAllowedMembers() {
|
|
27
|
+
return this.post('/managle/get_allow_list', {});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 设置专区接收回调事件
|
|
32
|
+
* @param {string} callbackUrl 回调 URL
|
|
33
|
+
*/
|
|
34
|
+
async setCallbackUrl(callbackUrl) {
|
|
35
|
+
return this.post('/managle/set_callback', { callback_url: callbackUrl });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 会话组件敏感信息隐藏设置
|
|
40
|
+
* @param {number} secretEnable 是否开启: 0-关闭 1-开启
|
|
41
|
+
*/
|
|
42
|
+
async setSecret(secretEnable) {
|
|
43
|
+
return this.post('/managle/set_secret', { secret: secretEnable });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 设置日志打印级别
|
|
48
|
+
* @param {number} logLevel 日志级别: 1-调试 2-提示 3-警告 4-错误
|
|
49
|
+
*/
|
|
50
|
+
async setLogLevel(logLevel) {
|
|
51
|
+
return this.post('/managle/set_log_level', { log_level: logLevel });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 上传临时文件到专区
|
|
56
|
+
* @param {string} filePath 文件路径
|
|
57
|
+
*/
|
|
58
|
+
async uploadTempFile(filePath) {
|
|
59
|
+
return this.uploadFile(filePath, 'media');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ========== 会话记录获取 ==========
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 获取会话记录
|
|
66
|
+
* @param {string} seqId 消息序列号
|
|
67
|
+
* @param {number} limit 返回数量
|
|
68
|
+
*/
|
|
69
|
+
async getChatRecords(seqId, limit = 100) {
|
|
70
|
+
return this.post('/managle/chatdata/get', {
|
|
71
|
+
seq_id: seqId,
|
|
72
|
+
limit
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 获取会话同意情况
|
|
78
|
+
*/
|
|
79
|
+
async getConsentList() {
|
|
80
|
+
return this.post('/managle/chatdata/get_consent_list', {});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 获取内部群信息
|
|
85
|
+
* @param {string} roomId 群聊 id
|
|
86
|
+
*/
|
|
87
|
+
async getGroupInfo(roomId) {
|
|
88
|
+
return this.post('/managle/chatdata/get_room_info', { room_id: roomId });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 会话名称搜索
|
|
93
|
+
* @param {string} keyword 关键词
|
|
94
|
+
* @param {number} limit 返回数量
|
|
95
|
+
*/
|
|
96
|
+
async searchByRoomName(keyword, limit = 10) {
|
|
97
|
+
return this.post('/managle/chatdata/search_by_room_name', {
|
|
98
|
+
keyword,
|
|
99
|
+
limit
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 会话消息搜索
|
|
105
|
+
* @param {string} keyword 关键词
|
|
106
|
+
* @param {string} roomId 群聊 id (可选)
|
|
107
|
+
* @param {number} limit 返回数量
|
|
108
|
+
*/
|
|
109
|
+
async searchMessages(keyword, roomId, limit = 10) {
|
|
110
|
+
return this.post('/managle/chatdata/search_by_msg', {
|
|
111
|
+
keyword,
|
|
112
|
+
room_id: roomId,
|
|
113
|
+
limit
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 员工或客户名称搜索
|
|
119
|
+
* @param {string} keyword 关键词
|
|
120
|
+
* @param {number} limit 返回数量
|
|
121
|
+
*/
|
|
122
|
+
async searchUser(keyword, limit = 10) {
|
|
123
|
+
return this.post('/managle/chatdata/search_by_user', {
|
|
124
|
+
keyword,
|
|
125
|
+
limit
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ========== 关键词规则管理 ==========
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 获取关键词规则列表
|
|
133
|
+
*/
|
|
134
|
+
async getKeywordRules() {
|
|
135
|
+
return this.post('/managle/keyword/get_rules', {});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 新增关键词规则
|
|
140
|
+
* @param {string} ruleName 规则名称
|
|
141
|
+
* @param {string[]} keywords 关键词列表
|
|
142
|
+
* @param {string} wordGroupId 词库组 id
|
|
143
|
+
*/
|
|
144
|
+
async addKeywordRule(ruleName, keywords, wordGroupId) {
|
|
145
|
+
return this.post('/managle/keyword/add_rule', {
|
|
146
|
+
rule_name: ruleName,
|
|
147
|
+
keyword_list: keywords,
|
|
148
|
+
word_group_id: wordGroupId
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 删除关键词规则
|
|
154
|
+
* @param {string} ruleId 规则 id
|
|
155
|
+
*/
|
|
156
|
+
async deleteKeywordRule(ruleId) {
|
|
157
|
+
return this.post('/managle/keyword/del_rule', { rule_id: ruleId });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 获取命中关键词规则的会话记录
|
|
162
|
+
* @param {string} ruleId 规则 id
|
|
163
|
+
* @param {number} limit 返回数量
|
|
164
|
+
*/
|
|
165
|
+
async getHitRecords(ruleId, limit = 100) {
|
|
166
|
+
return this.post('/managle/keyword/get_hit_records', {
|
|
167
|
+
rule_id: ruleId,
|
|
168
|
+
limit
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// ========== 知识库管理 ==========
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 获取企业知识集列表
|
|
176
|
+
*/
|
|
177
|
+
async getKnowledgeList() {
|
|
178
|
+
return this.post('/managle/knowledge/list', {});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* 创建知识集
|
|
183
|
+
* @param {string} name 知识集名称
|
|
184
|
+
* @param {string} description 描述
|
|
185
|
+
*/
|
|
186
|
+
async createKnowledge(name, description) {
|
|
187
|
+
return this.post('/managle/knowledge/create', {
|
|
188
|
+
name,
|
|
189
|
+
description
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 删除知识集
|
|
195
|
+
* @param {string} knowledgeId 知识集 id
|
|
196
|
+
*/
|
|
197
|
+
async deleteKnowledge(knowledgeId) {
|
|
198
|
+
return this.post('/managle/knowledge/delete', { knowledge_id: knowledgeId });
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* 添加知识条目
|
|
203
|
+
* @param {string} knowledgeId 知识集 id
|
|
204
|
+
* @param {string} question 问题
|
|
205
|
+
* @param {string} answer 答案
|
|
206
|
+
*/
|
|
207
|
+
async addKnowledgeItem(knowledgeId, question, answer) {
|
|
208
|
+
return this.post('/managle/knowledge/add_item', {
|
|
209
|
+
knowledge_id: knowledgeId,
|
|
210
|
+
question,
|
|
211
|
+
answer
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ========== 会话内容导出 ==========
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 会话内容导出
|
|
219
|
+
* @param {string} roomId 群聊 id
|
|
220
|
+
* @param {number} startTime 开始时间戳
|
|
221
|
+
* @param {number} endTime 结束时间戳
|
|
222
|
+
* @param {string} exportType 导出类型: all-全部, text-文本, file-文件
|
|
223
|
+
*/
|
|
224
|
+
async exportChat(roomId, startTime, endTime, exportType = 'all') {
|
|
225
|
+
return this.post('/managle/chatdata/export', {
|
|
226
|
+
room_id: roomId,
|
|
227
|
+
start_time: startTime,
|
|
228
|
+
end_time: endTime,
|
|
229
|
+
export_type: exportType
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* 获取导出结果
|
|
235
|
+
* @param {string} taskId 任务 id
|
|
236
|
+
*/
|
|
237
|
+
async getExportResult(taskId) {
|
|
238
|
+
return this.post('/managle/chatdata/get_export_result', { task_id: taskId });
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// ========== 情感分析 ==========
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 情感分析
|
|
245
|
+
* @param {string} content 待分析内容
|
|
246
|
+
*/
|
|
247
|
+
async sentimentAnalysis(content) {
|
|
248
|
+
return this.post('/managle/analysis/sentiment', { content });
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// ========== 通用模型 ==========
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* 通用模型分析
|
|
255
|
+
* @param {string} prompt 提示词
|
|
256
|
+
* @param {string} query 查询内容
|
|
257
|
+
*/
|
|
258
|
+
async generalModelAnalysis(prompt, query) {
|
|
259
|
+
return this.post('/managle/model/general', { prompt, query });
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// ========== 客户标签模型 ==========
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* 客户标签推荐
|
|
266
|
+
* @param {string} userId 成员 ID
|
|
267
|
+
* @param {string} externalUserId 外部客户 ID
|
|
268
|
+
*/
|
|
269
|
+
async getCustomerTags(userId, externalUserId) {
|
|
270
|
+
return this.post('/managle/model/customer_tag', {
|
|
271
|
+
userid: userId,
|
|
272
|
+
external_userid: externalUserId
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// ========== 会话摘要模型 ==========
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* 会话摘要
|
|
280
|
+
* @param {string} roomId 群聊 ID
|
|
281
|
+
* @param {string} msgId 消息 ID
|
|
282
|
+
*/
|
|
283
|
+
async getChatSummary(roomId, msgId) {
|
|
284
|
+
return this.post('/managle/model/summary', {
|
|
285
|
+
room_id: roomId,
|
|
286
|
+
msgid: msgId
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ========== 自有模型分析 ==========
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* 异步调用自有分析程序
|
|
294
|
+
* @param {string} programId 程序 ID
|
|
295
|
+
* @param {object} inputData 输入数据
|
|
296
|
+
*/
|
|
297
|
+
async callSelfModel(programId, inputData) {
|
|
298
|
+
return this.post('/managle/model/self_analysis/async', {
|
|
299
|
+
program_id: programId,
|
|
300
|
+
input_data: inputData
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* 上报异步任务结果
|
|
306
|
+
* @param {string} programId 程序 ID
|
|
307
|
+
* @param {string} taskId 任务 ID
|
|
308
|
+
* @param {string} result 结果
|
|
309
|
+
* @param {string} errorMsg 错误信息
|
|
310
|
+
*/
|
|
311
|
+
async reportTaskResult(programId, taskId, result, errorMsg = '') {
|
|
312
|
+
return this.post('/managle/model/self_analysis/report', {
|
|
313
|
+
program_id: programId,
|
|
314
|
+
task_id: taskId,
|
|
315
|
+
result,
|
|
316
|
+
error_msg: errorMsg
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// ========== 会话反垃圾分析 ==========
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* 会话反垃圾分析
|
|
324
|
+
* @param {string} content 待分析内容
|
|
325
|
+
* @param {string} msgType 消息类型
|
|
326
|
+
*/
|
|
327
|
+
async spamAnalysis(content, msgType = 'text') {
|
|
328
|
+
return this.post('/managle/analysis/spam', { content, msg_type: msgType });
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// ========== 话术推荐 ==========
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* 获取话术推荐
|
|
335
|
+
* @param {string} content 客户消息
|
|
336
|
+
* @param {string} scene 场景
|
|
337
|
+
*/
|
|
338
|
+
async getRecommendReply(content, scene = 'default') {
|
|
339
|
+
return this.post('/managle/recommend/get', {
|
|
340
|
+
content,
|
|
341
|
+
scene
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
module.exports = Intelligence;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const WeComSDK = require("../../sdk");
|
|
2
|
+
|
|
3
|
+
class KF extends WeComSDK {
|
|
4
|
+
/** 获取客服账号列表 */
|
|
5
|
+
async accountList() {
|
|
6
|
+
return this.get("/kf/account/list", {});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** 获取在线客服账号列表 */
|
|
10
|
+
async onlineList() {
|
|
11
|
+
return this.get("/kf/account/getonline_list", {});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** 获取客服账号详情 */
|
|
15
|
+
async accountGet(openKfid) {
|
|
16
|
+
return this.post("/kf/account/get", { open_kfid: openKfid });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 添加客服账号 */
|
|
20
|
+
async accountAdd(name, mediaId) {
|
|
21
|
+
return this.post("/kf/account/add", { name, media_id: mediaId });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 删除客服账号 */
|
|
25
|
+
async accountDel(openKfid) {
|
|
26
|
+
return this.post("/kf/account/del", { open_kfid: openKfid });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** 修改客服账号 */
|
|
30
|
+
async accountUpdate(openKfid, name, mediaId) {
|
|
31
|
+
return this.post("/kf/account/update", { open_kfid: openKfid, name, media_id: mediaId });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** 获取客服账号链接 */
|
|
35
|
+
async addContactWay(openKfid, scene, style, remark) {
|
|
36
|
+
return this.post("/kf/add_contact_way", {
|
|
37
|
+
open_kfid: openKfid,
|
|
38
|
+
scene: scene || 1,
|
|
39
|
+
style: style || 1,
|
|
40
|
+
remark: remark || ""
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** 获取会话状态 */
|
|
45
|
+
async getState(openKfid) {
|
|
46
|
+
return this.post("/kf/service_state/get", { open_kfid: openKfid });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** 变更会话状态 */
|
|
50
|
+
async stateTrans(openKfid, serviceState, servicerUserid) {
|
|
51
|
+
return this.post("/kf/service_state/trans", {
|
|
52
|
+
open_kfid: openKfid,
|
|
53
|
+
service_state: serviceState,
|
|
54
|
+
servicer_userid: servicerUserid || ""
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** 同步消息 */
|
|
59
|
+
async syncMsg(token) {
|
|
60
|
+
return this.post("/kf/sync_msg", { token, limit: 100, voice_format: 0, openids: [] });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 发送消息 */
|
|
64
|
+
async sendMsg({ openKfid, touser, msgtype, text }) {
|
|
65
|
+
return this.post("/kf/send_msg", { open_kfid: openKfid, touser, msgtype, text });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 发送事件消息 */
|
|
69
|
+
async sendEvent(msg) {
|
|
70
|
+
return this.post("/kf/send_msg_on_event", msg);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
module.exports = KF;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 直播管理模块
|
|
3
|
+
* API 章节:十九
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const WeComSDK = require('../../sdk');
|
|
7
|
+
|
|
8
|
+
class Live extends WeComSDK {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 创建预约直播
|
|
15
|
+
* @param {object} params 直播参数
|
|
16
|
+
*/
|
|
17
|
+
async createLive(params) {
|
|
18
|
+
const {
|
|
19
|
+
title, // 直播标题
|
|
20
|
+
startTime, // 开始时间戳
|
|
21
|
+
endTime, // 结束时间戳
|
|
22
|
+
description, // 直播简介
|
|
23
|
+
coverMediaId, // 封面 media_id
|
|
24
|
+
type, // 直播类型: 0-通用直播
|
|
25
|
+
remindTime, // 提醒时间 (秒)
|
|
26
|
+
agenda, // 直播日程
|
|
27
|
+
groupId, // 群直播ID
|
|
28
|
+
broadcasterName, // 主播名称
|
|
29
|
+
broadcasterUserId // 主播 userid
|
|
30
|
+
} = params;
|
|
31
|
+
|
|
32
|
+
return this.post('/live/create', {
|
|
33
|
+
title,
|
|
34
|
+
start_time: startTime,
|
|
35
|
+
end_time: endTime,
|
|
36
|
+
description,
|
|
37
|
+
cover_media_id: coverMediaId,
|
|
38
|
+
type,
|
|
39
|
+
remind_time: remindTime,
|
|
40
|
+
agenda,
|
|
41
|
+
groupid: groupId,
|
|
42
|
+
broadcaster_name: broadcasterName,
|
|
43
|
+
broadcaster_userid: broadcasterUserId
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 修改预约直播
|
|
49
|
+
* @param {string} livingId 直播ID
|
|
50
|
+
* @param {object} params 更新参数
|
|
51
|
+
*/
|
|
52
|
+
async updateLive(livingId, params) {
|
|
53
|
+
return this.post('/live/modify', {
|
|
54
|
+
living_id: livingId,
|
|
55
|
+
...params
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 取消预约直播
|
|
61
|
+
* @param {string} livingId 直播ID
|
|
62
|
+
*/
|
|
63
|
+
async cancelLive(livingId) {
|
|
64
|
+
return this.post('/live/delete', { living_id: livingId });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 获取成员直播 ID 列表
|
|
69
|
+
* @param {string} userId 成员 userid
|
|
70
|
+
* @param {number} limit 返回数量
|
|
71
|
+
*/
|
|
72
|
+
async getUserLiveIds(userId, limit = 100) {
|
|
73
|
+
return this.post('/live/get_user_living_id_list', {
|
|
74
|
+
userid: userId,
|
|
75
|
+
limit
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 获取直播详情
|
|
81
|
+
* @param {string} livingId 直播ID
|
|
82
|
+
*/
|
|
83
|
+
async getLiveDetail(livingId) {
|
|
84
|
+
return this.post('/live/get_living_info', { living_id: livingId });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 获取直播观看明细
|
|
89
|
+
* @param {string} livingId 直播ID
|
|
90
|
+
* @param {number} offset 分页偏移
|
|
91
|
+
* @param {number} limit 每页数量
|
|
92
|
+
*/
|
|
93
|
+
async getWatchers(livingId, offset = 0, limit = 100) {
|
|
94
|
+
return this.post('/live/get_watch_stat', {
|
|
95
|
+
living_id: livingId,
|
|
96
|
+
offset,
|
|
97
|
+
limit
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 删除直播回放
|
|
103
|
+
* @param {string} livingId 直播ID
|
|
104
|
+
*/
|
|
105
|
+
async deleteReplay(livingId) {
|
|
106
|
+
return this.post('/live/delete_replay', { living_id: livingId });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 获取跳转小程序商城的直播观众信息
|
|
111
|
+
* @param {string} livingId 直播ID
|
|
112
|
+
* @param {string} userId 成员 userid
|
|
113
|
+
*/
|
|
114
|
+
async getMallInfo(livingId, userId) {
|
|
115
|
+
return this.post('/live/get_mall_info', {
|
|
116
|
+
living_id: livingId,
|
|
117
|
+
userid: userId
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = Live;
|