ComposerUpdate

This commit is contained in:
Anyon 2020-06-24 15:39:39 +08:00
parent efcef2ff74
commit 0a41edfa17
12 changed files with 108 additions and 52 deletions

View File

@ -13,7 +13,6 @@
"ext-gd": "*", "ext-gd": "*",
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*", "ext-json": "*",
"ext-soap": "*",
"ext-iconv": "*", "ext-iconv": "*",
"ext-openssl": "*", "ext-openssl": "*",
"ext-mbstring": "*", "ext-mbstring": "*",

View File

@ -13,6 +13,9 @@ class ComposerAutoloaderInit0ac7cd5b2cda0031cee9c92b2dc93c50
} }
} }
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader() public static function getLoader()
{ {
if (null !== self::$loader) { if (null !== self::$loader) {

View File

@ -177,17 +177,17 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v3.4.39", "version": "v3.4.42",
"version_normalized": "3.4.39.0", "version_normalized": "3.4.42.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "730ef56164ed6c9356c159e9f5ff2b84d753b9ed" "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/730ef56164ed6c9356c159e9f5ff2b84d753b9ed", "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3b9fe6db7fe3694307d182dd73983584af77d5fd",
"reference": "730ef56164ed6c9356c159e9f5ff2b84d753b9ed", "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -199,7 +199,7 @@
"require": { "require": {
"php": "^5.5.9|>=7.0.8" "php": "^5.5.9|>=7.0.8"
}, },
"time": "2020-01-01T11:03:25+00:00", "time": "2020-05-21T13:02:25+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -235,6 +235,20 @@
"config", "config",
"configuration", "configuration",
"options" "options"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
] ]
}, },
{ {
@ -401,12 +415,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "c9c2f06884ce0b5085bedde8c41620d75b126079" "reference": "15355674ad8878421dde91c15bb975fc4c47981a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/c9c2f06884ce0b5085bedde8c41620d75b126079", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/15355674ad8878421dde91c15bb975fc4c47981a",
"reference": "c9c2f06884ce0b5085bedde8c41620d75b126079", "reference": "15355674ad8878421dde91c15bb975fc4c47981a",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -422,11 +436,11 @@
"ext-iconv": "*", "ext-iconv": "*",
"ext-json": "*", "ext-json": "*",
"ext-openssl": "*", "ext-openssl": "*",
"php": ">=5.4", "php": ">=5.5",
"qiniu/php-sdk": "^7.2", "qiniu/php-sdk": "^7.2",
"topthink/framework": "5.1.*" "topthink/framework": "5.1.*"
}, },
"time": "2020-03-12T10:21:24+00:00", "time": "2020-05-22T02:55:01+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -446,17 +460,17 @@
}, },
{ {
"name": "zoujingli/wechat-developer", "name": "zoujingli/wechat-developer",
"version": "v1.2.20", "version": "v1.2.21",
"version_normalized": "1.2.20.0", "version_normalized": "1.2.21.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/WeChatDeveloper.git", "url": "https://github.com/zoujingli/WeChatDeveloper.git",
"reference": "9afb0a29c658d52dc7b9d46d2f848602124936b7" "reference": "5cf008c37471f775ae28a23fd1ac06c91eac682f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/WeChatDeveloper/zipball/9afb0a29c658d52dc7b9d46d2f848602124936b7", "url": "https://api.github.com/repos/zoujingli/WeChatDeveloper/zipball/5cf008c37471f775ae28a23fd1ac06c91eac682f",
"reference": "9afb0a29c658d52dc7b9d46d2f848602124936b7", "reference": "5cf008c37471f775ae28a23fd1ac06c91eac682f",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -473,9 +487,10 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-openssl": "*", "ext-openssl": "*",
"ext-simplexml": "*", "ext-simplexml": "*",
"ext-xml": "*",
"php": ">=5.4" "php": ">=5.4"
}, },
"time": "2020-03-14T06:58:18+00:00", "time": "2020-04-26T03:22:09+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View File

