ComposerUpdate

This commit is contained in:
Anyon 2020-08-14 13:37:52 +08:00
parent 16fbb00515
commit bc0554bca4
6 changed files with 66 additions and 73 deletions

18
composer.lock generated
View File

@ -74,16 +74,16 @@
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.1.0", "version": "1.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "481c0174b9c99b189959e2bb9d6f52188ed1f692" "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/481c0174b9c99b189959e2bb9d6f52188ed1f692", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/6e96f54d82e71f71c4108da33ee96a7f57083710",
"reference": "481c0174b9c99b189959e2bb9d6f52188ed1f692", "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -167,7 +167,7 @@
"type": "other" "type": "other"
} }
], ],
"time": "2020-08-09T15:57:10+00:00" "time": "2020-08-12T14:23:41+00:00"
}, },
{ {
"name": "league/flysystem-cached-adapter", "name": "league/flysystem-cached-adapter",
@ -937,12 +937,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "947f3bbdf949e1d341258f778ea0ad91153350a7" "reference": "032fd6e5bd304a2fd7e8d964c2e125db55d4e9db"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/947f3bbdf949e1d341258f778ea0ad91153350a7", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/032fd6e5bd304a2fd7e8d964c2e125db55d4e9db",
"reference": "947f3bbdf949e1d341258f778ea0ad91153350a7", "reference": "032fd6e5bd304a2fd7e8d964c2e125db55d4e9db",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -986,7 +986,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://thinkadmin.top", "homepage": "http://thinkadmin.top",
"time": "2020-08-12T03:01:11+00:00" "time": "2020-08-14T05:29:39+00:00"
}, },
{ {
"name": "zoujingli/wechat-developer", "name": "zoujingli/wechat-developer",

View File

@ -69,17 +69,17 @@
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.1.0", "version": "1.1.1",
"version_normalized": "1.1.0.0", "version_normalized": "1.1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "481c0174b9c99b189959e2bb9d6f52188ed1f692" "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/481c0174b9c99b189959e2bb9d6f52188ed1f692", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/6e96f54d82e71f71c4108da33ee96a7f57083710",
"reference": "481c0174b9c99b189959e2bb9d6f52188ed1f692", "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -116,7 +116,7 @@
"spatie/flysystem-dropbox": "Allows you to use Dropbox storage", "spatie/flysystem-dropbox": "Allows you to use Dropbox storage",
"srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications"
}, },
"time": "2020-08-09T15:57:10+00:00", "time": "2020-08-12T14:23:41+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -963,12 +963,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "947f3bbdf949e1d341258f778ea0ad91153350a7" "reference": "032fd6e5bd304a2fd7e8d964c2e125db55d4e9db"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/947f3bbdf949e1d341258f778ea0ad91153350a7", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/032fd6e5bd304a2fd7e8d964c2e125db55d4e9db",
"reference": "947f3bbdf949e1d341258f778ea0ad91153350a7", "reference": "032fd6e5bd304a2fd7e8d964c2e125db55d4e9db",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -984,7 +984,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-08-12T03:01:11+00:00", "time": "2020-08-14T05:29:39+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

View File

