Default Changelist

This commit is contained in:
xl
2023-07-11 21:04:33 +08:00
parent 191624b7e6
commit b66d1de244
6 changed files with 178 additions and 148 deletions
+1 -11
View File
@@ -9,8 +9,6 @@
namespace wchat\qq;
use Kiri\Client;
use wchat\common\Decode;
use wchat\common\HttpClient;
use wchat\common\Result;
class Account extends SmallProgram
@@ -32,15 +30,7 @@ class Account extends SmallProgram
$client->get('sns/jscode2session', $param);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: 'network error.');
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
return new Result(code: $body['errcode'], message: $body['errmsg']);
} else {
return new Result(code: 0, data: $body);
}
return Result::init($client);
}
}
+8 -6
View File
@@ -3,20 +3,22 @@
namespace wchat\wx;
use Kiri\Di\Container;
use ReflectionException;
use wchat\common\Config;
class QqFactory
{
/**
* @param $class
* @param Config $config
* @return mixed
*/
/**
* @param $class
* @param Config $config
* @return mixed
* @throws ReflectionException
*/
public static function get($class, Config $config): mixed
{
$container = Container::getInstance();
$container = Container::instance();
$object = $container->get($class);
$object->setConfig($config);
return $object;