ComposerUpdate & 代码优化

This commit is contained in:
邹景立 2021-06-22 16:51:48 +08:00
parent bec782fd37
commit 435de923ee
7 changed files with 18 additions and 16 deletions

View File

@ -853,12 +853,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "611043ad1974ab0926868bb44b1b2491fee13114" "reference": "f65e5f33f582df4575a34d1f1c058ca413fb17d6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/611043ad1974ab0926868bb44b1b2491fee13114", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/f65e5f33f582df4575a34d1f1c058ca413fb17d6",
"reference": "611043ad1974ab0926868bb44b1b2491fee13114", "reference": "f65e5f33f582df4575a34d1f1c058ca413fb17d6",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -875,7 +875,7 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2021-06-22T07:23:58+00:00", "time": "2021-06-22T08:50:44+00:00",
"default-branch": true, "default-branch": true,
"type": "library", "type": "library",
"extra": { "extra": {

View File

@ -5,7 +5,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '9b4e299239c063b71f431d974c0754fadb9a6624', 'reference' => 'bec782fd37e6ce3da4682b02ccd87e42b7e292d5',
'name' => 'zoujingli/thinkadmin', 'name' => 'zoujingli/thinkadmin',
'dev' => false, 'dev' => false,
), ),
@ -144,7 +144,7 @@
'aliases' => array( 'aliases' => array(
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => '611043ad1974ab0926868bb44b1b2491fee13114', 'reference' => 'f65e5f33f582df4575a34d1f1c058ca413fb17d6',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'zoujingli/thinkadmin' => array( 'zoujingli/thinkadmin' => array(
@ -153,7 +153,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '9b4e299239c063b71f431d974c0754fadb9a6624', 'reference' => 'bec782fd37e6ce3da4682b02ccd87e42b7e292d5',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'zoujingli/wechat-developer' => array( 'zoujingli/wechat-developer' => array(

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2021-06-22 15:29:50 // This file is automatically generated at:2021-06-22 16:51:18
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\admin\\Library', 0 => 'think\\admin\\Library',

View File

@ -107,11 +107,11 @@ class Install extends Command
$this->rules = array_merge($this->rules, $bind['rules']); $this->rules = array_merge($this->rules, $bind['rules']);
$this->ignore = array_merge($this->ignore, $bind['ignore']); $this->ignore = array_merge($this->ignore, $bind['ignore']);
} }
[$this->installFile(), $this->installData()]; $this->installFile() && $this->installData();
} elseif (isset($this->bind[$this->name])) { } elseif (isset($this->bind[$this->name])) {
$this->rules = $this->bind[$this->name]['rules'] ?? []; $this->rules = $this->bind[$this->name]['rules'] ?? [];
$this->ignore = $this->bind[$this->name]['ignore'] ?? []; $this->ignore = $this->bind[$this->name]['ignore'] ?? [];
[$this->installFile(), $this->installData()]; $this->installFile() && $this->installData();
} else { } else {
$this->output->writeln("The specified module {$this->name} is not configured with install rules"); $this->output->writeln("The specified module {$this->name} is not configured with install rules");
} }

View File

@ -273,6 +273,7 @@ if (!function_exists('data_save')) {
* @throws DataNotFoundException * @throws DataNotFoundException
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
* @throws \think\admin\Exception
*/ */
function data_save($dbQuery, array $data, string $key = 'id', array $where = []) function data_save($dbQuery, array $data, string $key = 'id', array $where = [])
{ {

View File

@ -40,7 +40,7 @@ class CaptchaService extends Service
* @param array $config * @param array $config
* @return static * @return static
*/ */
public function initialize(array $config = []) public function initialize(array $config = []): CaptchaService
{ {
// 动态配置属性 // 动态配置属性
foreach ($config as $k => $v) if (isset($this->$k)) $this->$k = $v; foreach ($config as $k => $v) if (isset($this->$k)) $this->$k = $v;
@ -64,7 +64,7 @@ class CaptchaService extends Service
* @param array $config * @param array $config
* @return $this * @return $this
*/ */
public function config(array $config = []) public function config(array $config = []): CaptchaService
{ {
return $this->initialize($config); return $this->initialize($config);
} }
@ -140,7 +140,7 @@ class CaptchaService extends Service
* 创建验证码图片 * 创建验证码图片
* @return string * @return string
*/ */
private function createImage() private function createImage(): string
{ {
// 生成背景 // 生成背景
$img = imagecreatetruecolor($this->width, $this->height); $img = imagecreatetruecolor($this->width, $this->height);

View File

@ -115,12 +115,13 @@ class SystemService extends Service
* @throws DataNotFoundException * @throws DataNotFoundException
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
* @throws \think\admin\Exception
*/ */
public function save($query, array $data, string $key = 'id', array $map = []) public function save($query, array $data, string $key = 'id', array $map = [])
{ {
if ($query instanceof Model) $query = $query->db(); $query = is_string($query) ? $this->app->db->name($query) : ($query instanceof Model ? $query->db() : $query);
if (is_string($query)) $query = $this->app->db->name($query); if (!$query instanceof Query) throw new \think\admin\Exception('数据库操作对象异常!');
[$query, $value] = [$query->master()->strict(false)->where($map), $data[$key] ?? null]; [$value] = [$data[$key] ?? null, $query->master()->strict(false)->where($map)];
if (empty($map[$key])) if (is_string($value) && strpos($value, ',') !== false) { if (empty($map[$key])) if (is_string($value) && strpos($value, ',') !== false) {
$query->whereIn($key, str2arr($value)); $query->whereIn($key, str2arr($value));
} else { } else {