Merge remote-tracking branch 'origin/feature/operation_log' into feature/operation_log

master
zhengyongxing 5 years ago
commit 67ab1fa89e

@ -2205,7 +2205,7 @@ function a_array_unique($array){
* op_name=>操作说明 例如:编辑,删除,锁定等,
* url=>需要跳转的url 添加去列表加唯一id编辑直接去编辑页面下载可以重新下载(新开页面),
* key=>关键词:用户的账号,游戏的名词等,
* menu=>非必须,菜单目录,不存在的话按控制器寻找
* menu=>非必须,菜单目录,不存在的话按控制器寻找
* )
*/
function addOperationLog($options)

@ -5630,7 +5630,7 @@ class ExportController extends Controller
}
$this->exportAddOperationLog('GameType/lists','游戏-游戏管理-游戏类型-导出');
$this->exportExcel($xlsName, $xlsCell, $xlsData);
}

@ -82,6 +82,13 @@ class GameTypeController extends ThinkController {
public function set_status($model="GameType")
{
$id = I("ids");
$key = M("GameType","tab_")->where("id={$id}")->find()['type_name'];
addOperationLog(array(
"op_type"=>1,
"key"=>$key,
"url"=>U("GameType/lists")
));
parent::set_status($model);
}
}

@ -457,7 +457,19 @@ class ThinkController extends AdminController {
$Model = D(get_table_name($model['id']));
$map = array('id' => array('in', $ids) );
if(CONTROLLER_NAME == "GameType"){
$yres = $Model->where($map)->select();
}
if($Model->where($map)->delete()){
if(CONTROLLER_NAME == "GameType"){
foreach ($yres as $k => $v) {
addOperationLog(array(
"op_type"=>2,
"key"=>$v['type_name'],
"url"=>U("GameType/lists")
));
}
}
$this->success('删除成功',$url);
} else {
$this->error('删除失败!');
@ -483,6 +495,13 @@ class ThinkController extends AdminController {
$Model = $this->checkAttr($Model,$model['id']);
if($Model->create() && $Model->save() !== false){
\Think\Log::actionLog(CONTROLLER_NAME.'/edit',$model,1);
if(CONTROLLER_NAME == "GameType"){
addOperationLog(array(
"op_type"=>1,
"key"=>$_POST['type_name'],
"url"=>U("GameType/lists")
));
}
$this->success('保存'.$model['title'].'成功!',empty($url)? U('lists?model='.$model['name']):$url);
} else {
$this->error($Model->getError());//,empty($url)? U('lists?model='.$model['name']):$url
@ -514,6 +533,14 @@ class ThinkController extends AdminController {
if($Model->create() && $Model->add()){//
\Think\Log::actionLog(CONTROLLER_NAME.'/add',$model,1);
//操作日志
if(CONTROLLER_NAME == "GameType"){
addOperationLog(array(
"op_type"=>0,
"key"=>$_POST['type_name'],
"url"=>U("GameType/lists")
));
}
$this->success('添加'.$model['title'].'成功!', empty($url)? U('lists?model='.$model['name']):$url);
} else {
$this->error($Model->getError());

Loading…
Cancel
Save