80 lines
2.4 KiB
PHP
80 lines
2.4 KiB
PHP
<?php
|
||
/*
|
||
* description:
|
||
* author:wh
|
||
* email:
|
||
* createTime:{2025/3/22} {14:11}
|
||
*/
|
||
|
||
namespace app\api\logic;
|
||
|
||
|
||
use wanghua\general_utility_tools_php\tool\Tools;
|
||
|
||
class GewechatFriendsWechatLogic extends BaseWechatLogic
|
||
{
|
||
|
||
|
||
/**
|
||
* desc:查询微信好友/群/关注的公众号列表[不带昵称]
|
||
* author:wh
|
||
* @return array 返回的是好友的微信id,需要昵称就要调好友查询接口
|
||
*
|
||
* array(3) {
|
||
["ret"] => int(200)
|
||
["msg"] => string(12) "操作成功"
|
||
["data"] => array(3) {
|
||
["friends"] => array(11) {
|
||
[0] => string(8) "fmessage"
|
||
[1] => string(9) "medianote"
|
||
[2] => string(11) "floatbottle"
|
||
[3] => string(8) "qmessage"
|
||
[4] => string(6) "qqmail"
|
||
[5] => string(6) "weixin"
|
||
[6] => string(19) "wxid_lqhlkt5nq80n12"
|
||
[7] => string(19) "wxid_xazzsfs57xt321"
|
||
[8] => string(8) "antas001"
|
||
[9] => string(19) "wxid_28a3dob3olc522"
|
||
[10] => string(19) "wxid_b7m1xkqu2s7l22"
|
||
}
|
||
["chatrooms"] => array(3) {
|
||
[0] => string(19) "7037032174@chatroom"
|
||
[1] => string(20) "52468523601@chatroom"
|
||
[2] => string(20) "52984126208@chatroom"
|
||
}
|
||
["ghs"] => array(1) {
|
||
[0] => string(15) "gh_3dfda90e39d6"
|
||
}
|
||
}
|
||
}
|
||
*
|
||
*
|
||
* @throws \Exception
|
||
*/
|
||
function getFriendWxIdsList()
|
||
{
|
||
$url = '/contacts/fetchContactsList';
|
||
$post_data = [];
|
||
Tools::log_to_write_txt(['查询微信好友列表[不带昵称],入参:$post_data'=>$post_data]);
|
||
$res = $this->curl_post_json($url, $post_data);
|
||
Tools::log_to_write_txt(['查询微信好友列表[不带昵称],出参:$res'=>$res]);
|
||
return $res;
|
||
}
|
||
/**
|
||
* desc:查询微信好友列表[带昵称]
|
||
* author:wh
|
||
* @return array 返回的是好友的微信id,需要昵称就要调好友查询接口
|
||
* @throws \Exception
|
||
*/
|
||
function getFriendDetailList()
|
||
{
|
||
$wxids_arr = $this->getFriendWxIdsList();
|
||
$wxids = $wxids_arr['data']['friends'];
|
||
$url = '/contacts/getDetailInfo';
|
||
$post_data = ['wxids'=>$wxids];
|
||
Tools::log_to_write_txt(['查询微信好友列表[带昵称],入参:$post_data'=>$post_data]);
|
||
$res = $this->curl_post_json($url, $post_data);
|
||
Tools::log_to_write_txt(['查询微信好友列表[带昵称],出参:$res'=>$res]);
|
||
return $res;
|
||
}
|
||
} |