Files
fast_response/admin/application/api/logic/GewechatFriendsLogic.php
Your Name dce091da91 t
2025-03-27 07:52:44 +00:00

80 lines
2.3 KiB
PHP
Executable File
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} {14:11}
*/
namespace app\api\logic;
use wanghua\general_utility_tools_php\tool\Tools;
class GewechatFriendsLogic extends BaseLogic
{
/**
* desc查询微信好友/群/关注的公众号列表[不带昵称]
* authorwh
* @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查询微信好友列表[带昵称]
* authorwh
* @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;
}
}