mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-10 00:22:48 +08:00
改进Hook类 改进Model类时间戳写入
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
@@ -69,7 +68,8 @@ class Hook
|
||||
*/
|
||||
public static function get($tag = '')
|
||||
{
|
||||
if (empty($tag)) {//获取全部的插件信息
|
||||
if (empty($tag)) {
|
||||
//获取全部的插件信息
|
||||
return self::$tags;
|
||||
} else {
|
||||
return array_key_exists($tag, self::$tags) ? self::$tags[$tag] : [];
|
||||
@@ -90,7 +90,8 @@ class Hook
|
||||
$tags = static::get($tag);
|
||||
foreach ($tags as $key => $name) {
|
||||
$results[$key] = self::exec($name, $tag, $params, $extra);
|
||||
if (false === $results[$key]) {// 如果返回false 则中断行为执行
|
||||
if (false === $results[$key]) {
|
||||
// 如果返回false 则中断行为执行
|
||||
break;
|
||||
} elseif (!is_null($results[$key]) && $once) {
|
||||
break;
|
||||
@@ -114,11 +115,12 @@ class Hook
|
||||
$result = call_user_func_array($class, [ & $params, $extra]);
|
||||
$class = 'Closure';
|
||||
} elseif (is_object($class)) {
|
||||
$result = call_user_func_array([$class, $tag], [ & $params, $extra]);
|
||||
$result = $class->$tag($params, $extra);
|
||||
$class = get_class($class);
|
||||
} else {
|
||||
$obj = new $class();
|
||||
$result = ($tag && is_callable([$obj, $tag])) ? $obj->$tag($params, $extra) : $obj->run($params, $extra);
|
||||
$method = ($tag && is_callable([$obj, $tag])) ? $tag : 'run';
|
||||
$result = $obj->$method($params, $extra);
|
||||
}
|
||||
if (App::$debug) {
|
||||
Debug::remark('behavior_end', 'time');
|
||||
|
||||
@@ -326,7 +326,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
$value = date($format, $_SERVER['REQUEST_TIME']);
|
||||
break;
|
||||
case 'timestamp':
|
||||
case 'int':
|
||||
case 'integer':
|
||||
default:
|
||||
$value = $_SERVER['REQUEST_TIME'];
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user