Merge branch 'feature/add_compay_changelog' of wmtx/platform into release

优化日志
master
陈志 4 years ago committed by Gogs
commit 931aae95f9

@ -2583,7 +2583,7 @@ function getCompanyBlongOther($id = -1)
*/ */
function addOperationLog($options) function addOperationLog($options)
{ {
$checkarr = ['op_type','url','key']; $checkarr = ['op_type','key'];
foreach ($checkarr as $v) { foreach ($checkarr as $v) {
if(!array_key_exists($v,$options)){ if(!array_key_exists($v,$options)){
return false; return false;
@ -2592,6 +2592,9 @@ function addOperationLog($options)
if(!array_key_exists("op_name",$options)){ if(!array_key_exists("op_name",$options)){
$options['op_name'] = ($options['op_type'] == 1 ? "编辑" : ($options['op_type'] == 2 ? "删除" :($options['op_type'] == 3 ? "导出" :"新增"))); $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 //获取ip
$addarray = [ $addarray = [
"op_ip"=>$_SERVER['REMOTE_ADDR'], "op_ip"=>$_SERVER['REMOTE_ADDR'],

@ -289,14 +289,22 @@ class PromoteCompanyController extends ThinkController
if ($batchType == 1) { // 批量增加 if ($batchType == 1) { // 批量增加
$where['_string'] = "concat(',', game_ids, ',') not like \"%,{$gameId},%\""; $where['_string'] = "concat(',', game_ids, ',') not like \"%,{$gameId},%\"";
$exp = "trim(BOTH ',' FROM concat(game_ids, ',', {$gameId}))"; $exp = "trim(BOTH ',' FROM concat(game_ids, ',', {$gameId}))";
$op_name = "批量上架";
} }
if ($batchType == 2) { // 批量删除 if ($batchType == 2) { // 批量删除
$where['_string'] = "concat(',', game_ids, ',') like \"%,{$gameId},%\""; $where['_string'] = "concat(',', game_ids, ',') like \"%,{$gameId},%\"";
$exp = "trim(BOTH ',' FROM replace(concat(',', game_ids, ','), \",{$gameId},\", ','))"; $exp = "trim(BOTH ',' FROM replace(concat(',', game_ids, ','), \",{$gameId},\", ','))";
$op_name = "批量下架";
} }
M('promote', 'tab_')->where($where)->save([ M('promote', 'tab_')->where($where)->save([
'game_ids' => ['exp', $exp] '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([ M('promote_company', 'tab_')->where($where)->save([
'game_ids' => ['exp', $exp] 'game_ids' => ['exp', $exp]

Loading…
Cancel
Save