1.内核更新
2.规则从菜单中批量导入bug修复
This commit is contained in:
@@ -127,26 +127,13 @@ class Group extends Admin {
|
|||||||
//根据菜单更新节点
|
//根据菜单更新节点
|
||||||
public function upnode($type) {
|
public function upnode($type) {
|
||||||
$rule = model('Menu')->getAuthNodes($type);
|
$rule = model('Menu')->getAuthNodes($type);
|
||||||
foreach ($rule as $value) {
|
$reuslt = $this->rule->uprule($rule, $type);
|
||||||
$data = array(
|
|
||||||
'module' => $type,
|
|
||||||
'type' => 2,
|
|
||||||
'name' => $value['url'],
|
|
||||||
'title' => $value['title'],
|
|
||||||
'group' => $value['group'],
|
|
||||||
'status' => 1,
|
|
||||||
);
|
|
||||||
$id = $this->rule->where(array('name' => $data['name']))->value('id');
|
|
||||||
if ($id) {
|
|
||||||
$data['id'] = $id;
|
|
||||||
$this->rule->save($data, array('id' => $id));
|
|
||||||
} else {
|
|
||||||
$this->rule->save($data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $this->success("更新成功!");
|
return $this->success("更新成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权
|
||||||
|
*/
|
||||||
public function auth($id) {
|
public function auth($id) {
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
return $this->error("非法操作!");
|
return $this->error("非法操作!");
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ class AuthRule extends Base{
|
|||||||
);
|
);
|
||||||
|
|
||||||
public $keyList = array(
|
public $keyList = array(
|
||||||
//array('name'=>'id','title'=>'标识','type'=>'hidden'),
|
|
||||||
array('name'=>'module','title'=>'所属模块','type'=>'hidden'),
|
array('name'=>'module','title'=>'所属模块','type'=>'hidden'),
|
||||||
array('name'=>'title','title'=>'节点名称','type'=>'text','help'=>''),
|
array('name'=>'title','title'=>'节点名称','type'=>'text','help'=>''),
|
||||||
array('name'=>'name','title'=>'节点标识','type'=>'text','help'=>''),
|
array('name'=>'name','title'=>'节点标识','type'=>'text','help'=>''),
|
||||||
@@ -30,4 +29,25 @@ class AuthRule extends Base{
|
|||||||
array('name'=>'status','title'=>'状态','type'=>'select','option'=>array('1'=>'启用','0'=>'禁用'),'help'=>''),
|
array('name'=>'status','title'=>'状态','type'=>'select','option'=>array('1'=>'启用','0'=>'禁用'),'help'=>''),
|
||||||
array('name'=>'condition','title'=>'条件','type'=>'text','help'=>'')
|
array('name'=>'condition','title'=>'条件','type'=>'text','help'=>'')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public function uprule($data, $type){
|
||||||
|
foreach ($data as $value) {
|
||||||
|
$data = array(
|
||||||
|
'module' => $type,
|
||||||
|
'type' => 2,
|
||||||
|
'name' => $value['url'],
|
||||||
|
'title' => $value['title'],
|
||||||
|
'group' => $value['group'],
|
||||||
|
'status' => 1,
|
||||||
|
);
|
||||||
|
$id = $this->where(array('name' => $data['name']))->value('id');
|
||||||
|
if ($id) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$this->save($data, array('id' => $id));
|
||||||
|
} else {
|
||||||
|
self::create($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -242,6 +242,7 @@ class App
|
|||||||
{
|
{
|
||||||
$args = [];
|
$args = [];
|
||||||
// 判断数组类型 数字数组时按顺序绑定参数
|
// 判断数组类型 数字数组时按顺序绑定参数
|
||||||
|
reset($vars);
|
||||||
$type = key($vars) === 0 ? 1 : 0;
|
$type = key($vars) === 0 ? 1 : 0;
|
||||||
if ($reflect->getNumberOfParameters() > 0) {
|
if ($reflect->getNumberOfParameters() > 0) {
|
||||||
$params = $reflect->getParameters();
|
$params = $reflect->getParameters();
|
||||||
|
|||||||
@@ -629,6 +629,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
|
|
||||||
// 检测字段
|
// 检测字段
|
||||||
if (!empty($this->field)) {
|
if (!empty($this->field)) {
|
||||||
|
$this->db();
|
||||||
foreach ($this->data as $key => $val) {
|
foreach ($this->data as $key => $val) {
|
||||||
if (!in_array($key, $this->field)) {
|
if (!in_array($key, $this->field)) {
|
||||||
unset($this->data[$key]);
|
unset($this->data[$key]);
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ class Request
|
|||||||
* @var array 资源类型
|
* @var array 资源类型
|
||||||
*/
|
*/
|
||||||
protected $mimeType = [
|
protected $mimeType = [
|
||||||
'html' => 'text/html,application/xhtml+xml,*/*',
|
|
||||||
'xml' => 'application/xml,text/xml,application/x-xml',
|
'xml' => 'application/xml,text/xml,application/x-xml',
|
||||||
'json' => 'application/json,text/x-json,application/jsonrequest,text/json',
|
'json' => 'application/json,text/x-json,application/jsonrequest,text/json',
|
||||||
'js' => 'text/javascript,application/javascript,application/x-javascript',
|
'js' => 'text/javascript,application/javascript,application/x-javascript',
|
||||||
@@ -107,6 +106,7 @@ class Request
|
|||||||
'jpg' => 'image/jpg,image/jpeg,image/pjpeg',
|
'jpg' => 'image/jpg,image/jpeg,image/pjpeg',
|
||||||
'gif' => 'image/gif',
|
'gif' => 'image/gif',
|
||||||
'csv' => 'text/csv',
|
'csv' => 'text/csv',
|
||||||
|
'html' => 'text/html,application/xhtml+xml,*/*',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $content;
|
protected $content;
|
||||||
|
|||||||
5
core/library/think/cache/driver/Redis.php
vendored
5
core/library/think/cache/driver/Redis.php
vendored
@@ -27,6 +27,7 @@ class Redis extends Driver
|
|||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'port' => 6379,
|
'port' => 6379,
|
||||||
'password' => '',
|
'password' => '',
|
||||||
|
'select' => 0,
|
||||||
'timeout' => 0,
|
'timeout' => 0,
|
||||||
'expire' => 0,
|
'expire' => 0,
|
||||||
'persistent' => false,
|
'persistent' => false,
|
||||||
@@ -53,6 +54,10 @@ class Redis extends Driver
|
|||||||
if ('' != $this->options['password']) {
|
if ('' != $this->options['password']) {
|
||||||
$this->handler->auth($this->options['password']);
|
$this->handler->auth($this->options['password']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0 != $this->options['select']) {
|
||||||
|
$this->handler->select($this->options['select']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1980,6 +1980,9 @@ class Query
|
|||||||
$model = $this->model;
|
$model = $this->model;
|
||||||
$data = new $model($data);
|
$data = new $model($data);
|
||||||
$data->isUpdate(true, isset($options['where']['AND']) ? $options['where']['AND'] : null);
|
$data->isUpdate(true, isset($options['where']['AND']) ? $options['where']['AND'] : null);
|
||||||
|
if ($this->allowField) {
|
||||||
|
$data->allowField($this->allowField);
|
||||||
|
}
|
||||||
// 关联查询
|
// 关联查询
|
||||||
if (!empty($options['relation'])) {
|
if (!empty($options['relation'])) {
|
||||||
$data->relationQuery($options['relation']);
|
$data->relationQuery($options['relation']);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class Redis extends SessionHandler
|
|||||||
'host' => '127.0.0.1', // redis主机
|
'host' => '127.0.0.1', // redis主机
|
||||||
'port' => 6379, // redis端口
|
'port' => 6379, // redis端口
|
||||||
'password' => '', // 密码
|
'password' => '', // 密码
|
||||||
|
'select' => 0, // 操作库
|
||||||
'expire' => 3600, // 有效期(秒)
|
'expire' => 3600, // 有效期(秒)
|
||||||
'timeout' => 0, // 超时时间(秒)
|
'timeout' => 0, // 超时时间(秒)
|
||||||
'persistent' => true, // 是否长连接
|
'persistent' => true, // 是否长连接
|
||||||
@@ -56,6 +57,11 @@ class Redis extends SessionHandler
|
|||||||
if ('' != $this->config['password']) {
|
if ('' != $this->config['password']) {
|
||||||
$this->handler->auth($this->config['password']);
|
$this->handler->auth($this->config['password']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0 != $this->config['select']) {
|
||||||
|
$this->handler->select($this->config['select']);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user