1、内核更新
2、代码更新
This commit is contained in:
@@ -12,10 +12,10 @@ namespace app\common\model;
|
|||||||
/**
|
/**
|
||||||
* 设置模型
|
* 设置模型
|
||||||
*/
|
*/
|
||||||
class Document extends \think\model\Merge{
|
class Document extends \think\Model{
|
||||||
|
|
||||||
protected $fk = 'doc_id';
|
protected $fk = 'doc_id';
|
||||||
protected $relationModel = array('document_article');
|
protected $pk = 'id';
|
||||||
|
|
||||||
// 定义需要自动写入时间戳格式的字段
|
// 定义需要自动写入时间戳格式的字段
|
||||||
protected $autoWriteTimestamp = array('create_time','update_time','deadline');
|
protected $autoWriteTimestamp = array('create_time','update_time','deadline');
|
||||||
@@ -70,10 +70,8 @@ class Document extends \think\model\Merge{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function extend($name){
|
public function extend($name){
|
||||||
if (is_numeric($name)) {
|
$name = strtoupper($name);
|
||||||
$name = db('model')->where(array('id'=>$name))->value('name');
|
$this->join('__DOCUMENT_' . $name . '__', $this->fk . '=' . $this->pk, 'LEFT');
|
||||||
}
|
|
||||||
$this->relationModel = array('document_' . $name);
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,14 +89,15 @@ class Document extends \think\model\Merge{
|
|||||||
/* 添加或新增基础内容 */
|
/* 添加或新增基础内容 */
|
||||||
if(empty($data['id'])){ //新增数据
|
if(empty($data['id'])){ //新增数据
|
||||||
unset($data['id']);
|
unset($data['id']);
|
||||||
$id = $this->validate('document.edit')->save($data); //添加基础内容
|
$id = $this->validate('document.edit')->insert($data); //添加基础内容
|
||||||
|
|
||||||
if(!$id){
|
if(!$id){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$data['id'] = $id;
|
$data['id'] = $id;
|
||||||
} else { //更新数据
|
} else { //更新数据
|
||||||
$status = $this->validate('document.edit')->save($data, array('id'=>$data['id'])); //更新基础内容
|
$status = $this->validate('document.edit')->fetchSql(true)->update($data, array('id'=>$data['id'])); //更新基础内容
|
||||||
|
dump($status);exit();
|
||||||
if(false === $status){
|
if(false === $status){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class Auth{
|
|||||||
protected $_config = array(
|
protected $_config = array(
|
||||||
'auth_on' => true, // 认证开关
|
'auth_on' => true, // 认证开关
|
||||||
'auth_type' => 1, // 认证方式,1为实时认证;2为登录认证。
|
'auth_type' => 1, // 认证方式,1为实时认证;2为登录认证。
|
||||||
'auth_group' => 'auth_group', // 用户组数据表名
|
'auth_group' => '__AUTH_GROUP__', // 用户组数据表名
|
||||||
'auth_group_access' => 'auth_group_access', // 用户-用户组关系表
|
'auth_group_access' => 'auth_group_access', // 用户-用户组关系表
|
||||||
'auth_rule' => 'auth_rule', // 权限规则表
|
'auth_rule' => 'auth_rule', // 权限规则表
|
||||||
'auth_user' => 'member' // 用户信息表
|
'auth_user' => 'member' // 用户信息表
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class App
|
|||||||
}
|
}
|
||||||
$args = self::bindParams($reflect, $vars);
|
$args = self::bindParams($reflect, $vars);
|
||||||
|
|
||||||
self::$debug && Log::record('[ RUN ] ' . $reflect->__toString(), 'info');
|
self::$debug && Log::record('[ RUN ] ' . $reflect->class . '->' . $reflect->name . '[ ' . $reflect->getFileName() . ' ]', 'info');
|
||||||
return $reflect->invokeArgs(isset($class) ? $class : null, $args);
|
return $reflect->invokeArgs(isset($class) ? $class : null, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,8 +245,6 @@ class App
|
|||||||
} else {
|
} else {
|
||||||
$args = [];
|
$args = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$debug && Log::record('[ RUN ] ' . $reflect->__toString(), 'info');
|
|
||||||
return $reflect->newInstanceArgs($args);
|
return $reflect->newInstanceArgs($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,10 +124,10 @@ class Request
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 架构函数
|
* 架构函数
|
||||||
* @access public
|
* @access protected
|
||||||
* @param array $options 参数
|
* @param array $options 参数
|
||||||
*/
|
*/
|
||||||
public function __construct($options = [])
|
protected function __construct($options = [])
|
||||||
{
|
{
|
||||||
foreach ($options as $name => $item) {
|
foreach ($options as $name => $item) {
|
||||||
if (property_exists($this, $name)) {
|
if (property_exists($this, $name)) {
|
||||||
@@ -910,6 +910,9 @@ class Request
|
|||||||
{
|
{
|
||||||
if (empty($this->header)) {
|
if (empty($this->header)) {
|
||||||
$header = [];
|
$header = [];
|
||||||
|
if (function_exists('apache_request_headers') && $result = apache_request_headers()) {
|
||||||
|
$header = $result;
|
||||||
|
} else {
|
||||||
$server = $this->server ?: $_SERVER;
|
$server = $this->server ?: $_SERVER;
|
||||||
foreach ($server as $key => $val) {
|
foreach ($server as $key => $val) {
|
||||||
if (0 === strpos($key, 'HTTP_')) {
|
if (0 === strpos($key, 'HTTP_')) {
|
||||||
@@ -923,6 +926,7 @@ class Request
|
|||||||
if (isset($server['CONTENT_LENGTH'])) {
|
if (isset($server['CONTENT_LENGTH'])) {
|
||||||
$header['content-length'] = $server['CONTENT_LENGTH'];
|
$header['content-length'] = $server['CONTENT_LENGTH'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->header = array_change_key_case($header);
|
$this->header = array_change_key_case($header);
|
||||||
}
|
}
|
||||||
if (is_array($name)) {
|
if (is_array($name)) {
|
||||||
|
|||||||
@@ -943,8 +943,16 @@ class Route
|
|||||||
|
|
||||||
if (is_array($item)) {
|
if (is_array($item)) {
|
||||||
list($rule, $option) = $item;
|
list($rule, $option) = $item;
|
||||||
if (isset($option['method'][$array[0]])) {
|
$action = $array[0];
|
||||||
$option['method'] = $option['method'][$array[0]];
|
if (isset($option['allow']) && !in_array($action, explode(',', $option['allow']))) {
|
||||||
|
// 允许操作
|
||||||
|
return false;
|
||||||
|
} elseif (isset($option['except']) && in_array($action, explode(',', $option['except']))) {
|
||||||
|
// 排除操作
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isset($option['method'][$action])) {
|
||||||
|
$option['method'] = $option['method'][$action];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$rule = $item;
|
$rule = $item;
|
||||||
@@ -957,7 +965,7 @@ class Route
|
|||||||
} elseif (0 === strpos($rule, '\\')) {
|
} elseif (0 === strpos($rule, '\\')) {
|
||||||
// 路由到类
|
// 路由到类
|
||||||
return self::bindToClass($bind, substr($rule, 1), $depr);
|
return self::bindToClass($bind, substr($rule, 1), $depr);
|
||||||
} elseif (0 === strpos($url, '@')) {
|
} elseif (0 === strpos($rule, '@')) {
|
||||||
// 路由到控制器类
|
// 路由到控制器类
|
||||||
return self::bindToController($bind, substr($rule, 1), $depr);
|
return self::bindToController($bind, substr($rule, 1), $depr);
|
||||||
} else {
|
} else {
|
||||||
@@ -1406,7 +1414,7 @@ class Route
|
|||||||
if ($route instanceof \Closure) {
|
if ($route instanceof \Closure) {
|
||||||
// 执行闭包
|
// 执行闭包
|
||||||
$result = ['type' => 'function', 'function' => $route];
|
$result = ['type' => 'function', 'function' => $route];
|
||||||
} elseif (0 === strpos($route, '/') || 0 === strpos($route, 'http')) {
|
} elseif (0 === strpos($route, '/') || strpos($route, '://')) {
|
||||||
// 路由到重定向地址
|
// 路由到重定向地址
|
||||||
$result = ['type' => 'redirect', 'url' => $route, 'status' => isset($option['status']) ? $option['status'] : 301];
|
$result = ['type' => 'redirect', 'url' => $route, 'status' => isset($option['status']) ? $option['status'] : 301];
|
||||||
} elseif (false !== strpos($route, '\\')) {
|
} elseif (false !== strpos($route, '\\')) {
|
||||||
|
|||||||
@@ -85,13 +85,28 @@ class Url
|
|||||||
} elseif (!empty($rule) && isset($name)) {
|
} elseif (!empty($rule) && isset($name)) {
|
||||||
throw new \InvalidArgumentException('route name not exists:' . $name);
|
throw new \InvalidArgumentException('route name not exists:' . $name);
|
||||||
} else {
|
} else {
|
||||||
|
// 检查别名路由
|
||||||
|
$alias = Route::rules('alias');
|
||||||
|
if ($alias) {
|
||||||
|
// 别名路由解析
|
||||||
|
foreach ($alias as $key => $val) {
|
||||||
|
if (is_array($val)) {
|
||||||
|
$val = $val[0];
|
||||||
|
}
|
||||||
|
if (0 === strpos($url, $val)) {
|
||||||
|
$url = $key . substr($url, strlen($val));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 路由标识不存在 直接解析
|
||||||
|
$url = self::parseUrl($url, $domain);
|
||||||
|
}
|
||||||
if (isset($info['query'])) {
|
if (isset($info['query'])) {
|
||||||
// 解析地址里面参数 合并到vars
|
// 解析地址里面参数 合并到vars
|
||||||
parse_str($info['query'], $params);
|
parse_str($info['query'], $params);
|
||||||
$vars = array_merge($params, $vars);
|
$vars = array_merge($params, $vars);
|
||||||
}
|
}
|
||||||
// 路由标识不存在 直接解析
|
|
||||||
$url = self::parseUrl($url, $domain);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测URL绑定
|
// 检测URL绑定
|
||||||
@@ -119,9 +134,13 @@ class Url
|
|||||||
} else {
|
} else {
|
||||||
foreach ($vars as $var => $val) {
|
foreach ($vars as $var => $val) {
|
||||||
if ('' !== trim($val)) {
|
if ('' !== trim($val)) {
|
||||||
|
if (Config::get('url_param_type')) {
|
||||||
|
$url .= $depr . urlencode($val);
|
||||||
|
} else {
|
||||||
$url .= $depr . $var . $depr . urlencode($val);
|
$url .= $depr . $var . $depr . urlencode($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$url .= $suffix . $anchor;
|
$url .= $suffix . $anchor;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user