Files
fast_response/admin/application/api/logic/TokenWechatLogic.php
2025-03-29 13:59:40 +08:00

43 lines
1.0 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:04}
*/
namespace app\api\logic;
use wanghua\general_utility_tools_php\SundryConfig;
class TokenWechatLogic
{
public function __construct()
{
}
/**
* desc
*
* array(3) {
["code"] => int(200)
["msg"] => string(7) "cURL ok"
["data"] => string(84) "{"gewe-token":"8bd053cb84f24770ae4df11441500427","appId":"wx_N3vKyMW8nl41epbcu891k"}"
}
* authorwh
* @throws \Exception
*/
function getToken()
{
$base_url = SundryConfig::val('py_app_base_url');
$url = $base_url.'/vip_groups/auth_info';
$res = \wanghua\general_utility_tools_php\http\Curl::curl_post($url, []);
if(empty($res['data'])){
throw new \Exception('获取token失败');
}
$res_data = json_decode($res['data'], true);
return [
'token' => $res_data['gewe-token'],
'appId' => $res_data['appId'],
];
}
}