企微短剧业务系统

GroupChatJoinWayService.php 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. <?php
  2. namespace App\Service;
  3. use App\Log;
  4. use App\Models\ChatGroup;
  5. use App\Models\DjUser;
  6. use App\Models\Es\ChatGroupMember;
  7. use App\Models\QrcodeChatGroup;
  8. use App\Models\QrcodeChatGroupDailyReport;
  9. use App\Models\QrcodeChatGroupDetail;
  10. use App\Models\SourceQrcodeGroups;
  11. use App\Models\System\Users;
  12. use App\RedisModel;
  13. use App\Support\EmailQueue;
  14. use App\Support\qyApi\QyCommon;
  15. use Illuminate\Support\Facades\DB;
  16. class GroupChatJoinWayService
  17. {
  18. /**
  19. * 创建群活码规则
  20. * */
  21. public static function setRule($params)
  22. {
  23. try {
  24. DB::beginTransaction();
  25. $params['state'] = uniqid('cgq-') . mt_rand(1000, 9999);
  26. $chatIds = [];
  27. foreach ($params['chat_id_list'] as $value) {
  28. $chatId = $value['chat_id'] ?? null;
  29. if(!$chatId) continue;
  30. $enable = $value['enable'] ?? 1;
  31. $status = $value['status'] ?? 1;
  32. if($enable && $status) {
  33. array_push($chatIds, $chatId);
  34. }
  35. }
  36. if(empty($chatIds)) {
  37. DB::rollBack();
  38. return 4809;
  39. }
  40. # 进群方式
  41. if($params['join_type'] == 1) {
  42. $chatIds = array_splice($chatIds, 0, 1);
  43. }
  44. $configId = GroupChatJoinWayService::createChatGroupJoinWay($params['corpid'], 2, $chatIds, $params['state']);
  45. if(is_numeric($configId)) return $configId;
  46. $params['config_id'] = $configId;
  47. $result = GroupChatJoinWayService::getChatGroupJoinWay($params['corpid'], $params['config_id']);
  48. if(is_numeric($result)) return $result;
  49. $params['qrcode'] = $result['qrcode'];
  50. // $chatIdsOfQrcode = $result['chat_id_list'];
  51. # 数据入库
  52. $ruleId = null;
  53. $errCode = QrcodeChatGroup::editRule($params, $ruleId);
  54. if($errCode) {
  55. DB::rollBack();
  56. return $errCode;
  57. }
  58. # 处理不可用群信息
  59. foreach ($params['chat_id_list'] as $index=>$chatInfo) {
  60. $chatId = $chatInfo['chat_id'] ?? null;
  61. if(!$chatId) unset($params['chat_id_list'][$index]);
  62. $status = $chatInfo['status'] ?? 1;
  63. $isUsed = 1;
  64. if($params['join_type'] == 1 && $index >0) { // 顺序进群仅排序最靠前的群会被配置到活码中
  65. $isUsed = 0;
  66. }
  67. # 提交的chatId是否被创建
  68. // if(!in_array($chatId, $chatIdsOfQrcode) && $status == 1) {
  69. // $chatInfo['enable'] = 0;
  70. // }
  71. # 数据入库
  72. QrcodeChatGroupDetail::updateOrCreate([
  73. 'chat_id' => $chatId,
  74. 'rule_id' => $ruleId,
  75. 'corpid' => $params['corpid'],
  76. ], [
  77. 'user_limit' => $chatInfo['user_limit'],
  78. 'status' => $status,
  79. 'enable' => $chatInfo['enable'] ?? 1,
  80. 'is_used' => $isUsed,
  81. 'sort' => $index
  82. ]);
  83. }
  84. DB::commit();
  85. } catch (\Exception $e) {
  86. EmailQueue::rPush('创建群活码流程发生异常', $e->getTraceAsString(), ['xiaohua.hou@kuxuan-inc.com'], '创建群活码流程发生异常');
  87. Log::logError('创建群活码流程发生异常', [
  88. 'line' => $e->getLine(),
  89. 'msg' => $e->getMessage(),
  90. 'param' => $params
  91. ], 'GroupChatJoinWayCreate');
  92. DB::rollBack();
  93. return 4804;
  94. }
  95. return 0;
  96. }
  97. /**
  98. * 编辑群活码
  99. * */
  100. public static function editRule($params, $ruleId, $configId)
  101. {
  102. try{
  103. # 校验configId是否合法
  104. $ruleInfo = QrcodeChatGroup::checkConfigId($params['corpid'], $ruleId, $configId);
  105. if(empty($ruleInfo)) return 4807;
  106. $params['config_id'] = $configId;
  107. $state = $ruleInfo->state;
  108. $params['state'] = $state;
  109. $params['qrcode'] = $ruleInfo->qrcode;
  110. # 校验已配置的群信息与本次提交的群信息是否一致
  111. $chatIdList = QrcodeChatGroupDetail::select(['chat_id'])->where('rule_id', $ruleId)
  112. ->where('enable', 1)->where('status', 1)->orderBy('sort')->pluck('chat_id')->toArray();
  113. DB::beginTransaction();
  114. $errCode = QrcodeChatGroup::editRule($params, $ruleId);
  115. if($errCode) {
  116. DB::rollBack();
  117. return $errCode;
  118. }
  119. $updateQrcode = false;
  120. $chatIds = [];
  121. foreach ($params['chat_id_list'] as $index=>$chatInfo) {
  122. $chatId = $chatInfo['chat_id'] ?? null;
  123. $enable = $chatInfo['enable'] ?? 1;
  124. $status = $chatInfo['status'] ?? 1;
  125. $isUsed = 1;
  126. if(!$chatId) {
  127. unset($params['chat_id_list'][$index]);
  128. continue;
  129. }
  130. # 与群活码中设置的群不一致
  131. if($params['join_type'] == 1) {
  132. if($index) {
  133. $isUsed = 0;
  134. } else {
  135. # 获取当前配置的chat_id与本次的chat_id是否一致
  136. $result = GroupChatJoinWayService::getChatGroupJoinWay($params['corpid'], $params['config_id']);
  137. $chatIdsOfQrcode = $result['chat_id_list'];
  138. if(!in_array($chatId, $chatIdsOfQrcode)) {
  139. $updateQrcode = true;
  140. }
  141. }
  142. } else {
  143. if((
  144. !in_array($chatId, $chatIdList) && $enable==1 && $status==1) ||
  145. (in_array($chatId, $chatIdList) && ($enable==0 || $status==0))) {
  146. $updateQrcode = true;
  147. }
  148. }
  149. if($enable && $status) {
  150. array_push($chatIds, $chatId);
  151. }
  152. # 数据入库
  153. QrcodeChatGroupDetail::updateOrCreate([
  154. 'corpid' => $params['corpid'],
  155. 'chat_id' => $chatId,
  156. 'rule_id' => $ruleId
  157. ], [
  158. 'user_limit' => $chatInfo['user_limit'],
  159. 'enable' => $enable,
  160. 'status' => $status,
  161. 'is_used' => $isUsed,
  162. 'sort' => $index
  163. ]);
  164. }
  165. if(empty($chatIds)) {
  166. DB::rollBack();
  167. return 4809;
  168. }
  169. # 若群活码发生变更则执行群活码更新
  170. if($updateQrcode) {
  171. if($params['join_type'] == 1) {
  172. $chatIds = array_splice($chatIds, 0, 1);
  173. }
  174. $qrcodeInfo = ['corpid' => $params['corpid'], 'config_id' => $configId, 'chat_id' =>$chatIds, 'state' => $state];
  175. RedisModel::lPush(QrcodeChatGroup::UPDATE_QRCODE_CHAT_ID_RDS, json_encode($qrcodeInfo, 256));
  176. }
  177. DB::commit();
  178. } catch (\Exception $e) {
  179. EmailQueue::rPush('编辑群活码流程发生异常', $e->getTraceAsString(), ['xiaohua.hou@kuxuan-inc.com'], '编辑群活码流程发生异常');
  180. Log::logError('编辑群活码流程发生异常', [
  181. 'line' => $e->getLine(),
  182. 'msg' => $e->getMessage(),
  183. 'param' => $params,
  184. 'rule_id' => $ruleId
  185. ], 'GroupChatJoinWayUpdate');
  186. DB::rollBack();
  187. return 4808;
  188. }
  189. return 0;
  190. }
  191. /**
  192. * 群活码列表
  193. * */
  194. public static function ruleList($corpid, $groupId, $name, $page, $pageSize)
  195. {
  196. list($list, $count) = QrcodeChatGroup::getGroupQrcodeList($corpid, $groupId, $name, $page, $pageSize);
  197. # 获取创建人信息
  198. $adminIds = $list->pluck('admin_id');
  199. $adminData = Users::select(['id','name'])->whereIn('id', $adminIds)->get();
  200. # 获取分组信息
  201. $groupIds = $list->pluck('group_id');
  202. $groupData = SourceQrcodeGroups::select(['id', 'name'])->whereIn('id', $groupIds)->where('type', 2)->get();
  203. # 获取扫码数据
  204. $ruleIds = $list->pluck('id');
  205. $scanData = QrcodeChatGroupDailyReport::select(['rule_id', 'scan_num'])->whereIn('rule_id', $ruleIds)
  206. ->groupBy(['rule_id'])->get();
  207. foreach ($list as $datum) {
  208. # 创建人信息
  209. $adminInfo = $adminData->where('id', $datum->admin_id)->first();
  210. $datum->creator = $adminInfo->name ?? '';
  211. # 分组信息
  212. $groupInfo = $groupData->where('id', $datum->group_id)->first();
  213. $datum->group_name = $groupInfo->name ?? '';
  214. # 扫码人数
  215. $scanInfo = $scanData->where('rule_id', $datum->id)->first();
  216. $datum->scan = $scanInfo->scan_num ?? 0;
  217. }
  218. return [$list, $count];
  219. }
  220. /**
  221. * 群活码详情
  222. * */
  223. public static function ruleDetail($corpid, $ruleId, &$errno)
  224. {
  225. try {
  226. $detail = QrcodeChatGroup::getGroupQrcodeDetail($corpid, $ruleId);
  227. if(empty($detail)) {
  228. $errno = 4811;
  229. return [];
  230. }
  231. # 获取群活码对应的群组信息配置
  232. $chatGroupConfig = QrcodeChatGroupDetail::select(['chat_id', 'sort', 'user_limit', 'enable', 'status'])
  233. ->where('corpid', $corpid)->where('rule_id', $ruleId)->where('enable', 1)->orderBy('sort')
  234. ->get();
  235. $detail->chat_id_list = $chatGroupConfig;
  236. } catch (\Exception $e) {
  237. Log::logError('群活码详情获取过程发生异常', [
  238. 'line' => $e->getLine(),
  239. 'msg' => $e->getMessage(),
  240. 'rule_id' => $ruleId,
  241. 'corpid' => $corpid
  242. ], 'QrcodeChatGroupRuleDetail');
  243. $errno = 4810;
  244. return [];
  245. }
  246. return $detail;
  247. }
  248. public static function qrcodeDetail($corpid, $ruleId, &$errno)
  249. {
  250. try {
  251. $detail = QrcodeChatGroup::getGroupQrcodeDetail($corpid, $ruleId);
  252. if(empty($detail)) {
  253. $errno = 4811;
  254. return '';
  255. }
  256. } catch (\Exception $e) {
  257. Log::logError('群活码详情获取过程发生异常', [
  258. 'line' => $e->getLine(),
  259. 'msg' => $e->getMessage(),
  260. 'rule_id' => $ruleId,
  261. 'corpid' => $corpid
  262. ], 'QrcodeChatGroupRuleDetail');
  263. $errno = 4810;
  264. return '';
  265. }
  266. return $detail->qrcode;
  267. }
  268. /**
  269. * 禁用群活码
  270. * */
  271. public static function delQrcode($corpid, $ruleId)
  272. {
  273. try {
  274. DB::beginTransaction();
  275. # 校验群活码是否存在
  276. $qrcodeInfo = QrcodeChatGroup::where('enable', 1)->where('status', 1)->where('id', $ruleId)
  277. ->where('corpid', $corpid)
  278. ->first();
  279. if(empty($qrcodeInfo)) {
  280. DB::rollBack();
  281. return 4811;
  282. }
  283. $qrcodeInfo->del_time = date('Y-m-d H:i:s');
  284. $qrcodeInfo->status = 0;
  285. $result = $qrcodeInfo->save();
  286. if(!$result) {
  287. DB::rollBack();
  288. return 4813;
  289. }
  290. # 调用企微api执行删除群活码
  291. $configId = $qrcodeInfo->config_id;
  292. $responseData = QyCommon::delGroupJoinWay($corpid, $configId);
  293. if(!isset($responseData['errcode']) || $responseData['errcode']) {
  294. EmailQueue::rPush('删除客户群进群方式配置', json_encode($responseData['errmsg'], 256), ['xiaohua.hou@kuxuan-inc.com'], '删除客户群进群方式配置');
  295. return 4813;
  296. }
  297. # 修改群活码配置状态
  298. QrcodeChatGroupDetail::where('rule_id', $ruleId)->update(['enable' => 0]);
  299. DB::commit();
  300. } catch (\Exception $e) {
  301. DB::rollBack();
  302. Log::logError('删除群活码过程发生异常', [
  303. 'line' => $e->getLine(),
  304. 'msg' => $e->getMessage(),
  305. 'corpid' => $corpid,
  306. 'rule_id' => $ruleId
  307. ], 'ChatGroupQrcodeDel');
  308. return 4812;
  309. }
  310. return 0;
  311. }
  312. /**
  313. * 获取群活码总概数据
  314. * */
  315. public static function getCondition($corpid, $ruleId)
  316. {
  317. # 统计群活码累计数据
  318. $data = QrcodeChatGroupDailyReport::selectRaw("scan_num as scan_total, sum(join_num) as join_total, " .
  319. "sum(loss_num) as loss_total, sum(keep_num) as keep_total")
  320. ->where('corpid', $corpid)->where('rule_id', $ruleId)
  321. ->first();
  322. # 统计群活码当日数据
  323. $today = QrcodeChatGroupDailyReport::selectRaw("scan_num as scan_today, sum(join_num) as join_today, " .
  324. "sum(loss_num) as loss_today")->where('ref_date', date('Y-m-d'))->where('corpid', $corpid)->where('rule_id', $ruleId)
  325. ->first();
  326. # 累计进群人数
  327. $joinTotal = $data->join_total ?? 0;
  328. # 累计退群人数
  329. $lossTotal = $data->loss_total ?? 0;
  330. # 累计留存人数
  331. $keepTotal = $data->keep_total ?? 0;
  332. return [
  333. 'scan_total' => $data->scan_total ?? 0,
  334. 'scan_today' => $today->scan_today ?? 0,
  335. 'join_total' => $joinTotal,
  336. 'join_today' => $today->join_today ?? 0,
  337. 'loss_total' => $lossTotal,
  338. 'loss_today' => $today->loss_today ?? 0,
  339. 'loss_rate' => $joinTotal ? round($lossTotal / $joinTotal, 4) * 100 . '%' : '0%',
  340. 'keep_rate' => $joinTotal ? round($keepTotal / $joinTotal, 4) * 100 . '%' : '0%',
  341. ];
  342. }
  343. /**
  344. * 群活码每日数据分析
  345. * */
  346. public static function getDailyReport($corpid, $ruleId, $startDate, $endDate)
  347. {
  348. $list = self::getTrendFormatData($startDate, $endDate);
  349. $data = QrcodeChatGroupDailyReport::selectRaw("ref_date, corpid, rule_id, scan_num as scan_total, sum(keep_num) as keep_total")
  350. ->where('corpid', $corpid)->where('rule_id', $ruleId)
  351. ->where('ref_date', '>=', $startDate)
  352. ->where('ref_date', '<=', $endDate)
  353. ->groupBy(['corpid','ref_date', 'rule_id'])
  354. ->get();
  355. if(!empty($data)) {
  356. foreach ($data as $datum) {
  357. $list[$datum->ref_date]['scan_total'] = intval($datum->scan_total);
  358. $list[$datum->ref_date]['keep_total'] = intval($datum->keep_total);
  359. }
  360. }
  361. return array_values($list);
  362. }
  363. /**
  364. * 群活码扫码进群客户列表
  365. * */
  366. public static function getMemberList($corpid, $ruleId, $keyword, $page, $pageSize)
  367. {
  368. # 获取客户群ID集合及state
  369. $state = QrcodeChatGroup::where('id', $ruleId)->where('corpid', $corpid)->where('enable', 1)->value('state');
  370. if(empty($state)) return [[], 0];
  371. $chatIds = QrcodeChatGroupDetail::where('rule_id', $ruleId)->pluck('chat_id')->toArray();
  372. list($list, $count) = ChatGroupMember::getMemberListOfQrcode($corpid, $chatIds, $state, $keyword, $page, $pageSize);
  373. return [$list, $count];
  374. }
  375. /**
  376. * 群活码配置群的数据分析
  377. * */
  378. public static function chatGroupAnalysis($corpid, $ruleId)
  379. {
  380. $data = QrcodeChatGroupDailyReport::selectRaw("sum(join_num) as join_total, sum(loss_num) as loss_total, sum(keep_num) as keep_total, chat_id")
  381. ->where('corpid', $corpid)->where('rule_id', $ruleId)->groupBy(['chat_id'])
  382. ->get();
  383. # 获取群名称
  384. $chatIds = $data->pluck('chat_id');
  385. $chatGroupList = ChatGroup::select(['chat_id', 'name'])->where('corpid', $corpid)->whereIn('chat_id', $chatIds)->get();
  386. foreach ($data as $datum) {
  387. # 群名称
  388. $chatGroupInfo = $chatGroupList->where('chat_id', $datum->chat_id)->first();
  389. $datum->chat_group_name = $chatGroupInfo->name ?? '';
  390. # 留存率
  391. $joinTotal = $datum->join_total ?? 0;
  392. $keepTotal = $datum->keep_total ?? 0;
  393. $datum->keep_rate = $joinTotal ? round($keepTotal / $joinTotal, 4) * 100 . '%' : '0%';
  394. }
  395. return $data;
  396. }
  397. /**
  398. * 扫码数据上报
  399. * */
  400. public static function scanNumIncr($corpid, $ruleId)
  401. {
  402. try {
  403. $result = QrcodeChatGroupDailyReport::where('corpid', $corpid)->where('rule_id', $ruleId)->increment('scan_num');
  404. if(!$result) {
  405. Log::logError('扫码数据上报失败', [
  406. 'corpid' => $corpid,
  407. 'rule_id' => $ruleId
  408. ], 'scanNumIncr');
  409. return 4814;
  410. }
  411. } catch (\Exception $e) {
  412. Log::logError('扫码数据上报发生异常', [
  413. 'corpid' => $corpid,
  414. 'rule_id' => $ruleId,
  415. 'line' => $e->getLine(),
  416. 'msg' => $e->getMessage()
  417. ], 'scanNumIncr');
  418. }
  419. return 0;
  420. }
  421. /**
  422. * 创建临时渠道码
  423. * */
  424. public static function createTempContactQrcode($corpid, $ruleId, &$errno)
  425. {
  426. # 获取群活码配置的客服信息
  427. $configInfo = QrcodeChatGroup::select(['user_list', 'leading_words', 'state'])
  428. ->where('id', $ruleId)->where('corpid', $corpid)
  429. ->where('enable', 1)->first();
  430. $userListStr = $configInfo->user_list ?? '';
  431. if(empty($userListStr)) {
  432. $errno = 4815;
  433. return [];
  434. }
  435. # 随机取出一个客服
  436. $userList = explode(',', $userListStr);
  437. $userId = $userList[rand(0, count($userList) -1)];
  438. # 查询客服对应的二维码
  439. $userInfo = DjUser::where('corpid', $corpid)->where('user_id', $userId)->first();
  440. $qrcode = $userInfo->qr_code ?? '';
  441. if(empty($qrcode)) {
  442. # 生成临时渠道码
  443. $params = [
  444. "type" => 2, //联系方式类型,1-单人, 2-多人
  445. "scene" => 2, //场景,1-在小程序中联系,2-通过二维码联系
  446. "remark" => "临时渠道码活码", //联系方式的备注信息
  447. "skip_verify" => true, //外部客户添加时是否无需验证,默认为true
  448. "state" => $configInfo->state, //企业自定义的state参数,用于区分不同的添加渠道,不超过30字符
  449. "user" => [$userId], //客服列表
  450. ];
  451. $responseData = QyCommon::momentCommon('add_contact_way', $corpid, $params);
  452. if(!$responseData) {
  453. $errno = 4815;
  454. return [];
  455. }
  456. # 更新渠道活码信息到客服信息
  457. $qrcode = $responseData['qr_code'];
  458. $userInfo->qr_code = $qrcode;
  459. $userInfo->save();
  460. }
  461. $errno = 0;
  462. return [
  463. 'qrcode' => $qrcode,
  464. 'leading_words' => $configInfo->leading_words
  465. ];
  466. }
  467. /**
  468. * 获取群组下的群活码规则数
  469. * */
  470. public static function chatGroupCountOfGroup($corpid, $groupId)
  471. {
  472. return QrcodeChatGroup::where('enable', 1)->where('corpid', $corpid)
  473. ->where('group_id', $groupId)->count();
  474. }
  475. /**
  476. * 数据结构组装
  477. * */
  478. protected static function getTrendFormatData($stDate, $enDate)
  479. {
  480. $dayArr = [];
  481. $stDateStr = strtotime($stDate);
  482. $enDateStr = strtotime($enDate);
  483. while ($stDateStr <= $enDateStr) {
  484. $date = date('Y-m-d', $stDateStr);
  485. $dayArr[$date] = [
  486. 'ref_date' => $date,
  487. 'scan_total' => 0,
  488. 'keep_total' => 0
  489. ];
  490. $stDateStr += 86400;
  491. }
  492. return $dayArr;
  493. }
  494. /**
  495. * 创建群活码信息
  496. * */
  497. public static function createChatGroupJoinWay(
  498. $corpid, $scene, $chatIds, $state, $autoCreateRoom=1, $roomBaseName='', $roomBaseId=1, $remark=null
  499. )
  500. {
  501. $responseData = QyCommon::addGroupJoinWay($corpid, $scene, $chatIds, $state, $autoCreateRoom, $roomBaseName, $roomBaseId, $remark);
  502. if(!isset($responseData['errcode']) || $responseData['errcode']) {
  503. Log::logError('创建群活码失败', [
  504. 'corpid' => $corpid, 'scene' => $scene, 'chatIds' => $chatIds, 'state' => $state,
  505. 'autoCreateRoom' => $autoCreateRoom, 'roomBaseName' => $roomBaseName, 'roomBaseId' => $roomBaseId,
  506. 'remark' => $remark, 'response' => $responseData
  507. ], 'CreateChatGroupJoinWay');
  508. if($responseData['errcode'] != 701170) {
  509. EmailQueue::rPush('创建群活码失败', json_encode($responseData['errmsg'], 256), ['xiaohua.hou@kuxuan-inc.com'], '创建群活码失败');
  510. }
  511. return 4801;
  512. }
  513. return $responseData['config_id'];
  514. }
  515. /**
  516. * 获取群活码信息
  517. * */
  518. public static function getChatGroupJoinWay($corpid, $configId)
  519. {
  520. $responseData = QyCommon::getGroupJoinWay($corpid, $configId);
  521. if(!isset($responseData['errcode']) || $responseData['errcode']) {
  522. EmailQueue::rPush('获取群活码信息失败', json_encode($responseData['errmsg'], 256), ['xiaohua.hou@kuxuan-inc.com'], '获取群活码信息失败');
  523. return 4802;
  524. }
  525. $chatIdList = $responseData['join_way']['chat_id_list'] ?? null;
  526. $qrcode = $responseData['join_way']['qr_code'] ?? null;
  527. if(!$chatIdList || !$qrcode) return 4803;
  528. return ['chat_id_list' => $chatIdList, 'qrcode' => $qrcode];
  529. }
  530. }