mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
ComposerUpdate
This commit is contained in:
parent
21235ae70b
commit
c5e5648781
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -449,6 +449,7 @@ return array(
|
|||||||
'think\\event\\AppInit' => $vendorDir . '/topthink/framework/src/think/event/AppInit.php',
|
'think\\event\\AppInit' => $vendorDir . '/topthink/framework/src/think/event/AppInit.php',
|
||||||
'think\\event\\HttpEnd' => $vendorDir . '/topthink/framework/src/think/event/HttpEnd.php',
|
'think\\event\\HttpEnd' => $vendorDir . '/topthink/framework/src/think/event/HttpEnd.php',
|
||||||
'think\\event\\HttpRun' => $vendorDir . '/topthink/framework/src/think/event/HttpRun.php',
|
'think\\event\\HttpRun' => $vendorDir . '/topthink/framework/src/think/event/HttpRun.php',
|
||||||
|
'think\\event\\LogRecord' => $vendorDir . '/topthink/framework/src/think/event/LogRecord.php',
|
||||||
'think\\event\\LogWrite' => $vendorDir . '/topthink/framework/src/think/event/LogWrite.php',
|
'think\\event\\LogWrite' => $vendorDir . '/topthink/framework/src/think/event/LogWrite.php',
|
||||||
'think\\event\\RouteLoaded' => $vendorDir . '/topthink/framework/src/think/event/RouteLoaded.php',
|
'think\\event\\RouteLoaded' => $vendorDir . '/topthink/framework/src/think/event/RouteLoaded.php',
|
||||||
'think\\exception\\ClassNotFoundException' => $vendorDir . '/topthink/framework/src/think/exception/ClassNotFoundException.php',
|
'think\\exception\\ClassNotFoundException' => $vendorDir . '/topthink/framework/src/think/exception/ClassNotFoundException.php',
|
||||||
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
@ -578,6 +578,7 @@ class ComposerStaticInit3e3e984682c06e656fe76c5d84347fb3
|
|||||||
'think\\event\\AppInit' => __DIR__ . '/..' . '/topthink/framework/src/think/event/AppInit.php',
|
'think\\event\\AppInit' => __DIR__ . '/..' . '/topthink/framework/src/think/event/AppInit.php',
|
||||||
'think\\event\\HttpEnd' => __DIR__ . '/..' . '/topthink/framework/src/think/event/HttpEnd.php',
|
'think\\event\\HttpEnd' => __DIR__ . '/..' . '/topthink/framework/src/think/event/HttpEnd.php',
|
||||||
'think\\event\\HttpRun' => __DIR__ . '/..' . '/topthink/framework/src/think/event/HttpRun.php',
|
'think\\event\\HttpRun' => __DIR__ . '/..' . '/topthink/framework/src/think/event/HttpRun.php',
|
||||||
|
'think\\event\\LogRecord' => __DIR__ . '/..' . '/topthink/framework/src/think/event/LogRecord.php',
|
||||||
'think\\event\\LogWrite' => __DIR__ . '/..' . '/topthink/framework/src/think/event/LogWrite.php',
|
'think\\event\\LogWrite' => __DIR__ . '/..' . '/topthink/framework/src/think/event/LogWrite.php',
|
||||||
'think\\event\\RouteLoaded' => __DIR__ . '/..' . '/topthink/framework/src/think/event/RouteLoaded.php',
|
'think\\event\\RouteLoaded' => __DIR__ . '/..' . '/topthink/framework/src/think/event/RouteLoaded.php',
|
||||||
'think\\exception\\ClassNotFoundException' => __DIR__ . '/..' . '/topthink/framework/src/think/exception/ClassNotFoundException.php',
|
'think\\exception\\ClassNotFoundException' => __DIR__ . '/..' . '/topthink/framework/src/think/exception/ClassNotFoundException.php',
|
||||||
|
32
vendor/composer/installed.json
vendored
32
vendor/composer/installed.json
vendored
@ -515,17 +515,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "topthink/framework",
|
"name": "topthink/framework",
|
||||||
"version": "v6.0.7",
|
"version": "v6.0.8",
|
||||||
"version_normalized": "6.0.7.0",
|
"version_normalized": "6.0.8.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/top-think/framework.git",
|
"url": "https://github.com/top-think/framework.git",
|
||||||
"reference": "db8fe22520a9660dd5e4c87e304034ac49e39270"
|
"reference": "4789343672aef06d571d556da369c0e156609bce"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/top-think/framework/zipball/db8fe22520a9660dd5e4c87e304034ac49e39270",
|
"url": "https://api.github.com/repos/top-think/framework/zipball/4789343672aef06d571d556da369c0e156609bce",
|
||||||
"reference": "db8fe22520a9660dd5e4c87e304034ac49e39270",
|
"reference": "4789343672aef06d571d556da369c0e156609bce",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -551,7 +551,7 @@
|
|||||||
"mockery/mockery": "^1.2",
|
"mockery/mockery": "^1.2",
|
||||||
"phpunit/phpunit": "^7.0"
|
"phpunit/phpunit": "^7.0"
|
||||||
},
|
},
|
||||||
"time": "2021-01-25T14:48:29+00:00",
|
"time": "2021-04-27T00:41:08+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -631,17 +631,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "topthink/think-orm",
|
"name": "topthink/think-orm",
|
||||||
"version": "v2.0.39",
|
"version": "v2.0.40",
|
||||||
"version_normalized": "2.0.39.0",
|
"version_normalized": "2.0.40.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/top-think/think-orm.git",
|
"url": "https://github.com/top-think/think-orm.git",
|
||||||
"reference": "39a9d0a0e52d9b8bad9d98484d8484cdf5b683a7"
|
"reference": "1119d979b850849f3725856460cf108eec1c3eb8"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/39a9d0a0e52d9b8bad9d98484d8484cdf5b683a7",
|
"url": "https://api.github.com/repos/top-think/think-orm/zipball/1119d979b850849f3725856460cf108eec1c3eb8",
|
||||||
"reference": "39a9d0a0e52d9b8bad9d98484d8484cdf5b683a7",
|
"reference": "1119d979b850849f3725856460cf108eec1c3eb8",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -661,7 +661,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^7|^8|^9.5"
|
"phpunit/phpunit": "^7|^8|^9.5"
|
||||||
},
|
},
|
||||||
"time": "2021-02-26T10:20:00+00:00",
|
"time": "2021-04-19T13:29:37+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -834,12 +834,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||||
"reference": "c4bfb714326a86598fe14a085be4b5439f656c77"
|
"reference": "361caa1f19e990422b0ca089b44961666861e28d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/c4bfb714326a86598fe14a085be4b5439f656c77",
|
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/361caa1f19e990422b0ca089b44961666861e28d",
|
||||||
"reference": "c4bfb714326a86598fe14a085be4b5439f656c77",
|
"reference": "361caa1f19e990422b0ca089b44961666861e28d",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -856,7 +856,7 @@
|
|||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"topthink/framework": "^6.0"
|
"topthink/framework": "^6.0"
|
||||||
},
|
},
|
||||||
"time": "2021-04-08T06:20:57+00:00",
|
"time": "2021-04-26T09:07:36+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"think": {
|
"think": {
|
||||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// This file is automatically generated at:2021-04-22 09:44:32
|
// This file is automatically generated at:2021-04-28 13:59:52
|
||||||
declare (strict_types = 1);
|
declare (strict_types = 1);
|
||||||
return array (
|
return array (
|
||||||
0 => 'think\\admin\\Library',
|
0 => 'think\\admin\\Library',
|
||||||
|
43
vendor/topthink/framework/src/think/App.php
vendored
43
vendor/topthink/framework/src/think/App.php
vendored
@ -39,7 +39,7 @@ use think\initializer\RegisterService;
|
|||||||
*/
|
*/
|
||||||
class App extends Container
|
class App extends Container
|
||||||
{
|
{
|
||||||
const VERSION = '6.0.7';
|
const VERSION = '6.0.8';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用调试模式
|
* 应用调试模式
|
||||||
@ -47,6 +47,12 @@ class App extends Container
|
|||||||
*/
|
*/
|
||||||
protected $appDebug = false;
|
protected $appDebug = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 环境变量标识
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $envName = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用开始时间
|
* 应用开始时间
|
||||||
* @var float
|
* @var float
|
||||||
@ -277,6 +283,18 @@ class App extends Container
|
|||||||
return $this->namespace;
|
return $this->namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置环境变量标识
|
||||||
|
* @access public
|
||||||
|
* @param string $name 环境标识
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setEnvName(string $name)
|
||||||
|
{
|
||||||
|
$this->envName = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取框架版本
|
* 获取框架版本
|
||||||
* @access public
|
* @access public
|
||||||
@ -395,6 +413,22 @@ class App extends Container
|
|||||||
return $this->beginMem;
|
return $this->beginMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载环境变量定义
|
||||||
|
* @access public
|
||||||
|
* @param string $envName 环境标识
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function loadEnv(string $envName = ''): void
|
||||||
|
{
|
||||||
|
// 加载环境变量
|
||||||
|
$envFile = $envName ? $this->rootPath . '.env.' . $envName : $this->rootPath . '.env';
|
||||||
|
|
||||||
|
if (is_file($envFile)) {
|
||||||
|
$this->env->load($envFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化应用
|
* 初始化应用
|
||||||
* @access public
|
* @access public
|
||||||
@ -407,10 +441,7 @@ class App extends Container
|
|||||||
$this->beginTime = microtime(true);
|
$this->beginTime = microtime(true);
|
||||||
$this->beginMem = memory_get_usage();
|
$this->beginMem = memory_get_usage();
|
||||||
|
|
||||||
// 加载环境变量
|
$this->loadEnv($this->envName);
|
||||||
if (is_file($this->rootPath . '.env')) {
|
|
||||||
$this->env->load($this->rootPath . '.env');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->configExt = $this->env->get('config_ext', '.php');
|
$this->configExt = $this->env->get('config_ext', '.php');
|
||||||
|
|
||||||
@ -590,7 +621,7 @@ class App extends Container
|
|||||||
* 是否运行在命令行下
|
* 是否运行在命令行下
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function runningInConsole()
|
public function runningInConsole(): bool
|
||||||
{
|
{
|
||||||
return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg';
|
return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg';
|
||||||
}
|
}
|
||||||
|
18
vendor/topthink/framework/src/think/Request.php
vendored
18
vendor/topthink/framework/src/think/Request.php
vendored
@ -869,6 +869,24 @@ class Request implements ArrayAccess
|
|||||||
return $this->input($this->param, $name, $default, $filter);
|
return $this->input($this->param, $name, $default, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取包含文件在内的请求参数
|
||||||
|
* @access public
|
||||||
|
* @param string|array $name 变量名
|
||||||
|
* @param string|array $filter 过滤方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function all($name = '', $filter = '')
|
||||||
|
{
|
||||||
|
$data = array_merge($this->param(), $this->file());
|
||||||
|
|
||||||
|
if (is_array($name)) {
|
||||||
|
$data = $this->only($name, $data, $filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置路由变量
|
* 设置路由变量
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -214,7 +214,7 @@ abstract class Response
|
|||||||
/**
|
/**
|
||||||
* 是否允许请求缓存
|
* 是否允许请求缓存
|
||||||
* @access public
|
* @access public
|
||||||
* @return $this
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isAllowCache()
|
public function isAllowCache()
|
||||||
{
|
{
|
||||||
|
@ -1591,7 +1591,7 @@ class Validate
|
|||||||
* @param string $msg 错误信息
|
* @param string $msg 错误信息
|
||||||
* @param mixed $rule 验证规则数据
|
* @param mixed $rule 验证规则数据
|
||||||
* @param string $title 字段描述名
|
* @param string $title 字段描述名
|
||||||
* @return string
|
* @return string|array
|
||||||
*/
|
*/
|
||||||
protected function parseErrorMsg(string $msg, $rule, string $title)
|
protected function parseErrorMsg(string $msg, $rule, string $title)
|
||||||
{
|
{
|
||||||
|
@ -13,14 +13,37 @@ namespace think\console\input;
|
|||||||
|
|
||||||
class Argument
|
class Argument
|
||||||
{
|
{
|
||||||
|
// 必传参数
|
||||||
const REQUIRED = 1;
|
const REQUIRED = 1;
|
||||||
|
|
||||||
|
// 可选参数
|
||||||
const OPTIONAL = 2;
|
const OPTIONAL = 2;
|
||||||
|
|
||||||
|
// 数组参数
|
||||||
const IS_ARRAY = 4;
|
const IS_ARRAY = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数名
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数类型
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
private $mode;
|
private $mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数默认值
|
||||||
|
* @var mixed
|
||||||
|
*/
|
||||||
private $default;
|
private $default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数描述
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
private $description;
|
private $description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
29
vendor/topthink/framework/src/think/event/LogRecord.php
vendored
Normal file
29
vendor/topthink/framework/src/think/event/LogRecord.php
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: yunwuxin <448901948@qq.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
namespace think\event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LogRecord事件类
|
||||||
|
*/
|
||||||
|
class LogRecord
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
public $type;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
public $message;
|
||||||
|
|
||||||
|
public function __construct($type, $message)
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
$this->message = $message;
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@ namespace think\log;
|
|||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use think\contract\LogHandlerInterface;
|
use think\contract\LogHandlerInterface;
|
||||||
use think\Event;
|
use think\Event;
|
||||||
|
use think\event\LogRecord;
|
||||||
use think\event\LogWrite;
|
use think\event\LogWrite;
|
||||||
|
|
||||||
class Channel implements LoggerInterface
|
class Channel implements LoggerInterface
|
||||||
@ -94,6 +95,9 @@ class Channel implements LoggerInterface
|
|||||||
|
|
||||||
if (!empty($msg) || 0 === $msg) {
|
if (!empty($msg) || 0 === $msg) {
|
||||||
$this->log[$type][] = $msg;
|
$this->log[$type][] = $msg;
|
||||||
|
if ($this->event) {
|
||||||
|
$this->event->trigger(new LogRecord($type, $msg));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->lazy || !$lazy) {
|
if (!$this->lazy || !$lazy) {
|
||||||
|
@ -171,7 +171,9 @@ class RuleGroup extends Rule
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) {
|
if (!empty($option['dispatcher'])) {
|
||||||
|
$result = $this->parseRule($request, '', $option['dispatcher'], $url, $option);
|
||||||
|
} elseif ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) {
|
||||||
// 未匹配所有路由的路由规则处理
|
// 未匹配所有路由的路由规则处理
|
||||||
$result = $this->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->getOption());
|
$result = $this->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->getOption());
|
||||||
} else {
|
} else {
|
||||||
@ -244,6 +246,11 @@ class RuleGroup extends Rule
|
|||||||
*/
|
*/
|
||||||
public function parseGroupRule($rule): void
|
public function parseGroupRule($rule): void
|
||||||
{
|
{
|
||||||
|
if (is_string($rule) && is_subclass_of($rule, Dispatch::class)) {
|
||||||
|
$this->dispatcher($rule);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$origin = $this->router->getGroup();
|
$origin = $this->router->getGroup();
|
||||||
$this->router->setGroup($this);
|
$this->router->setGroup($this);
|
||||||
|
|
||||||
@ -466,6 +473,17 @@ class RuleGroup extends Rule
|
|||||||
return $this->setOption('merge_rule_regex', $merge);
|
return $this->setOption('merge_rule_regex', $merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置分组的Dispatch调度
|
||||||
|
* @access public
|
||||||
|
* @param string $dispatch 调度类
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function dispatcher(string $dispatch)
|
||||||
|
{
|
||||||
|
return $this->setOption('dispatcher', $dispatch);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完整分组Name
|
* 获取完整分组Name
|
||||||
* @access public
|
* @access public
|
||||||
|
12
vendor/topthink/think-orm/src/Model.php
vendored
12
vendor/topthink/think-orm/src/Model.php
vendored
@ -267,7 +267,6 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
|||||||
public function newInstance(array $data = [], $where = null): Model
|
public function newInstance(array $data = [], $where = null): Model
|
||||||
{
|
{
|
||||||
$model = new static($data);
|
$model = new static($data);
|
||||||
$model->readDataType();
|
|
||||||
|
|
||||||
if ($this->connection) {
|
if ($this->connection) {
|
||||||
$model->setConnection($this->connection);
|
$model->setConnection($this->connection);
|
||||||
@ -457,8 +456,6 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
|||||||
$this->data = $this->db()->find($this->getKey())->getData();
|
$this->data = $this->db()->find($this->getKey())->getData();
|
||||||
$this->origin = $this->data;
|
$this->origin = $this->data;
|
||||||
$this->get = [];
|
$this->get = [];
|
||||||
$this->set = [];
|
|
||||||
$this->readDataType();
|
|
||||||
|
|
||||||
if ($relation) {
|
if ($relation) {
|
||||||
$this->relation = [];
|
$this->relation = [];
|
||||||
@ -546,7 +543,7 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
|||||||
|
|
||||||
// 重新记录原始数据
|
// 重新记录原始数据
|
||||||
$this->origin = $this->data;
|
$this->origin = $this->data;
|
||||||
$this->set = [];
|
$this->get = [];
|
||||||
$this->lazySave = false;
|
$this->lazySave = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -613,8 +610,6 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->writeDataType($data);
|
|
||||||
|
|
||||||
if ($this->autoWriteTimestamp && $this->updateTime) {
|
if ($this->autoWriteTimestamp && $this->updateTime) {
|
||||||
// 自动写入更新时间
|
// 自动写入更新时间
|
||||||
$data[$this->updateTime] = $this->autoWriteTimestamp();
|
$data[$this->updateTime] = $this->autoWriteTimestamp();
|
||||||
@ -677,7 +672,7 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->checkData();
|
$this->checkData();
|
||||||
$data = $this->writeDataType($this->data);
|
$data = $this->data;
|
||||||
|
|
||||||
// 时间戳自动写入
|
// 时间戳自动写入
|
||||||
if ($this->autoWriteTimestamp) {
|
if ($this->autoWriteTimestamp) {
|
||||||
@ -709,6 +704,7 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
|||||||
$pk = $this->getPk();
|
$pk = $this->getPk();
|
||||||
|
|
||||||
if (is_string($pk) && (!isset($this->data[$pk]) || '' == $this->data[$pk])) {
|
if (is_string($pk) && (!isset($this->data[$pk]) || '' == $this->data[$pk])) {
|
||||||
|
unset($this->get[$pk]);
|
||||||
$this->data[$pk] = $result;
|
$this->data[$pk] = $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -721,6 +717,7 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
|||||||
|
|
||||||
// 标记数据已经存在
|
// 标记数据已经存在
|
||||||
$this->exists = true;
|
$this->exists = true;
|
||||||
|
$this->origin = $this->data;
|
||||||
|
|
||||||
// 新增回调
|
// 新增回调
|
||||||
$this->trigger('AfterInsert');
|
$this->trigger('AfterInsert');
|
||||||
@ -969,7 +966,6 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
|||||||
{
|
{
|
||||||
unset($this->data[$name],
|
unset($this->data[$name],
|
||||||
$this->get[$name],
|
$this->get[$name],
|
||||||
$this->set[$name],
|
|
||||||
$this->relation[$name]);
|
$this->relation[$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,10 +1163,6 @@ abstract class BaseQuery
|
|||||||
$this->parseView($options);
|
$this->parseView($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($options['field'])) {
|
|
||||||
$options['field'] = '*';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (['data', 'order', 'join', 'union'] as $name) {
|
foreach (['data', 'order', 'join', 'union'] as $name) {
|
||||||
if (!isset($options[$name])) {
|
if (!isset($options[$name])) {
|
||||||
$options[$name] = [];
|
$options[$name] = [];
|
||||||
|
6
vendor/topthink/think-orm/src/db/Builder.php
vendored
6
vendor/topthink/think-orm/src/db/Builder.php
vendored
@ -136,7 +136,7 @@ abstract class Builder
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($fields)) {
|
if (empty($fields)) {
|
||||||
if ('*' == $options['field']) {
|
if (empty($options['field']) || '*' == $options['field']) {
|
||||||
$fields = array_keys($bind);
|
$fields = array_keys($bind);
|
||||||
} else {
|
} else {
|
||||||
$fields = $options['field'];
|
$fields = $options['field'];
|
||||||
@ -1125,7 +1125,7 @@ abstract class Builder
|
|||||||
$this->parseTable($query, $options['table']),
|
$this->parseTable($query, $options['table']),
|
||||||
$this->parseDistinct($query, $options['distinct']),
|
$this->parseDistinct($query, $options['distinct']),
|
||||||
$this->parseExtra($query, $options['extra']),
|
$this->parseExtra($query, $options['extra']),
|
||||||
$this->parseField($query, $options['field']),
|
$this->parseField($query, $options['field'] ?? '*'),
|
||||||
$this->parseJoin($query, $options['join']),
|
$this->parseJoin($query, $options['join']),
|
||||||
$this->parseWhere($query, $options['where']),
|
$this->parseWhere($query, $options['where']),
|
||||||
$this->parseGroup($query, $options['group']),
|
$this->parseGroup($query, $options['group']),
|
||||||
@ -1187,7 +1187,7 @@ abstract class Builder
|
|||||||
$bind = $query->getFieldsBindType();
|
$bind = $query->getFieldsBindType();
|
||||||
|
|
||||||
// 获取合法的字段
|
// 获取合法的字段
|
||||||
if ('*' == $options['field']) {
|
if (empty($options['field']) || '*' == $options['field']) {
|
||||||
$allowFields = array_keys($bind);
|
$allowFields = array_keys($bind);
|
||||||
} else {
|
} else {
|
||||||
$allowFields = $options['field'];
|
$allowFields = $options['field'];
|
||||||
|
@ -290,7 +290,7 @@ abstract class Connection implements ConnectionInterface
|
|||||||
protected function getCacheKey(BaseQuery $query, string $method = ''): string
|
protected function getCacheKey(BaseQuery $query, string $method = ''): string
|
||||||
{
|
{
|
||||||
if (!empty($query->getOptions('key')) && empty($method)) {
|
if (!empty($query->getOptions('key')) && empty($method)) {
|
||||||
$key = 'think:' . $this->getConfig('database') . '.' . $query->getTable() . '|' . $query->getOptions('key');
|
$key = 'think_' . $this->getConfig('database') . '.' . $query->getTable() . '|' . $query->getOptions('key');
|
||||||
} else {
|
} else {
|
||||||
$key = $query->getQueryGuid();
|
$key = $query->getQueryGuid();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class Mysql extends Builder
|
|||||||
$this->parsePartition($query, $options['partition']),
|
$this->parsePartition($query, $options['partition']),
|
||||||
$this->parseDistinct($query, $options['distinct']),
|
$this->parseDistinct($query, $options['distinct']),
|
||||||
$this->parseExtra($query, $options['extra']),
|
$this->parseExtra($query, $options['extra']),
|
||||||
$this->parseField($query, $options['field']),
|
$this->parseField($query, $options['field'] ?? '*'),
|
||||||
$this->parseJoin($query, $options['join']),
|
$this->parseJoin($query, $options['join']),
|
||||||
$this->parseWhere($query, $options['where']),
|
$this->parseWhere($query, $options['where']),
|
||||||
$this->parseGroup($query, $options['group']),
|
$this->parseGroup($query, $options['group']),
|
||||||
@ -155,7 +155,7 @@ class Mysql extends Builder
|
|||||||
$bind = $query->getFieldsBindType();
|
$bind = $query->getFieldsBindType();
|
||||||
|
|
||||||
// 获取合法的字段
|
// 获取合法的字段
|
||||||
if ('*' == $options['field']) {
|
if (empty($options['field']) || '*' == $options['field']) {
|
||||||
$allowFields = array_keys($bind);
|
$allowFields = array_keys($bind);
|
||||||
} else {
|
} else {
|
||||||
$allowFields = $options['field'];
|
$allowFields = $options['field'];
|
||||||
|
@ -100,12 +100,6 @@ trait Attribute
|
|||||||
*/
|
*/
|
||||||
private $get = [];
|
private $get = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改器执行记录
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $set = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态获取器
|
* 动态获取器
|
||||||
* @var array
|
* @var array
|
||||||
@ -363,10 +357,6 @@ trait Attribute
|
|||||||
{
|
{
|
||||||
$name = $this->getRealFieldName($name);
|
$name = $this->getRealFieldName($name);
|
||||||
|
|
||||||
if (isset($this->set[$name])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检测修改器
|
// 检测修改器
|
||||||
$method = 'set' . Str::studly($name) . 'Attr';
|
$method = 'set' . Str::studly($name) . 'Attr';
|
||||||
|
|
||||||
@ -375,10 +365,12 @@ trait Attribute
|
|||||||
|
|
||||||
$value = $this->$method($value, array_merge($this->data, $data));
|
$value = $this->$method($value, array_merge($this->data, $data));
|
||||||
|
|
||||||
$this->set[$name] = true;
|
|
||||||
if (is_null($value) && $array !== $this->data) {
|
if (is_null($value) && $array !== $this->data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} elseif (isset($this->type[$name])) {
|
||||||
|
// 类型转换
|
||||||
|
$value = $this->writeTransform($value, $this->type[$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置数据对象属性
|
// 设置数据对象属性
|
||||||
@ -512,6 +504,11 @@ trait Attribute
|
|||||||
}
|
}
|
||||||
|
|
||||||
$value = $this->$method($value, $this->data);
|
$value = $this->$method($value, $this->data);
|
||||||
|
} elseif (isset($this->type[$fieldName])) {
|
||||||
|
// 类型转换
|
||||||
|
$value = $this->readTransform($value, $this->type[$fieldName]);
|
||||||
|
} elseif ($this->autoWriteTimestamp && in_array($fieldName, [$this->createTime, $this->updateTime])) {
|
||||||
|
$value = $this->getTimestampValue($value);
|
||||||
} elseif ($relation) {
|
} elseif ($relation) {
|
||||||
$value = $this->getRelationValue($relation);
|
$value = $this->getRelationValue($relation);
|
||||||
// 保存关联对象值
|
// 保存关联对象值
|
||||||
@ -523,40 +520,6 @@ trait Attribute
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 读取数据类型处理
|
|
||||||
* @access protected
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function readDataType(): void
|
|
||||||
{
|
|
||||||
foreach ($this->data as $key => $value) {
|
|
||||||
if (isset($this->type[$key])) {
|
|
||||||
$this->get[$key] = $this->readTransform($value, $this->type[$key]);
|
|
||||||
} elseif ($this->autoWriteTimestamp && in_array($key, [$this->createTime, $this->updateTime])) {
|
|
||||||
$this->get[$key] = $this->getTimestampValue($value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 写入数据类型处理
|
|
||||||
* @access protected
|
|
||||||
* @param array $data 数据
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function writeDataType(array $data): array
|
|
||||||
{
|
|
||||||
foreach ($data as $name => &$value) {
|
|
||||||
if (isset($this->type[$name])) {
|
|
||||||
// 类型转换
|
|
||||||
$value = $this->writeTransform($value, $this->type[$name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取JSON字段属性值
|
* 获取JSON字段属性值
|
||||||
* @access protected
|
* @access protected
|
||||||
|
@ -136,7 +136,7 @@ trait RelationShip
|
|||||||
public function relationQuery(array $relations, array $withRelationAttr = []): void
|
public function relationQuery(array $relations, array $withRelationAttr = []): void
|
||||||
{
|
{
|
||||||
foreach ($relations as $key => $relation) {
|
foreach ($relations as $key => $relation) {
|
||||||
$subRelation = '';
|
$subRelation = [];
|
||||||
$closure = null;
|
$closure = null;
|
||||||
|
|
||||||
if ($relation instanceof Closure) {
|
if ($relation instanceof Closure) {
|
||||||
@ -161,7 +161,7 @@ trait RelationShip
|
|||||||
$relationResult->withAttr($withRelationAttr[$relationName]);
|
$relationResult->withAttr($withRelationAttr[$relationName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->relation[$relation] = $relationResult->getRelation($subRelation, $closure);
|
$this->relation[$relation] = $relationResult->getRelation((array) $subRelation, $closure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,19 +810,20 @@ trait RelationShip
|
|||||||
/**
|
/**
|
||||||
* 自动关联数据删除(支持一对一及一对多关联)
|
* 自动关联数据删除(支持一对一及一对多关联)
|
||||||
* @access protected
|
* @access protected
|
||||||
|
* @param bool $force 强制删除
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function autoRelationDelete(): void
|
protected function autoRelationDelete($force = false): void
|
||||||
{
|
{
|
||||||
foreach ($this->relationWrite as $key => $name) {
|
foreach ($this->relationWrite as $key => $name) {
|
||||||
$name = is_numeric($key) ? $name : $key;
|
$name = is_numeric($key) ? $name : $key;
|
||||||
$result = $this->getRelation($name, true);
|
$result = $this->getRelation($name, true);
|
||||||
|
|
||||||
if ($result instanceof Model) {
|
if ($result instanceof Model) {
|
||||||
$result->delete();
|
$result->force($force)->delete();
|
||||||
} elseif ($result instanceof Collection) {
|
} elseif ($result instanceof Collection) {
|
||||||
foreach ($result as $model) {
|
foreach ($result as $model) {
|
||||||
$model->delete();
|
$model->force($force)->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,9 @@ trait SoftDelete
|
|||||||
}
|
}
|
||||||
|
|
||||||
$name = $this->getDeleteTimeField();
|
$name = $this->getDeleteTimeField();
|
||||||
|
$force = $this->isForce();
|
||||||
|
|
||||||
if ($name && !$this->isForce()) {
|
if ($name && !$force) {
|
||||||
// 软删除
|
// 软删除
|
||||||
$this->set($name, $this->autoWriteTimestamp($name));
|
$this->set($name, $this->autoWriteTimestamp($name));
|
||||||
|
|
||||||
@ -131,7 +132,7 @@ trait SoftDelete
|
|||||||
|
|
||||||
// 关联删除
|
// 关联删除
|
||||||
if (!empty($this->relationWrite)) {
|
if (!empty($this->relationWrite)) {
|
||||||
$this->autoRelationDelete();
|
$this->autoRelationDelete($force);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->trigger('AfterDelete');
|
$this->trigger('AfterDelete');
|
||||||
|
@ -41,6 +41,12 @@ class MorphOne extends Relation
|
|||||||
*/
|
*/
|
||||||
protected $type;
|
protected $type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定的关联属性
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $bindAttr = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造函数
|
* 构造函数
|
||||||
* @access public
|
* @access public
|
||||||
@ -78,6 +84,11 @@ class MorphOne extends Relation
|
|||||||
$relationModel = $this->query->relation($subRelation)->find();
|
$relationModel = $this->query->relation($subRelation)->find();
|
||||||
|
|
||||||
if ($relationModel) {
|
if ($relationModel) {
|
||||||
|
if (!empty($this->bindAttr)) {
|
||||||
|
// 绑定关联属性
|
||||||
|
$this->bindAttr($this->parent, $relationModel);
|
||||||
|
}
|
||||||
|
|
||||||
$relationModel->setParent(clone $this->parent);
|
$relationModel->setParent(clone $this->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,10 +165,16 @@ class MorphOne extends Relation
|
|||||||
$relationModel->exists(true);
|
$relationModel->exists(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($this->bindAttr)) {
|
||||||
|
// 绑定关联属性
|
||||||
|
$this->bindAttr($result, $relationModel);
|
||||||
|
} else {
|
||||||
|
// 设置关联属性
|
||||||
$result->setRelation($relation, $relationModel);
|
$result->setRelation($relation, $relationModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预载入关联查询
|
* 预载入关联查询
|
||||||
@ -188,9 +205,15 @@ class MorphOne extends Relation
|
|||||||
$relationModel = null;
|
$relationModel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($this->bindAttr)) {
|
||||||
|
// 绑定关联属性
|
||||||
|
$this->bindAttr($result, $relationModel);
|
||||||
|
} else {
|
||||||
|
// 设置关联属性
|
||||||
$result->setRelation($relation, $relationModel);
|
$result->setRelation($relation, $relationModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多态一对一 关联模型预查询
|
* 多态一对一 关联模型预查询
|
||||||
@ -277,4 +300,48 @@ class MorphOne extends Relation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定关联表的属性到父模型属性
|
||||||
|
* @access public
|
||||||
|
* @param array $attr 要绑定的属性列表
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function bind(array $attr)
|
||||||
|
{
|
||||||
|
$this->bindAttr = $attr;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取绑定属性
|
||||||
|
* @access public
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getBindAttr(): array
|
||||||
|
{
|
||||||
|
return $this->bindAttr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定关联属性到父模型
|
||||||
|
* @access protected
|
||||||
|
* @param Model $result 父模型对象
|
||||||
|
* @param Model $model 关联模型对象
|
||||||
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
protected function bindAttr(Model $result, Model $model = null): void
|
||||||
|
{
|
||||||
|
foreach ($this->bindAttr as $key => $attr) {
|
||||||
|
$key = is_numeric($key) ? $attr : $key;
|
||||||
|
$value = $result->getOrigin($key);
|
||||||
|
|
||||||
|
if (!is_null($value)) {
|
||||||
|
throw new Exception('bind attr has exists:' . $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->setAttr($key, $model ? $model->$attr : null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,13 +104,14 @@ class ProcessService extends Service
|
|||||||
/**
|
/**
|
||||||
* 查询相关进程列表
|
* 查询相关进程列表
|
||||||
* @param string $command 任务指令
|
* @param string $command 任务指令
|
||||||
|
* @param string $name 执行名称
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function query(string $command): array
|
public function query(string $command, $name = 'php.exe'): array
|
||||||
{
|
{
|
||||||
$list = [];
|
$list = [];
|
||||||
if ($this->iswin()) {
|
if ($this->iswin()) {
|
||||||
$lines = $this->exec('wmic process where name="php.exe" get processid,CommandLine', true);
|
$lines = $this->exec('wmic process where name="' . $name . '" get processid,CommandLine', 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_pop($attr), 'cmd' => join(' ', $attr)];
|
$list[] = ['pid' => array_pop($attr), 'cmd' => join(' ', $attr)];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user