@ -146,7 +146,7 @@ class OptionsResolver implements Options
$reflClosure = new \ReflectionFunction($value); $reflClosure = new \ReflectionFunction($value);
$params = $reflClosure->getParameters(); $params = $reflClosure->getParameters();
if (isset($params[0]) && null !== ($class = $params[0]->getClass()) && Options::class === $class->name) { if (isset($params[0]) && Options::class === $this->getParameterClassName($params[0])) {
// Initialize the option if no previous value exists // Initialize the option if no previous value exists
if (!isset($this->defaults[$option])) { if (!isset($this->defaults[$option])) {
$this->defaults[$option] = null; $this->defaults[$option] = null;
@ -1066,4 +1066,20 @@ class OptionsResolver implements Options
{ {
return (\function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type; return (\function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type;
} }
/**
* @return string|null
*/
private function getParameterClassName(\ReflectionParameter $parameter)
{
if (!method_exists($parameter, 'getType')) {
return ($class = $parameter->getClass()) ? $class->name : null;
}
if (!($type = $parameter->getType()) || $type->isBuiltin()) {
return null;
}
return method_exists($type, 'getName') ? $type->getName() : (string) $type;
}
} }

View File

@ -44,7 +44,7 @@ class OptionsResolverIntrospectorTest extends TestCase
$resolver->setDefined($option = 'foo'); $resolver->setDefined($option = 'foo');
$debug = new OptionsResolverIntrospector($resolver); $debug = new OptionsResolverIntrospector($resolver);
$this->assertSame('bar', $debug->getDefault($option)); $debug->getDefault($option);
} }
public function testGetDefaultThrowsOnNotDefinedOption() public function testGetDefaultThrowsOnNotDefinedOption()
@ -54,7 +54,7 @@ class OptionsResolverIntrospectorTest extends TestCase
$resolver = new OptionsResolver(); $resolver = new OptionsResolver();
$debug = new OptionsResolverIntrospector($resolver); $debug = new OptionsResolverIntrospector($resolver);
$this->assertSame('bar', $debug->getDefault('foo')); $debug->getDefault('foo');
} }
public function testGetLazyClosures() public function testGetLazyClosures()
@ -75,7 +75,7 @@ class OptionsResolverIntrospectorTest extends TestCase
$resolver->setDefined($option = 'foo'); $resolver->setDefined($option = 'foo');
$debug = new OptionsResolverIntrospector($resolver); $debug = new OptionsResolverIntrospector($resolver);
$this->assertSame('bar', $debug->getLazyClosures($option)); $debug->getLazyClosures($option);
} }
public function testGetLazyClosuresThrowsOnNotDefinedOption() public function testGetLazyClosuresThrowsOnNotDefinedOption()
@ -85,7 +85,7 @@ class OptionsResolverIntrospectorTest extends TestCase
$resolver = new OptionsResolver(); $resolver = new OptionsResolver();
$debug = new OptionsResolverIntrospector($resolver); $debug = new OptionsResolverIntrospector($resolver);
$this->assertSame('bar', $debug->getLazyClosures('foo')); $debug->getLazyClosures('foo');
} }
public function testGetAllowedTypes() public function testGetAllowedTypes()

View File

