diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index a30a8d1ed..6c877ad5e 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2583,7 +2583,7 @@ function getCompanyBlongOther($id = -1) */ function addOperationLog($options) { - $checkarr = ['op_type','url','key']; + $checkarr = ['op_type','key']; foreach ($checkarr as $v) { if(!array_key_exists($v,$options)){ return false; @@ -2592,6 +2592,9 @@ function addOperationLog($options) if(!array_key_exists("op_name",$options)){ $options['op_name'] = ($options['op_type'] == 1 ? "编辑" : ($options['op_type'] == 2 ? "删除" :($options['op_type'] == 3 ? "导出" :"新增"))); } + if(!array_key_exists("url",$options)){ + $options['url'] = MODULE_NAME."/".CONTROLLER_NAME."/".ACTION_NAME; + } //获取ip $addarray = [ "op_ip"=>$_SERVER['REMOTE_ADDR'], diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 908635d09..0d47f5553 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -289,14 +289,22 @@ class PromoteCompanyController extends ThinkController if ($batchType == 1) { // 批量增加 $where['_string'] = "concat(',', game_ids, ',') not like \"%,{$gameId},%\""; $exp = "trim(BOTH ',' FROM concat(game_ids, ',', {$gameId}))"; + $op_name = "批量上架"; } if ($batchType == 2) { // 批量删除 $where['_string'] = "concat(',', game_ids, ',') like \"%,{$gameId},%\""; $exp = "trim(BOTH ',' FROM replace(concat(',', game_ids, ','), \",{$gameId},\", ','))"; + $op_name = "批量下架"; } M('promote', 'tab_')->where($where)->save([ 'game_ids' => ['exp', $exp] ]); + //加入日志 + $companys = M('promote_company', 'tab_')->field("id")->where($where)->select(); + if(!empty($companys)){ + $company_ids = implode(",",array_column($companys,"id")); + addOperationLog(['op_type'=>1,'key'=>"","op_name"=>$op_name,"content"=>json_encode(["company_id"=>$company_ids,"batchCompanyType"=>$batchCompanyType,"game_id"=>$gameId,'batch_type'=>$batchType])]); + } M('promote_company', 'tab_')->where($where)->save([ 'game_ids' => ['exp', $exp]