@ -67,7 +67,7 @@ class MimeType
*/ */
public static function detectByFilename($filename) public static function detectByFilename($filename)
{ {
return static::detector()->detectMimeTypeFromPath($filename); return static::detector()->detectMimeTypeFromPath($filename) ?: 'text/plain';
} }
/** /**

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-08-12 14:26:09 // This file is automatically generated at:2020-08-14 13:37:19
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\admin\\Library', 0 => 'think\\admin\\Library',

View File

@ -26,7 +26,7 @@ class ProcessService extends Service
{ {
/** /**
* 创建并获取Think指令内容 * 获取 Think 指令内容
* @param string $args 指定参数 * @param string $args 指定参数
* @return string * @return string
*/ */
@ -55,7 +55,7 @@ class ProcessService extends Service
if ($this->iswin()) { if ($this->iswin()) {
$this->exec(__DIR__ . "/bin/console.exe {$command}"); $this->exec(__DIR__ . "/bin/console.exe {$command}");
} else { } else {
$this->exec("{$command} > /dev/null &"); $this->exec("{$command} > /dev/null 2>&1 &");
} }
return $this; return $this;
} }
@ -78,7 +78,7 @@ class ProcessService extends Service
$lines = $this->exec("ps ax|grep -v grep|grep \"{$command}\"", true); $lines = $this->exec("ps ax|grep -v grep|grep \"{$command}\"", true);
foreach ($lines as $line) if ($this->_issub($line, $command) !== false) { foreach ($lines as $line) if ($this->_issub($line, $command) !== false) {
$attr = explode(' ', $this->_space($line)); $attr = explode(' ', $this->_space($line));
list($pid) = [array_shift($attr), array_shift($attr), array_shift($attr), array_shift($attr)]; [$pid] = [array_shift($attr), array_shift($attr), array_shift($attr), array_shift($attr)];
$list[] = ['pid' => $pid, 'cmd' => join(' ', $attr)]; $list[] = ['pid' => $pid, 'cmd' => join(' ', $attr)];
} }
} }

View File

