diff --git a/composer.lock b/composer.lock index 5d247abbd..81754f960 100644 --- a/composer.lock +++ b/composer.lock @@ -74,16 +74,16 @@ }, { "name": "league/flysystem", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "481c0174b9c99b189959e2bb9d6f52188ed1f692" + "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/481c0174b9c99b189959e2bb9d6f52188ed1f692", - "reference": "481c0174b9c99b189959e2bb9d6f52188ed1f692", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/6e96f54d82e71f71c4108da33ee96a7f57083710", + "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710", "shasum": "", "mirrors": [ { @@ -167,7 +167,7 @@ "type": "other" } ], - "time": "2020-08-09T15:57:10+00:00" + "time": "2020-08-12T14:23:41+00:00" }, { "name": "league/flysystem-cached-adapter", @@ -937,12 +937,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "947f3bbdf949e1d341258f778ea0ad91153350a7" + "reference": "032fd6e5bd304a2fd7e8d964c2e125db55d4e9db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/947f3bbdf949e1d341258f778ea0ad91153350a7", - "reference": "947f3bbdf949e1d341258f778ea0ad91153350a7", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/032fd6e5bd304a2fd7e8d964c2e125db55d4e9db", + "reference": "032fd6e5bd304a2fd7e8d964c2e125db55d4e9db", "shasum": "", "mirrors": [ { @@ -986,7 +986,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://thinkadmin.top", - "time": "2020-08-12T03:01:11+00:00" + "time": "2020-08-14T05:29:39+00:00" }, { "name": "zoujingli/wechat-developer", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 94b77ffd8..d36d4b781 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -69,17 +69,17 @@ }, { "name": "league/flysystem", - "version": "1.1.0", - "version_normalized": "1.1.0.0", + "version": "1.1.1", + "version_normalized": "1.1.1.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "481c0174b9c99b189959e2bb9d6f52188ed1f692" + "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/481c0174b9c99b189959e2bb9d6f52188ed1f692", - "reference": "481c0174b9c99b189959e2bb9d6f52188ed1f692", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/6e96f54d82e71f71c4108da33ee96a7f57083710", + "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710", "shasum": "", "mirrors": [ { @@ -116,7 +116,7 @@ "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", "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", "extra": { "branch-alias": { @@ -963,12 +963,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "947f3bbdf949e1d341258f778ea0ad91153350a7" + "reference": "032fd6e5bd304a2fd7e8d964c2e125db55d4e9db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/947f3bbdf949e1d341258f778ea0ad91153350a7", - "reference": "947f3bbdf949e1d341258f778ea0ad91153350a7", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/032fd6e5bd304a2fd7e8d964c2e125db55d4e9db", + "reference": "032fd6e5bd304a2fd7e8d964c2e125db55d4e9db", "shasum": "", "mirrors": [ { @@ -984,7 +984,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2020-08-12T03:01:11+00:00", + "time": "2020-08-14T05:29:39+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/league/flysystem/src/Util/MimeType.php b/vendor/league/flysystem/src/Util/MimeType.php index 73f8d3838..45060218a 100644 --- a/vendor/league/flysystem/src/Util/MimeType.php +++ b/vendor/league/flysystem/src/Util/MimeType.php @@ -67,7 +67,7 @@ class MimeType */ public static function detectByFilename($filename) { - return static::detector()->detectMimeTypeFromPath($filename); + return static::detector()->detectMimeTypeFromPath($filename) ?: 'text/plain'; } /** diff --git a/vendor/services.php b/vendor/services.php index 73f5a2178..01876e882 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\admin\\Library', diff --git a/vendor/zoujingli/think-library/src/service/ProcessService.php b/vendor/zoujingli/think-library/src/service/ProcessService.php index 2d3f6024f..c32cad002 100644 --- a/vendor/zoujingli/think-library/src/service/ProcessService.php +++ b/vendor/zoujingli/think-library/src/service/ProcessService.php @@ -26,7 +26,7 @@ class ProcessService extends Service { /** - * 创建并获取Think指令内容 + * 获取 Think 指令内容 * @param string $args 指定参数 * @return string */ @@ -55,7 +55,7 @@ class ProcessService extends Service if ($this->iswin()) { $this->exec(__DIR__ . "/bin/console.exe {$command}"); } else { - $this->exec("{$command} > /dev/null &"); + $this->exec("{$command} > /dev/null 2>&1 &"); } return $this; } @@ -78,7 +78,7 @@ class ProcessService extends Service $lines = $this->exec("ps ax|grep -v grep|grep \"{$command}\"", true); foreach ($lines as $line) if ($this->_issub($line, $command) !== false) { $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)]; } } diff --git a/vendor/zoujingli/think-library/src/service/SystemService.php b/vendor/zoujingli/think-library/src/service/SystemService.php index 8347155d0..39124507a 100644 --- a/vendor/zoujingli/think-library/src/service/SystemService.php +++ b/vendor/zoujingli/think-library/src/service/SystemService.php @@ -32,88 +32,81 @@ class SystemService extends Service */ protected $data = []; + /** + * 绑定配置数据表 + * @var string + */ + protected $table = 'SystemConfig'; + /** * 设置配置数据 * @param string $name 配置名称 * @param string $value 配置内容 - * @return static + * @return integer * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function set($name, $value = '') { - [$type, $field] = $this->parse($name); + [$this->data, $count] = [[], 0]; + [$type, $field] = $this->parse($name, 'base'); 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 { - $this->data = []; - $data = ['name' => $field, 'value' => $value, 'type' => $type]; - $this->save('SystemConfig', $data, 'name', ['type' => $type]); + $this->app->cache->delete($this->table); + $data = ['type' => $type, 'name' => $field, 'value' => $value]; + $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 $default * @return array|mixed|string * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function get($name) + public function get($name = '', $default = '') { - [$type, $field, $outer] = $this->parse($name); - if (empty($this->data)) foreach ($this->app->db->name('SystemConfig')->select() as $vo) { - $this->data[$vo['type']][$vo['name']] = $vo['value']; - } + [$type, $field, $outer] = $this->parse($name, 'base'); + if (empty($this->data)) $this->app->db->name($this->table)->cache($this->table)->select()->map(function ($item) { + $this->data[$item['type']][$item['name']] = $item['value']; + }); if (empty($name)) { - return empty($this->data[$type]) ? [] : ($outer === 'raw' ? $this->data[$type] : array_map(function ($value) { - return htmlspecialchars($value); - }, $this->data[$type])); - } else { - if (isset($this->data[$type])) { - 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 $this->data; + } elseif (isset($this->data[$type])) { + $group = $this->data[$type]; + if ($outer !== 'raw') foreach ($group as $kk => $vo) { + $group[$kk] = htmlspecialchars($vo); } - return ''; + return $field ? ($group[$field] ?? $default) : $group; + } else { + return $default; } } /** * 数据增量保存 * @param Query|string $dbQuery 数据查询对象 - * @param array $data 需要保存或更新的数据 - * @param string $key 条件主键限制 - * @param array $where 其它的where条件 - * @return boolean|integer + * @param array $data 需要保存的数据 + * @param string $key 更新条件查询主键 + * @param array $where 额外更新查询条件 + * @return boolean|integer 失败返回 false, 成功返回主键值或 true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @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; - [$table, $value] = [$db->getTable(), isset($data[$key]) ? $data[$key] : null]; - $map = isset($where[$key]) ? [] : (is_string($value) ? [[$key, 'in', explode(',', $value)]] : [$key => $value]); - if (is_array($info = $this->app->db->table($table)->master()->where($where)->where($map)->find()) && !empty($info)) { - 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); - } + $val = $data[$key] ?? null; + $query = (is_string($dbQuery) ? $this->app->db->name($dbQuery) : $dbQuery)->master()->strict(false)->where($where); + if (empty($where[$key])) is_string($val) && strpos($val, ',') !== false ? $query->whereIn($key, explode(',', $val)) : $query->where([$key => $val]); + return is_array($info = (clone $query)->find()) && !empty($info) ? ($query->update($data) !== false ? ($info[$key] ?? true) : false) : $query->insertGetId($data); } /** @@ -125,7 +118,7 @@ class SystemService extends Service private function parse($rule, $type = 'base') { if (stripos($rule, '.') !== false) { - [$type, $rule] = explode('.', $rule); + [$type, $rule] = explode('.', $rule, 2); } [$field, $outer] = explode('|', "{$rule}|"); return [$type, $field, strtolower($outer)]; @@ -198,12 +191,13 @@ class SystemService extends Service * @param mixed $data 输出的数据 * @param boolean $new 强制替换文件 * @param string|null $file 文件名称 + * @return false|int */ public function putDebug($data, $new = false, $file = null) { 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; - $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 { $app->debug($this->isDebug()); - $response = $app->http->run(); - $response->send(); + ($response = $app->http->run())->send(); $app->http->end($response); } } \ No newline at end of file