mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
ComposerUpdate
This commit is contained in:
parent
8a03e1842d
commit
9c9e1f69a4
12
vendor/composer/installed.json
vendored
12
vendor/composer/installed.json
vendored
@ -958,17 +958,17 @@
|
||||
},
|
||||
{
|
||||
"name": "zoujingli/think-library",
|
||||
"version": "v6.0.11",
|
||||
"version_normalized": "6.0.11.0",
|
||||
"version": "v6.0.12",
|
||||
"version_normalized": "6.0.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "eab7b5fb89f2fa859c3943514fdc7af5a7a43ef0"
|
||||
"reference": "a25e52f4f8af59ee55e33d00fff42ee919abba46"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/eab7b5fb89f2fa859c3943514fdc7af5a7a43ef0",
|
||||
"reference": "eab7b5fb89f2fa859c3943514fdc7af5a7a43ef0",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/a25e52f4f8af59ee55e33d00fff42ee919abba46",
|
||||
"reference": "a25e52f4f8af59ee55e33d00fff42ee919abba46",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -985,7 +985,7 @@
|
||||
"ext-mbstring": "*",
|
||||
"topthink/framework": "^6.0"
|
||||
},
|
||||
"time": "2020-09-23T09:42:23+00:00",
|
||||
"time": "2020-09-24T02:44:19+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"think": {
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2020-09-23 18:02:05
|
||||
// This file is automatically generated at:2020-09-24 10:51:47
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\admin\\Library',
|
||||
|
@ -73,7 +73,7 @@ abstract class Command extends ThinkCommand
|
||||
* @param null|integer $progress 进度数值
|
||||
* @return static
|
||||
*/
|
||||
protected function setQueueProgress($message = null, $progress = null)
|
||||
protected function setQueueProgress(?string $message = null, $progress = null)
|
||||
{
|
||||
if (defined('WorkQueueCode')) {
|
||||
$this->queue->progress(2, $message, $progress);
|
||||
|
@ -139,9 +139,9 @@ abstract class Controller extends \stdClass
|
||||
* 返回视图内容
|
||||
* @param string $tpl 模板名称
|
||||
* @param array $vars 模板变量
|
||||
* @param mixed $node CSRF授权节点
|
||||
* @param null|string $node 授权节点
|
||||
*/
|
||||
public function fetch($tpl = '', $vars = [], $node = null): void
|
||||
public function fetch(string $tpl = '', array $vars = [], ?string $node = null): void
|
||||
{
|
||||
foreach ($this as $name => $value) $vars[$name] = $value;
|
||||
if ($this->csrf_state) {
|
||||
@ -203,7 +203,7 @@ abstract class Controller extends \stdClass
|
||||
* @param string|Query $dbQuery
|
||||
* @param boolean $page 是否启用分页
|
||||
* @param boolean $display 是否渲染模板
|
||||
* @param boolean $total 集合分页记录数
|
||||
* @param boolean|integer $total 集合分页记录数
|
||||
* @param integer $limit 集合每页记录数
|
||||
* @param string $template 模板文件名称
|
||||
* @return array
|
||||
|
@ -41,7 +41,7 @@ class Library extends Service
|
||||
/**
|
||||
* 扩展库版本号
|
||||
*/
|
||||
const VERSION = '6.0.11';
|
||||
const VERSION = '6.0.12';
|
||||
|
||||
/**
|
||||
* 启动服务
|
||||
|
3
vendor/zoujingli/think-library/src/Queue.php
vendored
3
vendor/zoujingli/think-library/src/Queue.php
vendored
@ -71,7 +71,6 @@ abstract class Queue
|
||||
/**
|
||||
* 执行任务处理内容
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function execute($data = []);
|
||||
|
||||
@ -81,7 +80,7 @@ abstract class Queue
|
||||
* @param null|integer $progress 进度数值
|
||||
* @return Queue
|
||||
*/
|
||||
protected function setQueueProgress($message = null, $progress = null): Queue
|
||||
protected function setQueueProgress(?string $message = null, $progress = null): Queue
|
||||
{
|
||||
$this->queue->progress(2, $message, $progress);
|
||||
return $this;
|
||||
|
@ -58,7 +58,7 @@ abstract class Service
|
||||
* @param boolean $new 创建新实例
|
||||
* @return static
|
||||
*/
|
||||
public static function instance($var = [], $new = false)
|
||||
public static function instance(array $var = [], bool $new = false)
|
||||
{
|
||||
return Container::getInstance()->make(static::class, $var, $new);
|
||||
}
|
||||
|
16
vendor/zoujingli/think-library/src/Storage.php
vendored
16
vendor/zoujingli/think-library/src/Storage.php
vendored
@ -42,18 +42,18 @@ abstract class Storage
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* 链接前缀
|
||||
* @var string
|
||||
*/
|
||||
protected $prefix;
|
||||
|
||||
/**
|
||||
* 链接类型
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* 链接前缀
|
||||
* @var string
|
||||
*/
|
||||
protected $prefix;
|
||||
|
||||
/**
|
||||
* Storage constructor.
|
||||
* @param App $app
|
||||
@ -101,7 +101,7 @@ abstract class Storage
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public static function instance($name = null)
|
||||
public static function instance(?string $name = null)
|
||||
{
|
||||
$class = ucfirst(strtolower($name ?: sysconf('storage.type')));
|
||||
if (class_exists($object = "think\\admin\\storage\\{$class}Storage")) {
|
||||
@ -198,7 +198,7 @@ abstract class Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return string
|
||||
*/
|
||||
protected function getSuffix(string $attname = null): string
|
||||
protected function getSuffix(?string $attname = null): string
|
||||
{
|
||||
if ($this->type === 'full') {
|
||||
if (is_string($attname) && strlen($attname) > 0) {
|
||||
|
@ -82,7 +82,7 @@ class Queue extends Command
|
||||
if (count($result = $this->process->query("-t {$root} {$root}router.php")) < 1) {
|
||||
$this->output->writeln(">> There are no WebServer processes to stop");
|
||||
} else foreach ($result as $item) {
|
||||
$this->process->close($item['pid']);
|
||||
$this->process->close(intval($item['pid']));
|
||||
$this->output->writeln(">> Successfully sent end signal to process {$item['pid']}");
|
||||
}
|
||||
}
|
||||
@ -134,7 +134,7 @@ class Queue extends Command
|
||||
if (count($result = $this->process->query($keyword)) < 1) {
|
||||
$this->output->writeln(">> There are no task processes to stop");
|
||||
} else foreach ($result as $item) {
|
||||
$this->process->close($item['pid']);
|
||||
$this->process->close(intval($item['pid']));
|
||||
$this->output->writeln(">> Successfully sent end signal to process {$item['pid']}");
|
||||
}
|
||||
}
|
||||
|
12
vendor/zoujingli/think-library/src/common.php
vendored
12
vendor/zoujingli/think-library/src/common.php
vendored
@ -36,11 +36,11 @@ if (!function_exists('p')) {
|
||||
if (!function_exists('auth')) {
|
||||
/**
|
||||
* 访问权限检查
|
||||
* @param string $node
|
||||
* @param null|string $node
|
||||
* @return boolean
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
function auth($node): bool
|
||||
function auth(?string $node): bool
|
||||
{
|
||||
return AdminService::instance()->check($node);
|
||||
}
|
||||
@ -54,7 +54,7 @@ if (!function_exists('sysuri')) {
|
||||
* @param boolean|string $domain 域名
|
||||
* @return string
|
||||
*/
|
||||
function sysuri($url = '', array $vars = [], $suffix = true, $domain = false)
|
||||
function sysuri(string $url = '', array $vars = [], $suffix = true, $domain = false)
|
||||
{
|
||||
return SystemService::instance()->sysuri($url, $vars, $suffix, $domain);
|
||||
}
|
||||
@ -63,7 +63,7 @@ if (!function_exists('sysconf')) {
|
||||
/**
|
||||
* 获取或配置系统参数
|
||||
* @param string $name 参数名称
|
||||
* @param string $value 参数内容
|
||||
* @param mixed $value 参数内容
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
@ -88,7 +88,7 @@ if (!function_exists('sysdata')) {
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
function sysdata($name, $value = null)
|
||||
function sysdata(string $name, $value = null)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return SystemService::instance()->getData($name);
|
||||
@ -123,7 +123,7 @@ if (!function_exists('systoken')) {
|
||||
* @param null|string $node
|
||||
* @return string
|
||||
*/
|
||||
function systoken($node = null): string
|
||||
function systoken(?string $node = null): string
|
||||
{
|
||||
$result = TokenService::instance()->buildFormToken($node);
|
||||
return $result['token'] ?? '';
|
||||
|
@ -18,7 +18,7 @@ declare (strict_types=1);
|
||||
namespace think\admin\extend;
|
||||
|
||||
/**
|
||||
* 导出CSV文件扩展
|
||||
* 导出 CSV 文件扩展
|
||||
* Class ExcelExtend
|
||||
* @package think\admin\extend
|
||||
*/
|
||||
@ -26,11 +26,11 @@ class ExcelExtend
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置写入CSV文件头部
|
||||
* 设置写入 CSV 文件头部
|
||||
* @param string $name 导出文件名称
|
||||
* @param array $headers 表格头部(一维数组)
|
||||
*/
|
||||
public static function header(string $name, array $headers)
|
||||
public static function header(string $name, array $headers): void
|
||||
{
|
||||
header('Content-Type: application/octet-stream');
|
||||
header("Content-Disposition: attachment; filename=" . iconv('utf-8', 'gbk//TRANSLIT', $name));
|
||||
|
@ -38,9 +38,9 @@ class JsonRpcClient
|
||||
|
||||
/**
|
||||
* JsonRpcClient constructor.
|
||||
* @param $proxy
|
||||
* @param string $proxy
|
||||
*/
|
||||
public function __construct($proxy)
|
||||
public function __construct(string $proxy)
|
||||
{
|
||||
$this->proxy = $proxy;
|
||||
$this->id = CodeExtend::uniqidNumber();
|
||||
|
@ -3,21 +3,12 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | Library for ThinkAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
// | 此文件版权所有归原作者所有,在此特别感觉 !!!!!!!!!!!!!!!
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: https://gitee.com/zoujingli/ThinkLibrary
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary
|
||||
// | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary
|
||||
// | 此文件版权所有归原作者所有,在此特别提出感谢 !!!!!!!!!!!!!!!
|
||||
// +----------------------------------------------------------------------
|
||||
// | 以下源代码来自 https://github.com/erusev/parsedown ,基于 MIT 协议开源
|
||||
// | 为减少 Composer 组件数量优化加载速度,直接将源码复制于此,在此表示感谢原作者 !
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace think\admin\extend;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ class PageHelper extends Helper
|
||||
* @param string|Query $dbQuery
|
||||
* @param boolean $page 是否启用分页
|
||||
* @param boolean $display 是否渲染模板
|
||||
* @param boolean $total 集合分页记录数
|
||||
* @param boolean|integer $total 集合分页记录数
|
||||
* @param integer $limit 集合每页记录数
|
||||
* @param string $template 模板文件名称
|
||||
* @return array|mixed
|
||||
|
@ -207,7 +207,7 @@ class QueryHelper extends Helper
|
||||
* @param callable|null $callback 回调函数
|
||||
* @return $this
|
||||
*/
|
||||
private function _setBetweenWhere($fields, string $split = ' ', $input = null, string $alias = '#', $callback = null): QueryHelper
|
||||
private function _setBetweenWhere($fields, string $split = ' ', $input = null, string $alias = '#', ?callable $callback = null): QueryHelper
|
||||
{
|
||||
$data = $this->_getInputData($input ?: $this->input);
|
||||
foreach (is_array($fields) ? $fields : explode(',', $fields) as $field) {
|
||||
|
@ -59,7 +59,7 @@ class TokenHelper extends Helper
|
||||
* @param array $vars 模板变量
|
||||
* @param string|null $node 授权节点
|
||||
*/
|
||||
public function fetchTemplate($tpl = '', $vars = [], $node = null)
|
||||
public function fetchTemplate(string $tpl = '', array $vars = [], ?string $node = null)
|
||||
{
|
||||
throw new HttpResponseException(view($tpl, $vars, 200, function ($html) use ($node) {
|
||||
return preg_replace_callback('/<\/form>/i', function () use ($node) {
|
||||
|
@ -40,7 +40,7 @@ class ValidateHelper extends Helper
|
||||
* region.value => value // 固定字段数值内容
|
||||
* 更多规则参照 ThinkPHP 官方的验证类
|
||||
*/
|
||||
public function init(array $rules, string $input = '', $callable = null): array
|
||||
public function init(array $rules, string $input = '', ?callable $callable = null): array
|
||||
{
|
||||
if (is_string($input)) {
|
||||
$type = trim($input, '.') ?: 'request';
|
||||
|
@ -63,7 +63,7 @@ class App
|
||||
* @param Closure $next
|
||||
* @return Response
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (!$this->parseMultiApp()) {
|
||||
return $next($request);
|
||||
|
@ -73,12 +73,11 @@ class Url extends \think\route\Url
|
||||
|
||||
public function build()
|
||||
{
|
||||
// 解析URL
|
||||
$url = $this->url;
|
||||
$suffix = $this->suffix;
|
||||
$domain = $this->domain;
|
||||
$request = $this->app->request;
|
||||
$vars = $this->vars;
|
||||
$domain = $this->domain;
|
||||
$suffix = $this->suffix;
|
||||
$request = $this->app->request;
|
||||
if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
|
||||
// [name] 表示使用路由命名标识生成URL
|
||||
$name = substr($url, 1, $pos - 1);
|
||||
|
@ -67,11 +67,11 @@ class AdminService extends Service
|
||||
/**
|
||||
* 检查指定节点授权
|
||||
* --- 需要读取缓存或扫描所有节点
|
||||
* @param string $node
|
||||
* @param null|string $node
|
||||
* @return boolean
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function check(string $node = ''): bool
|
||||
public function check(?string $node = ''): bool
|
||||
{
|
||||
if ($this->isSuper()) return true;
|
||||
$service = NodeService::instance();
|
||||
|
@ -112,10 +112,10 @@ class CaptchaService extends Service
|
||||
/**
|
||||
* 检查验证码是否正确
|
||||
* @param string $code 需要验证的值
|
||||
* @param string|null $uniqid 验证码编号
|
||||
* @param null|string $uniqid 验证码编号
|
||||
* @return boolean
|
||||
*/
|
||||
public function check(string $code, $uniqid = null): bool
|
||||
public function check(string $code, ?string $uniqid = null): bool
|
||||
{
|
||||
$_uni = is_string($uniqid) ? $uniqid : input('uniqid', '-');
|
||||
$_val = $this->app->cache->get($_uni, '');
|
||||
@ -163,7 +163,7 @@ class CaptchaService extends Service
|
||||
if (function_exists('imagettftext')) {
|
||||
imagettftext($img, $this->fontsize, mt_rand(-30, 30), intval($_x * $i + mt_rand(1, 5)), intval($this->height / 1.4), $fontcolor, $this->fontfile, $this->code[$i]);
|
||||
} else {
|
||||
imagestring($img, 15, $_x * $i + mt_rand(10, 15), mt_rand(10, 30), $this->code[$i], $fontcolor);
|
||||
imagestring($img, 15, intval($_x * $i + mt_rand(10, 15)), mt_rand(10, 30), $this->code[$i], $fontcolor);
|
||||
}
|
||||
}
|
||||
ob_start();
|
||||
|
@ -45,7 +45,7 @@ class ExpressService extends Service
|
||||
* 快递服务初始化
|
||||
* @return $this
|
||||
*/
|
||||
protected function initialize()
|
||||
protected function initialize(): ExpressService
|
||||
{
|
||||
// 创建 CURL 请求模拟参数
|
||||
$clentip = $this->app->request->ip();
|
||||
@ -94,7 +94,7 @@ class ExpressService extends Service
|
||||
*/
|
||||
public function getExpressList(array $data = []): array
|
||||
{
|
||||
if (preg_match('/"currentData":.*?\[(.*?)],/', $this->getWapBaiduHtml(), $matches)) {
|
||||
if (preg_match('/"currentData":.*?\[(.*?)],/', $this->_getWapBaiduHtml(), $matches)) {
|
||||
foreach (json_decode("[{$matches['1']}]") as $item) $data[$item->value] = $item->text;
|
||||
unset($data['_auto']);
|
||||
return $data;
|
||||
@ -114,7 +114,7 @@ class ExpressService extends Service
|
||||
private function doExpress(string $code, string $number)
|
||||
{
|
||||
$qid = CodeExtend::uniqidNumber(19, '7740');
|
||||
$url = "{$this->getExpressQueryApi()}&appid=4001&nu={$number}&com={$code}&qid={$qid}&new_need_di=1&source_xcx=0&vcode=&token=&sourceId=4155&cb=callback";
|
||||
$url = "{$this->_getExpressQueryApi()}&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(HttpExtend::get($url, [], $this->options), ')')), true);
|
||||
}
|
||||
|
||||
@ -122,14 +122,14 @@ class ExpressService extends Service
|
||||
* 获取快递查询接口
|
||||
* @return string
|
||||
*/
|
||||
private function getExpressQueryApi(): string
|
||||
private function _getExpressQueryApi(): string
|
||||
{
|
||||
if (preg_match('/"expSearchApi":.*?"(.*?)",/', $this->getWapBaiduHtml(), $matches)) {
|
||||
if (preg_match('/"expSearchApi":.*?"(.*?)",/', $this->_getWapBaiduHtml(), $matches)) {
|
||||
return str_replace('\\', '', $matches[1]);
|
||||
} else {
|
||||
@unlink($this->cookies);
|
||||
$this->app->cache->delete('express_kuaidi_html');
|
||||
return $this->getExpressQueryApi();
|
||||
return $this->_getExpressQueryApi();
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ class ExpressService extends Service
|
||||
* 获取百度WAP快递HTML(用于后面的抓取关键值)
|
||||
* @return string
|
||||
*/
|
||||
private function getWapBaiduHtml(): string
|
||||
private function _getWapBaiduHtml(): string
|
||||
{
|
||||
$content = $this->app->cache->get('express_kuaidi_html', '');
|
||||
while (empty($content) || stripos($content, '"expSearchApi":') === -1) {
|
||||
|
@ -120,7 +120,7 @@ class InterfaceService extends Service
|
||||
|
||||
/**
|
||||
* 设置接口网关地址
|
||||
* @param string $getway
|
||||
* @param string $getway 网关地址
|
||||
* @return $this
|
||||
*/
|
||||
public function getway(string $getway): InterfaceService
|
||||
@ -134,7 +134,7 @@ class InterfaceService extends Service
|
||||
* @param boolean $check 验证数据
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInput($check = true)
|
||||
public function getInput(bool $check = true)
|
||||
{
|
||||
// 基础参数获取
|
||||
$this->input = ValidateHelper::instance()->init([
|
||||
@ -182,7 +182,7 @@ class InterfaceService extends Service
|
||||
* 获取请求参数
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
public function getData(): array
|
||||
{
|
||||
if ($this->debug) {
|
||||
return $this->app->request->request();
|
||||
@ -198,7 +198,7 @@ class InterfaceService extends Service
|
||||
* @param mixed $data 返回数据
|
||||
* @param mixed $code 返回状态码
|
||||
*/
|
||||
public function error($info, $data = '{-null-}', $code = 0)
|
||||
public function error($info, $data = '{-null-}', $code = 0): void
|
||||
{
|
||||
if ($data === '{-null-}') $data = new \stdClass();
|
||||
$this->baseResponse(lang('think_library_response_success'), ['code' => $code, 'info' => $info, 'data' => $data], 1);
|
||||
@ -210,7 +210,7 @@ class InterfaceService extends Service
|
||||
* @param mixed $data 返回数据
|
||||
* @param mixed $code 返回状态码
|
||||
*/
|
||||
public function success($info, $data = '{-null-}', $code = 1)
|
||||
public function success($info, $data = '{-null-}', $code = 1): void
|
||||
{
|
||||
if ($data === '{-null-}') $data = new \stdClass();
|
||||
$this->baseResponse(lang('think_library_response_success'), ['code' => $code, 'info' => $info, 'data' => $data], 1);
|
||||
@ -222,7 +222,7 @@ class InterfaceService extends Service
|
||||
* @param mixed $data 返回数据
|
||||
* @param mixed $code 根状态码
|
||||
*/
|
||||
public function baseError($info, $data = [], $code = 0)
|
||||
public function baseError($info, $data = [], $code = 0): void
|
||||
{
|
||||
$this->baseResponse($info, $data, $code);
|
||||
}
|
||||
@ -233,7 +233,7 @@ class InterfaceService extends Service
|
||||
* @param mixed $data 返回数据
|
||||
* @param mixed $code 根状态码
|
||||
*/
|
||||
public function baseSuccess($info, $data = [], $code = 1)
|
||||
public function baseSuccess($info, $data = [], $code = 1): void
|
||||
{
|
||||
$this->baseResponse($info, $data, $code);
|
||||
}
|
||||
@ -244,7 +244,7 @@ class InterfaceService extends Service
|
||||
* @param mixed $data 返回数据
|
||||
* @param mixed $code 根状态码
|
||||
*/
|
||||
public function baseResponse($info, $data = [], $code = 1)
|
||||
public function baseResponse($info, $data = [], $code = 1): void
|
||||
{
|
||||
$array = $this->_buildSign($data);
|
||||
throw new HttpResponseException(json([
|
||||
|
@ -131,12 +131,12 @@ class MessageService extends Service
|
||||
|
||||
/**
|
||||
* 发送国内短信验证码
|
||||
* @param string $phone 手机号
|
||||
* @param string $content 短信内容
|
||||
* @param string $productid 短信通道
|
||||
* @param integer|string $phone 手机号
|
||||
* @param integer|string $content 短信内容
|
||||
* @param integer|string $productid 短信通道
|
||||
* @return boolean
|
||||
*/
|
||||
public function sendChinaSms($phone, $content, $productid = '676767')
|
||||
public function sendChinaSms($phone, $content, $productid = '676767'): bool
|
||||
{
|
||||
$tkey = date("YmdHis");
|
||||
$result = HttpExtend::get('http://www.ztsms.cn/sendNSms.do', [
|
||||
@ -156,7 +156,7 @@ class MessageService extends Service
|
||||
|
||||
/**
|
||||
* 发送国内短信验证码
|
||||
* @param mixed $phone 目标手机
|
||||
* @param integer|string $phone 目标手机
|
||||
* @param integer $wait 等待时间
|
||||
* @param string $type 短信模板
|
||||
* @return array
|
||||
@ -164,7 +164,7 @@ class MessageService extends Service
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function sendChinaSmsByCode($phone, $wait = 120, $type = 'sms_reg_template')
|
||||
public function sendChinaSmsByCode($phone, int $wait = 120, string $type = 'sms_reg_template'): array
|
||||
{
|
||||
$cache = $this->app->cache->get($ckey = "{$type}_{$phone}", []);
|
||||
if (is_array($cache) && isset($cache['time']) && $cache['time'] > time() - $wait) {
|
||||
@ -186,8 +186,8 @@ class MessageService extends Service
|
||||
|
||||
/**
|
||||
* 验证手机短信验证码
|
||||
* @param string $phone 目标手机
|
||||
* @param string $code 短信验证码
|
||||
* @param integer|string $phone 目标手机
|
||||
* @param integer|string $code 短信验证码
|
||||
* @param string $type 短信模板
|
||||
* @return boolean
|
||||
*/
|
||||
@ -237,8 +237,8 @@ class MessageService extends Service
|
||||
|
||||
/**
|
||||
* 发送国际短信内容
|
||||
* @param string $code 国家代码
|
||||
* @param string $mobile 手机号码
|
||||
* @param integer|string $code 国家代码
|
||||
* @param integer|string $mobile 手机号码
|
||||
* @param string $content 发送内容
|
||||
* @return boolean
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
@ -263,7 +263,7 @@ class MessageService extends Service
|
||||
* 查询国际短信余额
|
||||
* @return array
|
||||
*/
|
||||
public function queryGlobeSmsBalance()
|
||||
public function queryGlobeSmsBalance(): array
|
||||
{
|
||||
$tkey = date("YmdHis");
|
||||
$result = HttpExtend::get('http://intl.zthysms.com/intBalance.do', [
|
||||
@ -280,7 +280,7 @@ class MessageService extends Service
|
||||
* 获取国际地域编号
|
||||
* @return array
|
||||
*/
|
||||
public function getGlobeRegionMap()
|
||||
public function getGlobeRegionMap(): array
|
||||
{
|
||||
return [
|
||||
['title' => '中国 台湾', 'english' => 'Taiwan', 'code' => 886],
|
||||
|
@ -55,10 +55,10 @@ class NodeService extends Service
|
||||
|
||||
/**
|
||||
* 检查并完整节点内容
|
||||
* @param string $node
|
||||
* @param null|string $node
|
||||
* @return string
|
||||
*/
|
||||
public function fullnode($node): string
|
||||
public function fullnode(?string $node = ''): string
|
||||
{
|
||||
if (empty($node)) return $this->getCurrent();
|
||||
if (count($attrs = explode('/', $node)) === 1) {
|
||||
@ -107,7 +107,7 @@ class NodeService extends Service
|
||||
[, $namespace, $appname, $classname] = $matches;
|
||||
$class = new \ReflectionClass(strtr("{$namespace}/{$appname}/controller/{$classname}", '/', '\\'));
|
||||
$prefix = strtolower(strtr("{$appname}/{$this->nameTolower($classname)}", '\\', '/'));
|
||||
$data[$prefix] = $this->_parseComment($class->getDocComment(), $classname);
|
||||
$data[$prefix] = $this->_parseComment($class->getDocComment() ?: '', $classname);
|
||||
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
|
||||
if (in_array($metname = $method->getName(), $ignores)) continue;
|
||||
$data[strtolower("{$prefix}/{$metname}")] = $this->_parseComment($method->getDocComment() ?: '', $metname);
|
||||
|
@ -151,10 +151,10 @@ class QueueService extends Service
|
||||
* 设置任务进度信息
|
||||
* @param null|integer $status 任务状态
|
||||
* @param null|string $message 进度消息
|
||||
* @param null|integer $progress 进度数值
|
||||
* @param null|float $progress 进度数值
|
||||
* @return array
|
||||
*/
|
||||
public function progress($status = null, $message = null, $progress = null): array
|
||||
public function progress(?int $status = null, ?string $message = null, $progress = null): array
|
||||
{
|
||||
$ckey = "queue_{$this->code}_progress";
|
||||
if (is_numeric($status) && intval($status) === 3) {
|
||||
|
@ -260,11 +260,11 @@ class SystemService extends Service
|
||||
|
||||
/**
|
||||
* 获取实时运行配置
|
||||
* @param string $key
|
||||
* @param array $default
|
||||
* @param null|string $name 配置名称
|
||||
* @param array $default 配置内容
|
||||
* @return array|string
|
||||
*/
|
||||
public function getRuntime($key = null, array $default = [])
|
||||
public function getRuntime($name = null, array $default = [])
|
||||
{
|
||||
$filename = "{$this->app->getRootPath()}runtime/config.json";
|
||||
if (file_exists($filename) && is_file($filename)) {
|
||||
@ -274,14 +274,14 @@ class SystemService extends Service
|
||||
if (empty($data['map']) || !is_array($data['map'])) $data['map'] = [];
|
||||
if (empty($data['uri']) || !is_array($data['uri'])) $data['uri'] = [];
|
||||
if (empty($data['run']) || !is_string($data['run'])) $data['run'] = 'debug';
|
||||
return is_null($key) ? $data : ($data[$key] ?? $default);
|
||||
return is_null($name) ? $data : ($data[$name] ?? $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置实时运行配置
|
||||
* @param array|null $map 应用映射
|
||||
* @param string|null $run 支持模式
|
||||
* @param array|null $uri 域名映射
|
||||
* @param null|array $map 应用映射
|
||||
* @param null|string $run 支持模式
|
||||
* @param null|array $uri 域名映射
|
||||
* @return boolean 是否调试模式
|
||||
*/
|
||||
public function setRuntime(array $map = [], $run = null, array $uri = []): bool
|
||||
|
@ -134,12 +134,12 @@ class TokenService extends Service
|
||||
/**
|
||||
* 设置缓存数据
|
||||
* @param string $token
|
||||
* @param array $item
|
||||
* @param array $value
|
||||
* @return static
|
||||
*/
|
||||
private function _setCacheItem(string $token, array $item)
|
||||
private function _setCacheItem(string $token, array $value)
|
||||
{
|
||||
$this->cachedata[$token] = $item;
|
||||
$this->cachedata[$token] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class AliossStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return array
|
||||
*/
|
||||
public function set(string $name, string $file, $safe = false, $attname = null)
|
||||
public function set(string $name, string $file, bool $safe = false, ?string $attname = null)
|
||||
{
|
||||
$token = $this->buildUploadToken($name);
|
||||
$data = ['key' => $name];
|
||||
@ -122,7 +122,7 @@ class AliossStorage extends Storage
|
||||
* @param boolean $safe 安全模式
|
||||
* @return false|string
|
||||
*/
|
||||
public function get(string $name, $safe = false)
|
||||
public function get(string $name, bool $safe = false)
|
||||
{
|
||||
return static::curlGet($this->url($name, $safe));
|
||||
}
|
||||
@ -133,7 +133,7 @@ class AliossStorage extends Storage
|
||||
* @param boolean $safe 安全模式
|
||||
* @return boolean
|
||||
*/
|
||||
public function del(string $name, $safe = false)
|
||||
public function del(string $name, bool $safe = false)
|
||||
{
|
||||
[$file] = explode('?', $name);
|
||||
$result = HttpExtend::request('DELETE', "http://{$this->bucket}.{$this->point}/{$file}", [
|
||||
@ -148,7 +148,7 @@ class AliossStorage extends Storage
|
||||
* @param boolean $safe 安全模式
|
||||
* @return boolean
|
||||
*/
|
||||
public function has(string $name, $safe = false)
|
||||
public function has(string $name, bool $safe = false)
|
||||
{
|
||||
$file = $this->delSuffix($name);
|
||||
$result = HttpExtend::request('HEAD', "http://{$this->bucket}.{$this->point}/{$file}", [
|
||||
@ -164,7 +164,7 @@ class AliossStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return string
|
||||
*/
|
||||
public function url(string $name, $safe = false, $attname = null): string
|
||||
public function url(string $name, bool $safe = false, ?string $attname = null): string
|
||||
{
|
||||
return "{$this->prefix}/{$this->delSuffix($name)}{$this->getSuffix($attname)}";
|
||||
}
|
||||
@ -175,7 +175,7 @@ class AliossStorage extends Storage
|
||||
* @param boolean $safe 安全模式
|
||||
* @return string
|
||||
*/
|
||||
public function path(string $name, $safe = false): string
|
||||
public function path(string $name, bool $safe = false): string
|
||||
{
|
||||
return $this->url($name, $safe);
|
||||
}
|
||||
@ -187,7 +187,7 @@ class AliossStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return array
|
||||
*/
|
||||
public function info(string $name, $safe = false, $attname = null): array
|
||||
public function info(string $name, bool $safe = false, ?string $attname = null): array
|
||||
{
|
||||
return $this->has($name, $safe) ? [
|
||||
'url' => $this->url($name, $safe, $attname),
|
||||
@ -212,7 +212,7 @@ class AliossStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return array
|
||||
*/
|
||||
public function buildUploadToken($name = null, $expires = 3600, $attname = null): array
|
||||
public function buildUploadToken(?string $name = null, int $expires = 3600, ?string $attname = null): array
|
||||
{
|
||||
$data = [
|
||||
'policy' => base64_encode(json_encode([
|
||||
|
@ -68,7 +68,7 @@ class LocalStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return array
|
||||
*/
|
||||
public function set(string $name, string $file, bool $safe = false, $attname = null)
|
||||
public function set(string $name, string $file, bool $safe = false, ?string $attname = null)
|
||||
{
|
||||
try {
|
||||
$path = $this->path($name, $safe);
|
||||
@ -126,7 +126,7 @@ class LocalStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return string
|
||||
*/
|
||||
public function url(string $name, bool $safe = false, $attname = null): string
|
||||
public function url(string $name, bool $safe = false, ?string $attname = null): string
|
||||
{
|
||||
return $safe ? $name : "{$this->prefix}/upload/{$this->delSuffix($name)}{$this->getSuffix($attname)}";
|
||||
}
|
||||
@ -151,7 +151,7 @@ class LocalStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return array
|
||||
*/
|
||||
public function info(string $name, bool $safe = false, $attname = null): array
|
||||
public function info(string $name, bool $safe = false, ?string $attname = null): array
|
||||
{
|
||||
return $this->has($name, $safe) ? [
|
||||
'url' => $this->url($name, $safe, $attname),
|
||||
|
@ -79,7 +79,7 @@ class QiniuStorage extends Storage
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function set(string $name, string $file, bool $safe = false, $attname = null)
|
||||
public function set(string $name, string $file, bool $safe = false, ?string $attname = null)
|
||||
{
|
||||
$token = $this->buildUploadToken($name, 3600, $attname);
|
||||
$data = ['key' => $name, 'token' => $token, 'fileName' => $name];
|
||||
@ -135,7 +135,7 @@ class QiniuStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return string
|
||||
*/
|
||||
public function url(string $name, bool $safe = false, $attname = null): string
|
||||
public function url(string $name, bool $safe = false, ?string $attname = null): string
|
||||
{
|
||||
return "{$this->prefix}/{$this->delSuffix($name)}{$this->getSuffix($attname)}";
|
||||
}
|
||||
@ -158,7 +158,7 @@ class QiniuStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return array
|
||||
*/
|
||||
public function info(string $name, bool $safe = false, $attname = null): array
|
||||
public function info(string $name, bool $safe = false, ?string $attname = null): array
|
||||
{
|
||||
[$entry, $token] = $this->getAccessToken($name);
|
||||
$data = json_decode(HttpExtend::get("http://rs.qiniu.com/stat/{$entry}", [], ['headers' => ["Authorization: QBox {$token}"]]), true);
|
||||
@ -173,7 +173,7 @@ class QiniuStorage extends Storage
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function upload()
|
||||
public function upload(): string
|
||||
{
|
||||
$protocol = $this->app->request->isSsl() ? 'https' : 'http';
|
||||
switch (sysconf('storage.qiniu_region')) {
|
||||
@ -199,7 +199,7 @@ class QiniuStorage extends Storage
|
||||
* @param null|string $attname 下载名称
|
||||
* @return string
|
||||
*/
|
||||
public function buildUploadToken($name = null, int $expires = 3600, $attname = null)
|
||||
public function buildUploadToken(?string $name = null, int $expires = 3600, ?string $attname = null): string
|
||||
{
|
||||
$policy = $this->safeBase64(json_encode([
|
||||
"deadline" => time() + $expires, "scope" => is_null($name) ? $this->bucket : "{$this->bucket}:{$name}",
|
||||
@ -226,7 +226,7 @@ class QiniuStorage extends Storage
|
||||
* @param string $type 操作类型
|
||||
* @return array
|
||||
*/
|
||||
private function getAccessToken(string $name, $type = 'stat'): array
|
||||
private function getAccessToken(string $name, string $type = 'stat'): array
|
||||
{
|
||||
$entry = $this->safeBase64("{$this->bucket}:{$name}");
|
||||
$sign = hash_hmac('sha1', "/{$type}/{$entry}\n", $this->secretKey, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user