后台代码格式化,内核更新

This commit is contained in:
2016-08-29 16:51:13 +08:00
parent 1710eb742c
commit dff622f0ac
21 changed files with 842 additions and 838 deletions

View File

@@ -27,7 +27,7 @@ class Action extends Admin {
Cookie('__forward__', $_SERVER['REQUEST_URI']); Cookie('__forward__', $_SERVER['REQUEST_URI']);
$data = array( $data = array(
'list' => $list, 'list' => $list,
'page' => $list->render() 'page' => $list->render(),
); );
$this->assign($data); $this->assign($data);
$this->setMeta('用户行为'); $this->setMeta('用户行为');
@@ -51,7 +51,7 @@ class Action extends Admin {
} }
} else { } else {
$data = array( $data = array(
'keyList' => $model->fieldlist 'keyList' => $model->fieldlist,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("添加行为"); $this->setMeta("添加行为");
@@ -81,7 +81,7 @@ class Action extends Admin {
} }
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $model->fieldlist 'keyList' => $model->fieldlist,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("编辑行为"); $this->setMeta("编辑行为");
@@ -144,7 +144,7 @@ class Action extends Admin {
$data = array( $data = array(
'list' => $list, 'list' => $list,
'page' => $list->render() 'page' => $list->render(),
); );
$this->assign($data); $this->assign($data);
$this->setMeta('行为日志'); $this->setMeta('行为日志');
@@ -168,7 +168,7 @@ class Action extends Admin {
$info['create_time'] = date('Y-m-d H:i:s', $info['create_time']); $info['create_time'] = date('Y-m-d H:i:s', $info['create_time']);
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $model->keyList 'keyList' => $model->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('查看行为日志'); $this->setMeta('查看行为日志');
@@ -202,8 +202,7 @@ class Action extends Admin {
//记录行为 //记录行为
action_log('clear_actionlog', 'ActionLog', $id, session('user_auth.uid')); action_log('clear_actionlog', 'ActionLog', $id, session('user_auth.uid'));
return $this->success('日志清空成功!'); return $this->success('日志清空成功!');
} } else {
else {
return $this->error('日志清空失败!'); return $this->error('日志清空失败!');
} }
} }

View File

@@ -30,7 +30,7 @@ class Ad extends Admin {
$list = db('AdPlace')->where($map)->order($order)->paginate(10); $list = db('AdPlace')->where($map)->order($order)->paginate(10);
$data = array( $data = array(
'list' => $list, 'list' => $list,
'page' => $list->render() 'page' => $list->render(),
); );
$this->assign($data); $this->assign($data);
$this->setMeta("广告管理"); $this->setMeta("广告管理");
@@ -51,7 +51,7 @@ class Ad extends Admin {
} }
} else { } else {
$data = array( $data = array(
'keyList' => $place->keyList 'keyList' => $place->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("添加广告位"); $this->setMeta("添加广告位");
@@ -75,7 +75,7 @@ class Ad extends Admin {
} }
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $place->keyList 'keyList' => $place->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("编辑广告位"); $this->setMeta("编辑广告位");
@@ -106,7 +106,7 @@ class Ad extends Admin {
$data = array( $data = array(
'id' => $id, 'id' => $id,
'list' => $list, 'list' => $list,
'page' => $list->render() 'page' => $list->render(),
); );
$this->assign($data); $this->assign($data);
$this->setMeta("广告管理"); $this->setMeta("广告管理");
@@ -126,7 +126,7 @@ class Ad extends Admin {
$info['place_id'] = $id; $info['place_id'] = $id;
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $ad->keyList 'keyList' => $ad->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("添加广告位"); $this->setMeta("添加广告位");
@@ -150,7 +150,7 @@ class Ad extends Admin {
} }
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $ad->keyList 'keyList' => $ad->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("编辑广告位"); $this->setMeta("编辑广告位");

View File

@@ -275,10 +275,8 @@ class Addons extends Admin {
//超级管理员删除钩子 //超级管理员删除钩子
public function delhook() { public function delhook() {
$id = input('id', '', 'trim,intval'); $id = $this->getArrayParam('id');
$ids = input('post.ids/a', array()); $map['id'] = array('IN', $id);
array_push($ids, $id);
$map['id'] = array('IN', $ids);
$result = $this->hooks->where($map)->delete(); $result = $this->hooks->where($map)->delete();
if ($result !== false) { if ($result !== false) {
return $this->success('删除成功'); return $this->success('删除成功');

View File

@@ -34,14 +34,13 @@ class Attribute extends Admin {
'in' => '验证在范围内', 'in' => '验证在范围内',
'notin' => '验证不在范围内', 'notin' => '验证不在范围内',
'between' => '区间验证', 'between' => '区间验证',
'notbetween'=>'不在区间验证' 'notbetween' => '不在区间验证',
); );
$this->auto_type = array(0 => '请选择', 'function' => '函数', 'field' => '字段', 'string' => '字符串'); $this->auto_type = array(0 => '请选择', 'function' => '函数', 'field' => '字段', 'string' => '字符串');
$this->the_time = array(0 => '请选择', '3' => '始 终', '1' => '新 增', '2' => '编 辑'); $this->the_time = array(0 => '请选择', '3' => '始 终', '1' => '新 增', '2' => '编 辑');
$this->field = $this->getField(); $this->field = $this->getField();
} }
/** /**
* index方法 * index方法
* @author colin <colin@tensent.cn> * @author colin <colin@tensent.cn>
@@ -57,7 +56,7 @@ class Attribute extends Admin {
$data = array( $data = array(
'list' => $list, 'list' => $list,
'model_id' => $model_id, 'model_id' => $model_id,
'page' => $list->render() 'page' => $list->render(),
); );
$this->assign($data); $this->assign($data);
$this->setMeta('字段管理'); $this->setMeta('字段管理');
@@ -83,7 +82,7 @@ class Attribute extends Admin {
} }
$data = array( $data = array(
'info' => array('model_id' => $model_id), 'info' => array('model_id' => $model_id),
'fieldGroup' => $this->field 'fieldGroup' => $this->field,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('添加字段'); $this->setMeta('添加字段');
@@ -108,7 +107,7 @@ class Attribute extends Admin {
$info = db('Attribute')->find($id); $info = db('Attribute')->find($id);
$data = array( $data = array(
'info' => $info, 'info' => $info,
'fieldGroup' => $this->field 'fieldGroup' => $this->field,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('编辑字段'); $this->setMeta('编辑字段');
@@ -149,7 +148,7 @@ class Attribute extends Admin {
array('name' => 'value', 'title' => '默认值', 'help' => '字段的默认值', 'type' => 'text'), array('name' => 'value', 'title' => '默认值', 'help' => '字段的默认值', 'type' => 'text'),
array('name' => 'remark', 'title' => '字段备注', 'help' => '用于表单中的提示', 'type' => 'text'), array('name' => 'remark', 'title' => '字段备注', 'help' => '用于表单中的提示', 'type' => 'text'),
array('name' => 'is_show', 'title' => '是否显示', 'help' => '是否显示在表单中', 'type' => 'select', 'option' => array('1' => '始终显示', '2' => '新增显示', '3' => '编辑显示', '0' => '不显示'), 'value' => 1), array('name' => 'is_show', 'title' => '是否显示', 'help' => '是否显示在表单中', 'type' => 'select', 'option' => array('1' => '始终显示', '2' => '新增显示', '3' => '编辑显示', '0' => '不显示'), 'value' => 1),
array('name'=>'is_must','title'=>'是否必填','help'=>'用于自动验证','type'=>'select','option'=>array('0'=>'否','1'=>'是')) array('name' => 'is_must', 'title' => '是否必填', 'help' => '用于自动验证', 'type' => 'select', 'option' => array('0' => '否', '1' => '是')),
), ),
'高级' => array( '高级' => array(
array('name' => 'validate_type', 'title' => '验证方式', 'type' => 'select', 'option' => $this->validate_rule, 'help' => ''), array('name' => 'validate_type', 'title' => '验证方式', 'type' => 'select', 'option' => $this->validate_rule, 'help' => ''),

View File

@@ -41,7 +41,7 @@ class Config extends Admin{
'config_type' => config('config_config_list'), 'config_type' => config('config_config_list'),
'page' => $list->render(), 'page' => $list->render(),
'group_id' => input('get.group', 0), 'group_id' => input('get.group', 0),
'list' => $list 'list' => $list,
); );
$this->assign($data); $this->assign($data);
@@ -86,23 +86,19 @@ class Config extends Admin{
//记录行为 //记录行为
action_log('update_config', 'config', $id, session('user_auth.uid')); action_log('update_config', 'config', $id, session('user_auth.uid'));
return $this->success('新增成功', url('index')); return $this->success('新增成功', url('index'));
} } else {
else {
return $this->error('新增失败'); return $this->error('新增失败');
} }
} } else {
else {
return $this->error($config->getError()); return $this->error($config->getError());
} }
} } else {
else {
$this->setMeta('新增配置'); $this->setMeta('新增配置');
$this->assign('info', null); $this->assign('info', null);
return $this->fetch('edit'); return $this->fetch('edit');
} }
} }
/** /**
* 编辑配置 * 编辑配置
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
@@ -174,7 +170,6 @@ class Config extends Admin{
} }
} }
/** /**
* 配置排序 * 配置排序
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
@@ -186,8 +181,7 @@ class Config extends Admin{
$map = array('status' => array('gt', -1)); $map = array('status' => array('gt', -1));
if (!empty($ids)) { if (!empty($ids)) {
$map['id'] = array('in', $ids); $map['id'] = array('in', $ids);
} } elseif (input('group')) {
elseif (input('group')) {
$map['group'] = input('group'); $map['group'] = input('group');
} }
$list = db('Config')->where($map)->field('id,title')->order('sort asc,id asc')->select(); $list = db('Config')->where($map)->field('id,title')->order('sort asc,id asc')->select();
@@ -195,8 +189,7 @@ class Config extends Admin{
$this->assign('list', $list); $this->assign('list', $list);
$this->setMeta('配置排序'); $this->setMeta('配置排序');
return $this->fetch(); return $this->fetch();
} } elseif (IS_POST) {
elseif (IS_POST) {
$ids = input('post.ids'); $ids = input('post.ids');
$ids = explode(',', $ids); $ids = explode(',', $ids);
foreach ($ids as $key => $value) { foreach ($ids as $key => $value) {
@@ -204,12 +197,10 @@ class Config extends Admin{
} }
if ($res !== false) { if ($res !== false) {
return $this->success('排序成功!', Cookie('__forward__')); return $this->success('排序成功!', Cookie('__forward__'));
} } else {
else {
return $this->error('排序失败!'); return $this->error('排序失败!');
} }
} } else {
else {
return $this->error('非法请求!'); return $this->error('非法请求!');
} }
} }

View File

@@ -56,13 +56,13 @@ class Content extends Admin{
} }
$list = $this->model->where($map)->order($order)->paginate(15, false, array( $list = $this->model->where($map)->order($order)->paginate(15, false, array(
'query' => $this->param 'query' => $this->param,
)); ));
$data = array( $data = array(
'grid' => $grid_list, 'grid' => $grid_list,
'list' => $list, 'list' => $list,
'page' => $list->render() 'page' => $list->render(),
); );
if ($this->modelInfo['template_list']) { if ($this->modelInfo['template_list']) {
$template = 'content/' . $this->modelInfo['template_list']; $template = 'content/' . $this->modelInfo['template_list'];
@@ -88,11 +88,11 @@ class Content extends Admin{
} }
} else { } else {
$info = array( $info = array(
'model_id' => $this->modelInfo['id'] 'model_id' => $this->modelInfo['id'],
); );
$data = array( $data = array(
'info' => $info, 'info' => $info,
'fieldGroup' => $this->getField($this->modelInfo) 'fieldGroup' => $this->getField($this->modelInfo),
); );
if ($this->modelInfo['template_add']) { if ($this->modelInfo['template_add']) {
$template = 'content/' . $this->modelInfo['template_add']; $template = 'content/' . $this->modelInfo['template_add'];
@@ -128,7 +128,7 @@ class Content extends Admin{
$info['model_id'] = $this->modelInfo['id']; $info['model_id'] = $this->modelInfo['id'];
$data = array( $data = array(
'info' => $info, 'info' => $info,
'fieldGroup' => $this->getField($this->modelInfo) 'fieldGroup' => $this->getField($this->modelInfo),
); );
if ($this->modelInfo['template_edit']) { if ($this->modelInfo['template_edit']) {
$template = 'content/' . $this->modelInfo['template_edit']; $template = 'content/' . $this->modelInfo['template_edit'];

View File

@@ -155,13 +155,14 @@ class Database extends Admin {
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/ */
public function export($tables = null, $id = null, $start = null) { public function export($tables = null, $id = null, $start = null) {
if (IS_POST && !empty($tables) && is_array($tables)) { //初始化 if (IS_POST && !empty($tables) && is_array($tables)) {
//初始化
$path = config('data_backup_path'); $path = config('data_backup_path');
if (!is_dir($path)) { if (!is_dir($path)) {
mkdir($path, 0755, true); mkdir($path, 0755, true);
} }
//读取备份配置 //读取备份配置
$config = array('path' => realpath($path) . DIRECTORY_SEPARATOR, 'part' => config('data_backup_part_size'), 'compress' => config('data_backup_compress'), 'level' => config('data_backup_compress_level'),); $config = array('path' => realpath($path) . DIRECTORY_SEPARATOR, 'part' => config('data_backup_part_size'), 'compress' => config('data_backup_compress'), 'level' => config('data_backup_compress_level'));
//检查是否有正在执行的任务 //检查是否有正在执行的任务
$lock = "{$config['path']}backup.lock"; $lock = "{$config['path']}backup.lock";
if (is_file($lock)) { if (is_file($lock)) {
@@ -176,7 +177,7 @@ class Database extends Admin {
} }
session('backup_config', $config); session('backup_config', $config);
//生成备份文件信息 //生成备份文件信息
$file = array('name' => date('Ymd-His', time()), 'part' => 1,); $file = array('name' => date('Ymd-His', time()), 'part' => 1);
session('backup_file', $file); session('backup_file', $file);
//缓存要备份的表 //缓存要备份的表
session('backup_tables', $tables); session('backup_tables', $tables);
@@ -188,18 +189,22 @@ class Database extends Admin {
} else { } else {
return $this->error('初始化失败,备份文件创建失败!'); return $this->error('初始化失败,备份文件创建失败!');
} }
} elseif (IS_GET && is_numeric($id) && is_numeric($start)) { //备份数据 } elseif (IS_GET && is_numeric($id) && is_numeric($start)) {
//备份数据
$tables = session('backup_tables'); $tables = session('backup_tables');
//备份指定表 //备份指定表
$Database = new \com\Database(session('backup_file'), session('backup_config')); $Database = new \com\Database(session('backup_file'), session('backup_config'));
$start = $Database->backup($tables[$id], $start); $start = $Database->backup($tables[$id], $start);
if (false === $start) { //出错 if (false === $start) {
//出错
return $this->error('备份出错!'); return $this->error('备份出错!');
} elseif (0 === $start) { //下一表 } elseif (0 === $start) {
//下一表
if (isset($tables[++$id])) { if (isset($tables[++$id])) {
$tab = array('id' => $id, 'start' => 0); $tab = array('id' => $id, 'start' => 0);
return $this->success('备份完成!', '', array('tab' => $tab)); return $this->success('备份完成!', '', array('tab' => $tab));
} else { //备份完成,清空缓存 } else {
//备份完成,清空缓存
unlink(session('backup_config.path') . 'backup.lock'); unlink(session('backup_config.path') . 'backup.lock');
session('backup_tables', null); session('backup_tables', null);
session('backup_file', null); session('backup_file', null);
@@ -211,7 +216,8 @@ class Database extends Admin {
$rate = floor(100 * ($start[0] / $start[1])); $rate = floor(100 * ($start[0] / $start[1]));
return $this->success("正在备份...({$rate}%)", '', array('tab' => $tab)); return $this->success("正在备份...({$rate}%)", '', array('tab' => $tab));
} }
} else { //出错 } else {
//出错
return $this->error('参数错误!'); return $this->error('参数错误!');
} }
} }
@@ -220,7 +226,8 @@ class Database extends Admin {
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/ */
public function import($time = 0, $part = null, $start = null) { public function import($time = 0, $part = null, $start = null) {
if (is_numeric($time) && is_null($part) && is_null($start)) { //初始化 if (is_numeric($time) && is_null($part) && is_null($start)) {
//初始化
//获取备份文件信息 //获取备份文件信息
$name = date('Ymd-His', $time) . '-*.sql*'; $name = date('Ymd-His', $time) . '-*.sql*';
$path = realpath(config('data_backup_path')) . DIRECTORY_SEPARATOR . $name; $path = realpath(config('data_backup_path')) . DIRECTORY_SEPARATOR . $name;
@@ -250,7 +257,8 @@ class Database extends Admin {
if (false === $start) { if (false === $start) {
return $this->error('还原数据出错!'); return $this->error('还原数据出错!');
} elseif (0 === $start) { //下一卷 } elseif (0 === $start) {
//下一卷
if (isset($list[++$part])) { if (isset($list[++$part])) {
$data = array('part' => $part, 'start' => 0); $data = array('part' => $part, 'start' => 0);
return $this->success("正在还原...#{$part}", '', $data); return $this->success("正在还原...#{$part}", '', $data);
@@ -263,8 +271,7 @@ class Database extends Admin {
if ($start[1]) { if ($start[1]) {
$rate = floor(100 * ($start[0] / $start[1])); $rate = floor(100 * ($start[0] / $start[1]));
return $this->success("正在还原...#{$part} ({$rate}%)", '', $data); return $this->success("正在还原...#{$part} ({$rate}%)", '', $data);
} } else {
else {
$data['gz'] = 1; $data['gz'] = 1;
return $this->success("正在还原...#{$part}", '', $data); return $this->success("正在还原...#{$part}", '', $data);
} }

View File

@@ -21,7 +21,6 @@ class Group extends Admin {
$this->rule = model('AuthRule'); $this->rule = model('AuthRule');
} }
//会员分组首页控制器 //会员分组首页控制器
public function index($type = 'admin') { public function index($type = 'admin') {
$map['module'] = $type; $map['module'] = $type;
@@ -31,7 +30,7 @@ class Group extends Admin {
$data = array( $data = array(
'list' => $list, 'list' => $list,
'page' => $list->render(), 'page' => $list->render(),
'type' => $type 'type' => $type,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('用户组管理'); $this->setMeta('用户组管理');
@@ -50,7 +49,7 @@ class Group extends Admin {
} else { } else {
$data = array( $data = array(
'info' => array('module' => $type, 'status' => 1), 'info' => array('module' => $type, 'status' => 1),
'keyList' => $this->group->keyList 'keyList' => $this->group->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('添加用户组'); $this->setMeta('添加用户组');
@@ -74,7 +73,7 @@ class Group extends Admin {
$info = $this->group->where(array('id' => $id))->find(); $info = $this->group->where(array('id' => $id))->find();
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $this->group->keyList 'keyList' => $this->group->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('编辑用户组'); $this->setMeta('编辑用户组');
@@ -118,7 +117,7 @@ class Group extends Admin {
$data = array( $data = array(
'list' => $list, 'list' => $list,
'page' => $list->render(), 'page' => $list->render(),
'type' => $type 'type' => $type,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('权限节点'); $this->setMeta('权限节点');
@@ -135,7 +134,7 @@ class Group extends Admin {
'name' => $value['url'], 'name' => $value['url'],
'title' => $value['title'], 'title' => $value['title'],
'group' => $value['group'], 'group' => $value['group'],
'status' => 1 'status' => 1,
); );
$id = $this->rule->where(array('name' => $data['name']))->value('id'); $id = $this->rule->where(array('name' => $data['name']))->value('id');
if ($id) { if ($id) {
@@ -199,7 +198,7 @@ class Group extends Admin {
'model' => $model, 'model' => $model,
'extend_auth' => $extend_auth, 'extend_auth' => $extend_auth,
'auth_list' => explode(',', $group['rules']), 'auth_list' => explode(',', $group['rules']),
'id' => $id 'id' => $id,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('授权'); $this->setMeta('授权');
@@ -218,7 +217,7 @@ class Group extends Admin {
} else { } else {
$data = array( $data = array(
'info' => array('module' => $type, 'status' => 1), 'info' => array('module' => $type, 'status' => 1),
'keyList' => $this->rule->keyList 'keyList' => $this->rule->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('添加节点'); $this->setMeta('添加节点');
@@ -241,7 +240,7 @@ class Group extends Admin {
$info = $this->rule->find($id); $info = $this->rule->find($id);
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $this->rule->keyList 'keyList' => $this->rule->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta('编辑节点'); $this->setMeta('编辑节点');

View File

@@ -32,9 +32,12 @@ class Index extends Admin{
return $this->success('登录成功!', url('admin/index/index')); return $this->success('登录成功!', url('admin/index/index'));
} else { } else {
switch ($uid) { switch ($uid) {
case -1: $error = '用户不存在或被禁用!'; break; //系统级别禁用 case -1:$error = '用户不存在或被禁用!';
case -2: $error = '密码错误!'; break; break; //系统级别禁用
default: $error = '未知错误!'; break; // 0-接口参数错误(调试阶段使用) case -2:$error = '密码错误!';
break;
default:$error = '未知错误!';
break; // 0-接口参数错误(调试阶段使用)
} }
return $this->error($error, ''); return $this->error($error, '');
} }
@@ -43,7 +46,6 @@ class Index extends Admin{
} }
} }
public function logout() { public function logout() {
$user = model('User'); $user = model('User');
$user->logout(); $user->logout();
@@ -65,9 +67,9 @@ class Index extends Admin{
$keylist = array( $keylist = array(
array('name' => 'clear', 'title' => '更新缓存', 'type' => 'checkbox', 'help' => '', 'option' => array( array('name' => 'clear', 'title' => '更新缓存', 'type' => 'checkbox', 'help' => '', 'option' => array(
'cache' => '缓存数据', 'cache' => '缓存数据',
'log' => '日志数据' 'log' => '日志数据',
) ),
) ),
); );
$data = array( $data = array(
'keyList' => $keylist, 'keyList' => $keylist,

View File

@@ -20,7 +20,7 @@ class Link extends Admin{
$data = array( $data = array(
'list' => $list, 'list' => $list,
'page' => $list->render() 'page' => $list->render(),
); );
$this->assign($data); $this->assign($data);
$this->setMeta("友情链接"); $this->setMeta("友情链接");
@@ -45,7 +45,7 @@ class Link extends Admin{
} }
} else { } else {
$data = array( $data = array(
'keyList' => $link->keyList 'keyList' => $link->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("添加友链"); $this->setMeta("添加友链");
@@ -75,7 +75,7 @@ class Link extends Admin{
$data = array( $data = array(
'keyList' => $link->keyList, 'keyList' => $link->keyList,
'info' => $info 'info' => $info,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("编辑友链"); $this->setMeta("编辑友链");

View File

@@ -155,7 +155,7 @@ class Menu extends Admin{
public function importFile($tree = null, $pid = 0) { public function importFile($tree = null, $pid = 0) {
if ($tree == null) { if ($tree == null) {
$file = APP_PATH . "Admin/Conf/Menu.php"; $file = APP_PATH . "Admin/Conf/Menu.php";
$tree = require_once($file); $tree = require_once $file;
} }
$menuModel = D('Menu'); $menuModel = D('Menu');
foreach ($tree as $value) { foreach ($tree as $value) {

View File

@@ -40,7 +40,6 @@ class Model extends Admin{
return $this->fetch(); return $this->fetch();
} }
/** /**
* 新增页面初始化 * 新增页面初始化
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
@@ -149,7 +148,9 @@ class Model extends Admin{
*/ */
public function status() { public function status() {
$map['id'] = $this->request->param('ids'); $map['id'] = $this->request->param('ids');
if(null == $map['id'])return $this->error('参数不正确!'); if (null == $map['id']) {
return $this->error('参数不正确!');
}
$data['status'] = input('get.status'); $data['status'] = input('get.status');

View File

@@ -47,7 +47,7 @@ class Seo extends Admin{
} }
} else { } else {
$data = array( $data = array(
'keyList' => $this->seo->keyList 'keyList' => $this->seo->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("添加规则"); $this->setMeta("添加规则");
@@ -69,7 +69,7 @@ class Seo extends Admin{
$info = $this->seo->where(array('id' => $id))->find(); $info = $this->seo->where(array('id' => $id))->find();
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $this->seo->keyList 'keyList' => $this->seo->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("编辑规则"); $this->setMeta("编辑规则");
@@ -95,7 +95,7 @@ class Seo extends Admin{
$data = array( $data = array(
'list' => $list, 'list' => $list,
'page' => $list->render() 'page' => $list->render(),
); );
$this->assign($data); $this->assign($data);
$this->setMeta("路由规则"); $this->setMeta("路由规则");
@@ -112,7 +112,7 @@ class Seo extends Admin{
} }
} else { } else {
$data = array( $data = array(
'keyList' => $this->rewrite->keyList 'keyList' => $this->rewrite->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("添加路由规则"); $this->setMeta("添加路由规则");
@@ -133,7 +133,7 @@ class Seo extends Admin{
$info = db('Rewrite')->where(array('id' => $id))->find(); $info = db('Rewrite')->where(array('id' => $id))->find();
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $this->rewrite->keyList 'keyList' => $this->rewrite->keyList,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("编辑路由规则"); $this->setMeta("编辑路由规则");

View File

@@ -61,7 +61,7 @@ class User extends Admin{
} }
} else { } else {
$data = array( $data = array(
'keyList' => $model->addfield 'keyList' => $model->addfield,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("添加用户"); $this->setMeta("添加用户");
@@ -90,7 +90,7 @@ class User extends Admin{
$data = array( $data = array(
'info' => $info, 'info' => $info,
'keyList' => $model->editfield 'keyList' => $model->editfield,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("编辑用户"); $this->setMeta("编辑用户");
@@ -110,7 +110,6 @@ class User extends Admin{
return $this->success('删除用户成功!'); return $this->success('删除用户成功!');
} }
public function auth() { public function auth() {
$access = model('AuthGroupAccess'); $access = model('AuthGroupAccess');
$group = model('AuthGroup'); $group = model('AuthGroup');
@@ -144,7 +143,7 @@ class User extends Admin{
$data = array( $data = array(
'uid' => $uid, 'uid' => $uid,
'auth_list' => $auth_list, 'auth_list' => $auth_list,
'list' => $list 'list' => $list,
); );
$this->assign($data); $this->assign($data);
$this->setMeta("用户分组"); $this->setMeta("用户分组");
@@ -213,8 +212,7 @@ class User extends Admin{
session('user_auth', $user); session('user_auth', $user);
session('user_auth_sign', data_auth_sign($user)); session('user_auth_sign', data_auth_sign($user));
return $this->success('修改昵称成功!'); return $this->success('修改昵称成功!');
} } else {
else {
return $this->error('修改昵称失败!'); return $this->error('修改昵称失败!');
} }
} }

View File

@@ -1136,7 +1136,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
switch ($info['type']) { switch ($info['type']) {
case Relation::HAS_MANY: case Relation::HAS_MANY:
return $model->db()->alias('a') return $model->db()->alias('a')
->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey']) ->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey'], $info['joinType'])
->group('b.' . $info['foreignKey']) ->group('b.' . $info['foreignKey'])
->having('count(' . $id . ')' . $operator . $count); ->having('count(' . $id . ')' . $operator . $count);
case Relation::HAS_MANY_THROUGH: case Relation::HAS_MANY_THROUGH:
@@ -1169,7 +1169,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
} }
return $model->db()->alias('a') return $model->db()->alias('a')
->field('a.*') ->field('a.*')
->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey']) ->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey'], $info['joinType'])
->where($where); ->where($where);
case Relation::HAS_MANY_THROUGH: case Relation::HAS_MANY_THROUGH:
// TODO // TODO

View File

@@ -700,6 +700,16 @@ abstract class Connection
return $this->linkID->lastInsertId($sequence); return $this->linkID->lastInsertId($sequence);
} }
/**
* 获取返回或者影响的记录数
* @access public
* @return integer
*/
public function getNumRows()
{
return $this->numRows;
}
/** /**
* 获取最近的错误信息 * 获取最近的错误信息
* @access public * @access public

View File

@@ -1883,7 +1883,7 @@ class Query
} }
// 返回结果处理 // 返回结果处理
if ($resultSet) { if ($this->connection->getNumRows()) {
// 数据列表读取后的处理 // 数据列表读取后的处理
if (!empty($this->model)) { if (!empty($this->model)) {
// 生成模型对象 // 生成模型对象
@@ -1898,7 +1898,7 @@ class Query
} }
$resultSet[$key] = $result; $resultSet[$key] = $result;
} }
if (!empty($options['with'])) { if (!empty($options['with']) && $result instanceof Model) {
// 预载入 // 预载入
$resultSet = $result->eagerlyResultSet($resultSet, $options['with'], is_object($resultSet) ? get_class($resultSet) : ''); $resultSet = $result->eagerlyResultSet($resultSet, $options['with'], is_object($resultSet) ? get_class($resultSet) : '');
} }