Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

Commit 727c639

Browse files
author
justmd5
committed
Merge branch 'hotfix/v0.8.1' into develop
2 parents ba8f5f7 + 1bfeedb commit 727c639

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"php": ">=7.0",
2525
"ext-curl": "*",
2626
"ext-json": "*",
27-
"hanson/foundation-sdk": "^3.0",
27+
"hanson/foundation-sdk": "^4.0",
2828
"overtrue/validation": "^2.0"
2929
}
3030
}

src/Core/API.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Justmd5\TencentAi\Core;
1010

1111
use Hanson\Foundation\AbstractAPI;
12+
use Hanson\Foundation\Foundation;
1213
use Justmd5\TencentAi\Core\Traits\ArgumentProcessingTrait;
1314
use Justmd5\TencentAi\Exception\IllegalParameterException;
1415
use Justmd5\TencentAi\Exception\NotFoundException;
@@ -20,20 +21,19 @@ class API extends AbstractAPI
2021
use ArgumentProcessingTrait;
2122

2223
const BASE_API = 'https://api.ai.qq.com/fcgi-bin/';
23-
protected $signature;
2424
protected $classify;
2525
protected $filter;
2626

2727
/**
2828
* API constructor.
2929
*
30-
* @param Signature $signature
31-
* @param string $classify
32-
* @param array $filter
30+
* @param Foundation $app
31+
* @param string $classify
32+
* @param array $filter
3333
*/
34-
public function __construct(Signature $signature, $classify, $filter)
34+
public function __construct(Foundation $app, $classify, $filter)
3535
{
36-
$this->signature = $signature;
36+
parent::__construct($app);
3737
$this->classify = $classify;
3838
$this->filter = $filter;
3939
}
@@ -62,7 +62,7 @@ public function request($method, $params = [], $files = [])
6262
throw new IllegalParameterException(sprintf('参数错误:[%s]', json_encode($validator->errors(), JSON_UNESCAPED_UNICODE)));
6363
}
6464
$http = $this->getHttp();
65-
$params = $this->processParams($this->signature, $params);
65+
$params = $this->processParams($this->app['signature'], $params);
6666
$response = $files ? $http->upload($url, $params, $files) : $http->post($url, $params);
6767
$result = json_decode(strval($response->getBody()), true);
6868
if (isset($result['ret'])) {

src/Core/ApplicationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function register(Container $pimple)
2828
{
2929
array_walk($this->filterArray, function ($filter, $key) use (&$pimple) {
3030
$pimple[$key] = function ($pimple) use ($filter, $key) {
31-
return new API($pimple['signature'], $key, $filter);
31+
return new API($pimple, $key, $filter);
3232
};
3333
});
3434
}

0 commit comments

Comments
 (0)