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

Commit

Permalink
Merge branch 'hotfix/v0.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
justmd5 committed Jun 15, 2020
2 parents 82d2121 + 1bfeedb commit 2ac66ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/Core/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Justmd5\TencentAi\Core;

use Hanson\Foundation\AbstractAPI;
use Hanson\Foundation\Foundation;
use Justmd5\TencentAi\Core\Traits\ArgumentProcessingTrait;
use Justmd5\TencentAi\Exception\IllegalParameterException;
use Justmd5\TencentAi\Exception\NotFoundException;
Expand All @@ -20,20 +21,19 @@ class API extends AbstractAPI
use ArgumentProcessingTrait;

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

/**
* API constructor.
*
* @param Signature $signature
* @param string $classify
* @param array $filter
* @param Foundation $app
* @param string $classify
* @param array $filter
*/
public function __construct(Signature $signature, $classify, $filter)
public function __construct(Foundation $app, $classify, $filter)
{
$this->signature = $signature;
parent::__construct($app);
$this->classify = $classify;
$this->filter = $filter;
}
Expand Down Expand Up @@ -62,7 +62,7 @@ public function request($method, $params = [], $files = [])
throw new IllegalParameterException(sprintf('参数错误:[%s]', json_encode($validator->errors(), JSON_UNESCAPED_UNICODE)));
}
$http = $this->getHttp();
$params = $this->processParams($this->signature, $params);
$params = $this->processParams($this->app['signature'], $params);
$response = $files ? $http->upload($url, $params, $files) : $http->post($url, $params);
$result = json_decode(strval($response->getBody()), true);
if (isset($result['ret'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Core/ApplicationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function register(Container $pimple)
{
array_walk($this->filterArray, function ($filter, $key) use (&$pimple) {
$pimple[$key] = function ($pimple) use ($filter, $key) {
return new API($pimple['signature'], $key, $filter);
return new API($pimple, $key, $filter);
};
});
}
Expand Down

0 comments on commit 2ac66ad

Please sign in to comment.