@ -5,7 +5,7 @@
"homepage": "http://framework.thinkadmin.top", "homepage": "http://framework.thinkadmin.top",
"description": "ThinkPHP Basic Development Library", "description": "ThinkPHP Basic Development Library",
"require": { "require": {
"php": ">=5.4", "php": ">=5.5",
"ext-gd": "*", "ext-gd": "*",
"ext-json": "*", "ext-json": "*",
"ext-curl": "*", "ext-curl": "*",

View File

@ -29,7 +29,7 @@ use think\Db;
class ListenQueue extends Command class ListenQueue extends Command
{ {
/** /**
* 当前任务服务 * 当前进程服务
* @var ProcessService * @var ProcessService
*/ */
protected $process; protected $process;
@ -42,6 +42,16 @@ class ListenQueue extends Command
$this->setName('xtask:listen')->setDescription('Start task listening main process'); $this->setName('xtask:listen')->setDescription('Start task listening main process');
} }
/**
* 初始化进程服务
* @param Input $input
* @param Output $output
*/
protected function initialize(Input $input, Output $output)
{
$this->process = ProcessService::instance();
}
/** /**
* 执行进程守护监听 * 执行进程守护监听
* @param Input $input * @param Input $input
@ -56,24 +66,24 @@ class ListenQueue extends Command
{ {
set_time_limit(0); set_time_limit(0);
Db::name('SystemQueue')->count(); Db::name('SystemQueue')->count();
if (($process = ProcessService::instance())->iswin() && function_exists('cli_set_process_title')) { if ($this->process->iswin() && function_exists('cli_set_process_title')) {
cli_set_process_title("ThinkAdmin {$process->version()} Queue Listen"); cli_set_process_title("ThinkAdmin {$this->process->version()} Queue Listen");
} }
$output->writeln('============ LISTENING ============'); $output->writeln('============ LISTENING ============');
while (true) { while (true) {
$map = [['status', 'eq', '1'], ['time', '<=', time()]]; $map = [['status', 'eq', '1'], ['time', '<=', time()]];
foreach (Db::name('SystemQueue')->where($map)->order('time asc')->select() as $vo) { foreach (Db::name('SystemQueue')->where($map)->order('time asc')->select() as $vo) {
try { try {
$command = $process->think("xtask:_work {$vo['id']} -"); $command = $this->process->think("xtask:_work {$vo['id']} -");
if (count($process->query($command)) > 0) { if (count($this->process->query($command)) > 0) {
$this->output->writeln("Already in progress -> [{$vo['id']}] {$vo['title']}"); $this->output->writeln("Already in progress -> [{$vo['id']}] {$vo['title']}");
} else { } else {
$process->create($command); $this->process->create($command);
$this->output->writeln("Created new process -> [{$vo['id']}] {$vo['title']}"); $this->output->writeln("Created new process -> [{$vo['id']}] {$vo['title']}");
} }
} catch (\Exception $e) { } catch (\Exception $exception) {
Db::name('SystemQueue')->where(['id' => $vo['id']])->update(['status' => '4', 'desc' => $e->getMessage()]); Db::name('SystemQueue')->where(['id' => $vo['id']])->update(['status' => '4', 'desc' => $exception->getMessage()]);
$output->error("Execution failed -> [{$vo['id']}] {$vo['title']}{$e->getMessage()}"); $output->error("Execution failed -> [{$vo['id']}] {$vo['title']}{$exception->getMessage()}");
} }
} }
sleep(1); sleep(1);

View File

@ -46,12 +46,12 @@ class Express
/** /**
* 获取快递公司列表 * 获取快递公司列表
* @param array $data
* @return array * @return array
*/ */
public static function getExpressList() public static function getExpressList($data = [])
{ {
$data = []; if (preg_match('/"currentData":.*?\[(.*?)],/', self::getWapBaiduHtml(), $matches)) {
if (preg_match('/"currentData":.*?\[(.*?)\],/', self::getWapBaiduHtml(), $matches)) {
foreach (json_decode("[{$matches['1']}]") as $item) $data[$item->value] = $item->text; foreach (json_decode("[{$matches['1']}]") as $item) $data[$item->value] = $item->text;
unset($data['_auto']); unset($data['_auto']);
return $data; return $data;
@ -69,22 +69,22 @@ class Express
*/ */
private static function doExpress($code, $number) private static function doExpress($code, $number)
{ {
list($uniqid, $token) = [strtr(uniqid(), '.', ''), self::getExpressToken()]; list($api, $qid) = [self::getExpressQueryApi(), '7740' . Data::uniqidNumberCode(15)];
$url = "https://express.baidu.com/express/api/express?tokenV2={$token}&appid=4001&nu={$number}&com={$code}&qid={$uniqid}&new_need_di=1&source_xcx=0&vcode=&token=&sourceId=4155&cb=callback"; $url = "{$api}&appid=4001&nu={$number}&com={$code}&qid={$qid}&new_need_di=1&source_xcx=0&vcode=&token=&sourceId=4155&cb=callback";
return json_decode(str_replace('/**/callback(', '', trim(Http::get($url, [], self::getOption()), ')')), true); return json_decode(str_replace('/**/callback(', '', trim(Http::get($url, [], self::getOption()), ')')), true);
} }
/** /**
* 获取接口请求令牌 * 获取快递查询接口
* @return string * @return string
*/ */
private static function getExpressToken() private static function getExpressQueryApi()
{ {
if (preg_match('/express\?tokenV2=(.*?)",/', self::getWapBaiduHtml(), $matches)) { if (preg_match('/"expSearchApi":.*?"(.*?)",/', self::getWapBaiduHtml(), $matches)) {
return $matches[1]; return str_replace('\\', '', $matches[1]);
} else { } else {
app()->cache->delete('express_kuaidi_html'); app()->cache->delete('express_kuaidi_html');
return self::getExpressToken(); return self::getExpressQueryApi();
} }
} }
@ -95,8 +95,9 @@ class Express
private static function getWapBaiduHtml() private static function getWapBaiduHtml()
{ {
$content = app()->cache->get('express_kuaidi_html'); $content = app()->cache->get('express_kuaidi_html');
while (empty($content) || stristr($content, '百度安全验证') > -1 || stripos($content, 'tokenV2') === -1) { while (empty($content) || stripos($content, '"expSearchApi":') === -1) {
$content = Http::get('https://m.baidu.com/s?word=快递查询&rnd=' . uniqid(), [], self::getOption()); $uniqid = str_replace('.', '', microtime(true));
$content = Http::get("https://m.baidu.com/s?word=快递查询&rand={$uniqid}", [], self::getOption());
} }
app()->cache->set('express_kuaidi_html', $content, 30); app()->cache->set('express_kuaidi_html', $content, 30);
return $content; return $content;
@ -108,10 +109,9 @@ class Express
*/ */
private static function getOption() private static function getOption()
{ {
return [ list($clentip, $cookies) = [request()->ip(), app()->getRuntimePath() . ".express.cookie"];
'cookie_file' => app()->getRuntimePath() . '_express_cookie.txt', $headers = ['Host:express.baidu.com', "CLIENT-IP:{$clentip}", "X-FORWARDED-FOR:{$clentip}"];
'headers' => ['Host' => 'express.baidu.com', 'X-FORWARDED-FOR' => request()->ip()], return ['cookie_file' => $cookies, 'headers' => $headers];
];
} }
} }

View File

@ -56,6 +56,7 @@ use WeChat\Exceptions\InvalidInstanceException;
* @method \WeMini\Delivery WeMiniDelivery($options = []) static 小程序即时配送 * @method \WeMini\Delivery WeMiniDelivery($options = []) static 小程序即时配送
* @method \WeMini\Guide WeMiniGuide($options = []) static 小程序导购助手 * @method \WeMini\Guide WeMiniGuide($options = []) static 小程序导购助手
* @method \WeMini\Image WeMiniImage($options = []) static 小程序图像处理 * @method \WeMini\Image WeMiniImage($options = []) static 小程序图像处理
* @method \WeMini\Live WeMiniLive($options = []) static 小程序直播接口
* @method \WeMini\Logistics WeMiniLogistics($options = []) static 小程序物流助手 * @method \WeMini\Logistics WeMiniLogistics($options = []) static 小程序物流助手
* @method \WeMini\Message WeMiniMessage($options = []) static 小程序动态消息 * @method \WeMini\Message WeMiniMessage($options = []) static 小程序动态消息
* @method \WeMini\Newtmpl WeMiniNewtmpl($options = []) static 小程序订阅消息 * @method \WeMini\Newtmpl WeMiniNewtmpl($options = []) static 小程序订阅消息
@ -85,7 +86,7 @@ class We
* 定义当前版本 * 定义当前版本
* @var string * @var string
*/ */
const VERSION = '1.2.20'; const VERSION = '1.2.21';
/** /**
* 静态配置 * 静态配置

View File

@ -164,10 +164,21 @@ class Tools
return json_decode(json_encode($data), true); return json_decode(json_encode($data), true);
} }
/**
* 解析XML文本内容
* @param string $xml
* @return boolean|mixed
*/
public static function xml3arr($xml)
{
$state = xml_parse($parser = xml_parser_create(), $xml, true);
return xml_parser_free($parser) && $state ? self::xml2arr($xml) : false;
}
/** /**
* 数组转xml内容 * 数组转xml内容
* @param array $data * @param array $data
* @return null|string|string * @return null|string
*/ */
public static function arr2json($data) public static function arr2json($data)
{ {

View File

@ -39,7 +39,7 @@ class Bill extends BasicWePay
$params = $this->params->merge($options); $params = $this->params->merge($options);
$params['sign'] = $this->getPaySign($params, 'MD5'); $params['sign'] = $this->getPaySign($params, 'MD5');
$result = Tools::post('https://api.mch.weixin.qq.com/pay/downloadbill', Tools::arr2xml($params)); $result = Tools::post('https://api.mch.weixin.qq.com/pay/downloadbill', Tools::arr2xml($params));
if (($jsonData = Tools::xml2arr($result))) { if (is_array($jsonData = Tools::xml3arr($result))) {
if ($jsonData['return_code'] !== 'SUCCESS') { if ($jsonData['return_code'] !== 'SUCCESS') {
throw new InvalidResponseException($jsonData['return_msg'], '0'); throw new InvalidResponseException($jsonData['return_msg'], '0');
} }

View File

@ -21,6 +21,7 @@
], ],
"require": { "require": {
"php": ">=5.4", "php": ">=5.4",
"ext-xml": "*",
"ext-json": "*", "ext-json": "*",
"ext-curl": "*", "ext-curl": "*",
"ext-bcmath": "*", "ext-bcmath": "*",