Files
fast_response/superadmin/application/api/logic/GechatroomWechatLogic.php
2025-03-29 14:00:36 +08:00

97 lines
3.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/*
* description
* authorwh
* email
* createTime{2025/3/22} {17:52}
*/
namespace app\api\logic;
use wanghua\general_utility_tools_php\tool\Tools;
class GechatroomWechatLogic extends BaseWechatLogic
{
/**
* 获取群列表[带群名称],包含了群成员列表
*
* 包含了群成员列表
*
*
*/
function getChatroomList($ai_config_id)
{
//$this->getChatroomMemberList();die;
//$base_url = config('gewechat.base_url');
//去查询群名称
$logic = new GewechatFriendsWechatLogic();
$logic->setBaseUrlByAiCustmerConfig($ai_config_id);
$wxids_arr = $logic->getFriendWxIdsList();
$chatrooms = $wxids_arr['data']['chatrooms'];
$url = '/group/getChatroomInfo';
Tools::log_to_write_txt(['获取群列表[带群名称],包含了群成员列表,入参:$chatrooms'=>$chatrooms]);
$arr = [];
foreach ($chatrooms as $v){
$post_data = ['chatroomId'=>$v];
$res = $logic->curl_post_json($url, $post_data);
//群号=>群信息[含群成员列表]
$arr[] = array_merge($res['data'],[
'id'=>$v,
'name'=>isset($res['data']['nickName'])?$res['data']['nickName']:'null',
'chatroomId'=>$v,
]);
}
Tools::log_to_write_txt(['获取群列表[带群名称],包含了群成员列表,出参:$res'=>count($arr)]);
return $arr;
}
function getChatroomMemberList(){
//去查询群名称
$wxids_arr = (new GewechatFriendsWechatLogic())->getFriendWxIdsList();
$chatrooms = $wxids_arr['data']['chatrooms'];
dump($chatrooms);
$url = '/group/getChatroomMemberDetail';
Tools::log_to_write_txt(['获取群列表[带群名称],包含了群成员列表,入参:$chatrooms'=>$chatrooms]);
$arr = [];
foreach ($chatrooms as $v){
$post_data = ['chatroomId'=>$v];
$res = $this->curl_post_json($url, $post_data);
dump($res);die;
//群号=>群信息[含群成员列表]
$arr[$v] = array_merge($res['data'],[
'id'=>$v,
'name'=>$res['data']['nickName']
]);
}
Tools::log_to_write_txt(['获取群列表[带群名称],包含了群成员列表,出参:$res'=>count($arr)]);
return $arr;
}
/**
* desc获取群成员详情
* authorwh
*/
function getChatroomMemberDetail(){
//去查询群名称
$wxids_arr = (new GewechatFriendsWechatLogic())->getFriendWxIdsList();
$chatrooms = $wxids_arr['data']['chatrooms'];
dump($chatrooms);
$url = '/group/getChatroomMemberDetail';
Tools::log_to_write_txt(['获取群列表[带群名称],包含了群成员列表,入参:$chatrooms'=>$chatrooms]);
$arr = [];
foreach ($chatrooms as $v){
$post_data = ['chatroomId'=>$v];
$res = $this->curl_post_json($url, $post_data);
dump($res);die;
//群号=>群信息[含群成员列表]
$arr[$v] = array_merge($res['data'],[
'id'=>$v,
'name'=>$res['data']['nickName']
]);
}
Tools::log_to_write_txt(['获取群列表[带群名称],包含了群成员列表,出参:$res'=>count($arr)]);
return $arr;
}
}