@ -32,88 +32,81 @@ class SystemService extends Service
*/ */
protected $data = []; protected $data = [];
/**
* 绑定配置数据表
* @var string
*/
protected $table = 'SystemConfig';
/** /**
* 设置配置数据 * 设置配置数据
* @param string $name 配置名称 * @param string $name 配置名称
* @param string $value 配置内容 * @param string $value 配置内容
* @return static * @return integer
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function set($name, $value = '') public function set($name, $value = '')
{ {
[$type, $field] = $this->parse($name); [$this->data, $count] = [[], 0];
[$type, $field] = $this->parse($name, 'base');
if (is_array($value)) { if (is_array($value)) {
foreach ($value as $k => $v) $this->set("{$field}.{$k}", $v); foreach ($value as $kk => $vv) $count += $this->set("{$field}.{$kk}", $vv);
return $count;
} else { } else {
$this->data = []; $this->app->cache->delete($this->table);
$data = ['name' => $field, 'value' => $value, 'type' => $type]; $data = ['type' => $type, 'name' => $field, 'value' => $value];
$this->save('SystemConfig', $data, 'name', ['type' => $type]); $query = $this->app->db->name($this->table)->where(['type' => $type, 'name' => $name]);
return (clone $query)->count() > 0 ? $query->update($data) : $query->insert($data);
} }
return $this;
} }
/** /**
* 读取配置数据 * 读取配置数据
* @param string $name * @param string $name
* @param string $default
* @return array|mixed|string * @return array|mixed|string
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function get($name) public function get($name = '', $default = '')
{ {
[$type, $field, $outer] = $this->parse($name); [$type, $field, $outer] = $this->parse($name, 'base');
if (empty($this->data)) foreach ($this->app->db->name('SystemConfig')->select() as $vo) { if (empty($this->data)) $this->app->db->name($this->table)->cache($this->table)->select()->map(function ($item) {
$this->data[$vo['type']][$vo['name']] = $vo['value']; $this->data[$item['type']][$item['name']] = $item['value'];
} });
if (empty($name)) { if (empty($name)) {
return empty($this->data[$type]) ? [] : ($outer === 'raw' ? $this->data[$type] : array_map(function ($value) { return $this->data;
return htmlspecialchars($value); } elseif (isset($this->data[$type])) {
}, $this->data[$type])); $group = $this->data[$type];
} else { if ($outer !== 'raw') foreach ($group as $kk => $vo) {
if (isset($this->data[$type])) { $group[$kk] = htmlspecialchars($vo);
if ($field) {
if (isset($this->data[$type][$field])) {
return $outer === 'raw' ? $this->data[$type][$field] : htmlspecialchars($this->data[$type][$field]);
}
} else {
if ($outer === 'raw') foreach ($this->data[$type] as $key => $vo) {
$this->data[$type][$key] = htmlspecialchars($vo);
}
return $this->data[$type];
}
} }
return ''; return $field ? ($group[$field] ?? $default) : $group;
} else {
return $default;
} }
} }
/** /**
* 数据增量保存 * 数据增量保存
* @param Query|string $dbQuery 数据查询对象 * @param Query|string $dbQuery 数据查询对象
* @param array $data 需要保存或更新的数据 * @param array $data 需要保存的数据
* @param string $key 条件主键限制 * @param string $key 更新条件查询主键
* @param array $where 其它的where条件 * @param array $where 额外更新查询条件
* @return boolean|integer * @return boolean|integer 失败返回 false, 成功返回主键值或 true
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function save($dbQuery, $data, $key = 'id', $where = []) public function save($dbQuery, $data, $key = 'id', array $where = [])
{ {
$db = is_string($dbQuery) ? $this->app->db->name($dbQuery) : $dbQuery; $val = $data[$key] ?? null;
[$table, $value] = [$db->getTable(), isset($data[$key]) ? $data[$key] : null]; $query = (is_string($dbQuery) ? $this->app->db->name($dbQuery) : $dbQuery)->master()->strict(false)->where($where);
$map = isset($where[$key]) ? [] : (is_string($value) ? [[$key, 'in', explode(',', $value)]] : [$key => $value]); if (empty($where[$key])) is_string($val) && strpos($val, ',') !== false ? $query->whereIn($key, explode(',', $val)) : $query->where([$key => $val]);
if (is_array($info = $this->app->db->table($table)->master()->where($where)->where($map)->find()) && !empty($info)) { return is_array($info = (clone $query)->find()) && !empty($info) ? ($query->update($data) !== false ? ($info[$key] ?? true) : false) : $query->insertGetId($data);
if ($this->app->db->table($table)->strict(false)->where($where)->where($map)->update($data) !== false) {
return $info[$key] ?? true;
} else {
return false;
}
} else {
return $this->app->db->table($table)->strict(false)->insertGetId($data);
}
} }
/** /**
@ -125,7 +118,7 @@ class SystemService extends Service
private function parse($rule, $type = 'base') private function parse($rule, $type = 'base')
{ {
if (stripos($rule, '.') !== false) { if (stripos($rule, '.') !== false) {
[$type, $rule] = explode('.', $rule); [$type, $rule] = explode('.', $rule, 2);
} }
[$field, $outer] = explode('|', "{$rule}|"); [$field, $outer] = explode('|', "{$rule}|");
return [$type, $field, strtolower($outer)]; return [$type, $field, strtolower($outer)];
@ -198,12 +191,13 @@ class SystemService extends Service
* @param mixed $data 输出的数据 * @param mixed $data 输出的数据
* @param boolean $new 强制替换文件 * @param boolean $new 强制替换文件
* @param string|null $file 文件名称 * @param string|null $file 文件名称
* @return false|int
*/ */
public function putDebug($data, $new = false, $file = null) public function putDebug($data, $new = false, $file = null)
{ {
if (is_null($file)) $file = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . date('Ymd') . '.log'; if (is_null($file)) $file = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . date('Ymd') . '.log';
$str = (is_string($data) ? $data : ((is_array($data) || is_object($data)) ? print_r($data, true) : var_export($data, true))) . PHP_EOL; $str = (is_string($data) ? $data : ((is_array($data) || is_object($data)) ? print_r($data, true) : var_export($data, true))) . PHP_EOL;
$new ? file_put_contents($file, $str) : file_put_contents($file, $str, FILE_APPEND); return $new ? file_put_contents($file, $str) : file_put_contents($file, $str, FILE_APPEND);
} }
/** /**
@ -347,8 +341,7 @@ class SystemService extends Service
public function doInit(\think\App $app): void public function doInit(\think\App $app): void
{ {
$app->debug($this->isDebug()); $app->debug($this->isDebug());
$response = $app->http->run(); ($response = $app->http->run())->send();
$response->send();
$app->http->end($response); $app->http->end($response);
} }
} }