Files
fast_response/admin/application/admin/controller/Gewechatfriends.php
2025-03-22 22:46:52 +08:00

96 lines
2.9 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} {14:10}
*/
namespace app\admin\controller;
use app\api\logic\GewechatFriendsLogic;
use think\Controller;
class Gewechatfriends extends Controller
{
/**
* desc查询微信好友列表
* authorwh
* @return \think\response\Json
* @throws \Exception
*
* /api/Gewechatfriends/getFriendList
*/
function getFriendList()
{
if(cache('cache_getFriendDetailList_data'.session_admin_firm_id())){
$data = cache('cache_getFriendDetailList_data'.session_admin_firm_id());
return json(['list' => $data, 'total' => count($data)]);
}
$res = (new GewechatFriendsLogic())->getFriendDetailList();
$data = $res['data'];
foreach ($data as $k => &$v){
$v['id'] = $v['userName'] ?? '无';
$v['name'] = $v['nickName'] ?? '无';
}
cache('cache_getFriendDetailList_data'.session_admin_firm_id(),$data,86400);
return json(['list' => $data, 'total' => count($data)]);
}
/**
* desc查询好友详细信息
* authorwh
*
* array(22) {
["userName"] => string(19) "wxid_lqhlkt5nq80n12"
["nickName"] => string(6) "AI dev"
["pyInitial"] => string(5) "AIDEV"
["quanPin"] => string(5) "AIdev"
["sex"] => int(0)
["remark"] => NULL
["remarkPyInitial"] => NULL
["remarkQuanPin"] => NULL
["signature"] => NULL
["alias"] => string(7) "AIhuamn"
["snsBgImg"] => NULL
["country"] => NULL
["bigHeadImgUrl"] => string(194) "https://wx.qlogo.cn/mmhead/ver_1/iaHvw1ich96Wdvm3SF81ySOczyzUxvHj1DviaGVlt7R8OicvmItOD61GaCGG0A5UhoHZfIOolV4Q7tHHMGgicNicEGjGWDE0nZh0udwMNFicHTV5bLoXJiae6AZRzhzbeoQ9DJnhJTAI9h300LjicaTGkAvZt1A/0"
["smallHeadImgUrl"] => string(196) "https://wx.qlogo.cn/mmhead/ver_1/iaHvw1ich96Wdvm3SF81ySOczyzUxvHj1DviaGVlt7R8OicvmItOD61GaCGG0A5UhoHZfIOolV4Q7tHHMGgicNicEGjGWDE0nZh0udwMNFicHTV5bLoXJiae6AZRzhzbeoQ9DJnhJTAI9h300LjicaTGkAvZt1A/132"
["description"] => NULL
["cardImgUrl"] => NULL
["labelList"] => NULL
["province"] => NULL
["city"] => NULL
["phoneNumList"] => NULL
["id"] => string(19) "wxid_lqhlkt5nq80n12"
["name"] => string(6) "AI dev"
}
*
*
* @return \think\response\Json
* @throws \Exception
*
* /api/Gewechatfriends/getFriendDetail
*/
function getFriendDetail()
{
$wx_id = input('wx_id');
$data = [];
if(cache('cache_getFriendDetailList_data'.session_admin_firm_id())){
$cache_data = cache('cache_getFriendDetailList_data'.session_admin_firm_id());
foreach ($cache_data as $k => $v){
if($v['id'] == $wx_id){
$data = $v;
break;
}
}
return json(['data' => $data, 'total' => count($data)]);
}
return json(['data' => $data, 'total' => count($data)]);
}
}