Default Changelist
This commit is contained in:
+1
-11
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user