后台代码格式化,内核更新
This commit is contained in:
@@ -26,62 +26,62 @@ class Action extends Admin {
|
||||
// 记录当前列表页的cookie
|
||||
Cookie('__forward__', $_SERVER['REQUEST_URI']);
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'page' => $list->render()
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('用户行为');
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新建用户行为
|
||||
* @author colin <colin@tensent.cn>
|
||||
*/
|
||||
public function add(){
|
||||
public function add() {
|
||||
$model = model('Action');
|
||||
if(IS_POST){
|
||||
$data = input('post.');
|
||||
if (IS_POST) {
|
||||
$data = input('post.');
|
||||
$result = $model->save($data);
|
||||
if (false != $result) {
|
||||
action_log('add_action', 'Action', $result, session('user_auth.uid'));
|
||||
return $this->success('添加成功!',url('index'));
|
||||
}else{
|
||||
return $this->success('添加成功!', url('index'));
|
||||
} else {
|
||||
return $this->error($model->getError());
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$data = array(
|
||||
'keyList' => $model->fieldlist
|
||||
'keyList' => $model->fieldlist,
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta("添加行为");
|
||||
return $this->fetch('public/edit');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑用户行为
|
||||
* @author colin <colin@tensent.cn>
|
||||
*/
|
||||
public function edit($id = null){
|
||||
public function edit($id = null) {
|
||||
$model = model('Action');
|
||||
if(IS_POST){
|
||||
$data = input('post.');
|
||||
$result = $model->save($data, array('id'=>$data['id']));
|
||||
if (IS_POST) {
|
||||
$data = input('post.');
|
||||
$result = $model->save($data, array('id' => $data['id']));
|
||||
if ($result !== false) {
|
||||
action_log('edit_action', 'Action', $id, session('user_auth.uid'));
|
||||
return $this->success('编辑成功!',url('index'));
|
||||
}else{
|
||||
return $this->success('编辑成功!', url('index'));
|
||||
} else {
|
||||
return $this->error($model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $model::where(array('id'=>$id))->find();
|
||||
} else {
|
||||
$info = $model::where(array('id' => $id))->find();
|
||||
if (!$info) {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'keyList' => $model->fieldlist
|
||||
'info' => $info,
|
||||
'keyList' => $model->fieldlist,
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta("编辑行为");
|
||||
@@ -93,17 +93,17 @@ class Action extends Admin {
|
||||
* 删除用户行为状态
|
||||
* @author colin <colin@tensent.cn>
|
||||
*/
|
||||
public function del(){
|
||||
public function del() {
|
||||
$id = $this->getArrayParam('id');
|
||||
if(empty($id)){
|
||||
return $this->error("非法操作!",'');
|
||||
if (empty($id)) {
|
||||
return $this->error("非法操作!", '');
|
||||
}
|
||||
$map['id'] = array('IN',$id);
|
||||
$result = db('Action')->where($map)->delete();
|
||||
$map['id'] = array('IN', $id);
|
||||
$result = db('Action')->where($map)->delete();
|
||||
if ($result) {
|
||||
action_log('delete_action', 'Action', $id, session('user_auth.uid'));
|
||||
return $this->success('删除成功!');
|
||||
}else{
|
||||
} else {
|
||||
return $this->error('删除失败!');
|
||||
}
|
||||
}
|
||||
@@ -112,23 +112,23 @@ class Action extends Admin {
|
||||
* 修改用户行为状态
|
||||
* @author colin <colin@tensent.cn>
|
||||
*/
|
||||
public function setstatus(){
|
||||
public function setstatus() {
|
||||
$id = $this->getArrayParam('id');
|
||||
if(empty($id)){
|
||||
return $this->error("非法操作!",'');
|
||||
if (empty($id)) {
|
||||
return $this->error("非法操作!", '');
|
||||
}
|
||||
$status = input('get.status','','trim,intval');
|
||||
$message = !$status ? '禁用' : '启用';
|
||||
$map['id'] = array('IN',$id);
|
||||
$result = db('Action')->where($map)->setField('status',$status);
|
||||
$status = input('get.status', '', 'trim,intval');
|
||||
$message = !$status ? '禁用' : '启用';
|
||||
$map['id'] = array('IN', $id);
|
||||
$result = db('Action')->where($map)->setField('status', $status);
|
||||
if ($result !== false) {
|
||||
action_log('setstatus_action', 'Action', $id, session('user_auth.uid'));
|
||||
return $this->success('设置'.$message.'状态成功!');
|
||||
}else{
|
||||
return $this->error('设置'.$message.'状态失败!');
|
||||
return $this->success('设置' . $message . '状态成功!');
|
||||
} else {
|
||||
return $this->error('设置' . $message . '状态失败!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 行为日志列表
|
||||
* @author huajie <banhuajie@163.com>
|
||||
@@ -141,10 +141,10 @@ class Action extends Admin {
|
||||
$order = "id desc";
|
||||
//获取列表数据
|
||||
$list = model('ActionLog')->where($map)->order($order)->paginate(10);
|
||||
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'page' => $list->render()
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('行为日志');
|
||||
@@ -159,16 +159,16 @@ class Action extends Admin {
|
||||
if (empty($id)) {
|
||||
return $this->error('参数错误!');
|
||||
}
|
||||
|
||||
|
||||
$info = $model::get($id);
|
||||
|
||||
$info['title'] = get_action($info['action_id'],'title');
|
||||
$info['user_id'] = get_username($info['user_id']);
|
||||
$info['action_ip'] = long2ip($info['action_ip']);
|
||||
$info['create_time'] = date('Y-m-d H:i:s',$info['create_time']);
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'keyList' => $model->keyList
|
||||
$info['title'] = get_action($info['action_id'], 'title');
|
||||
$info['user_id'] = get_username($info['user_id']);
|
||||
$info['action_ip'] = long2ip($info['action_ip']);
|
||||
$info['create_time'] = date('Y-m-d H:i:s', $info['create_time']);
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'keyList' => $model->keyList,
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('查看行为日志');
|
||||
@@ -181,11 +181,11 @@ class Action extends Admin {
|
||||
*/
|
||||
public function dellog() {
|
||||
$id = $this->getArrayParam('id');
|
||||
if(empty($id)){
|
||||
return $this->error("非法操作!",'');
|
||||
if (empty($id)) {
|
||||
return $this->error("非法操作!", '');
|
||||
}
|
||||
$map['id'] = array('IN',$id);
|
||||
$res = db('ActionLog')->where($map)->delete();
|
||||
$map['id'] = array('IN', $id);
|
||||
$res = db('ActionLog')->where($map)->delete();
|
||||
if ($res !== false) {
|
||||
action_log('delete_actionlog', 'ActionLog', $id, session('user_auth.uid'));
|
||||
return $this->success('删除成功!');
|
||||
@@ -202,8 +202,7 @@ class Action extends Admin {
|
||||
//记录行为
|
||||
action_log('clear_actionlog', 'ActionLog', $id, session('user_auth.uid'));
|
||||
return $this->success('日志清空成功!');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return $this->error('日志清空失败!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user