|
@@ -57,13 +57,9 @@ class BasicLife
|
|
|
public function getAccessToken()
|
|
public function getAccessToken()
|
|
|
{
|
|
{
|
|
|
try {
|
|
try {
|
|
|
- echo $this->getPrefix()."\n";
|
|
|
|
|
$accessToken = Cache::get($this->getPrefix());
|
|
$accessToken = Cache::get($this->getPrefix());
|
|
|
if (!empty($accessToken)) return $accessToken;
|
|
if (!empty($accessToken)) return $accessToken;
|
|
|
- echo "Token:{$accessToken}\n";
|
|
|
|
|
- print_r($this->config);
|
|
|
|
|
$result = (new Token)->config($this->config)->getAccessToken();
|
|
$result = (new Token)->config($this->config)->getAccessToken();
|
|
|
- print_r($result);
|
|
|
|
|
if (empty($result)) return "获取Token失败";
|
|
if (empty($result)) return "获取Token失败";
|
|
|
Cache::set($this->getPrefix(),$result['access_token'],$result['expires_in']);
|
|
Cache::set($this->getPrefix(),$result['access_token'],$result['expires_in']);
|
|
|
return $result['access_token'];
|
|
return $result['access_token'];
|
|
@@ -90,6 +86,7 @@ class BasicLife
|
|
|
public function curlPostApi(string $url = "", array $data = [], string $field = "data"): array
|
|
public function curlPostApi(string $url = "", array $data = [], string $field = "data"): array
|
|
|
{
|
|
{
|
|
|
$result = Http::asJson()->withHeaders($this->header)->post($this->gateway.$url,$data)->array();
|
|
$result = Http::asJson()->withHeaders($this->header)->post($this->gateway.$url,$data)->array();
|
|
|
|
|
+ print_r($result);
|
|
|
if (isset($result['err_no']) && $result['err_no'] <> 0) return ['msg' => $result['err_msg']];
|
|
if (isset($result['err_no']) && $result['err_no'] <> 0) return ['msg' => $result['err_msg']];
|
|
|
if(!empty($result[$field]))
|
|
if(!empty($result[$field]))
|
|
|
{
|
|
{
|