|
|
@ -890,9 +890,9 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$game_ids = '';
|
|
|
|
$game_ids = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->changePromoteGameids($id,$game_ids);
|
|
|
|
$res = M('promote_company', 'tab_')->where(['id'=>$id])->save(['game_ids'=>$game_ids]);
|
|
|
|
$res = M('promote_company', 'tab_')->where(['id'=>$id])->save(['game_ids'=>$game_ids]);
|
|
|
|
if ($res) {
|
|
|
|
if ($res) {
|
|
|
|
$this->changePromoteGameids($id,$game_ids);
|
|
|
|
|
|
|
|
$this->ajaxReturn(['code'=>1,'msg'=>'更新成功']);
|
|
|
|
$this->ajaxReturn(['code'=>1,'msg'=>'更新成功']);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$this->ajaxReturn(['code'=>0,'msg'=>'数据未发生变化']);
|
|
|
|
$this->ajaxReturn(['code'=>0,'msg'=>'数据未发生变化']);
|
|
|
@ -1029,12 +1029,11 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
$save['last_up_time'] = $time;
|
|
|
|
$save['last_up_time'] = $time;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
protected function changePromoteGameids($company_id,$game_ids){
|
|
|
|
protected function changePromoteGameids($company_id,$game_ids){
|
|
|
|
$is_change_game = false;
|
|
|
|
|
|
|
|
$old_info = M("PromoteCompany","tab_")->field("company_belong,develop_type,game_ids")->where("id = {$company_id}")->find();
|
|
|
|
$old_info = M("PromoteCompany","tab_")->field("company_belong,develop_type,game_ids")->where("id = {$company_id}")->find();
|
|
|
|
|
|
|
|
$is_change_game = false;
|
|
|
|
if($old_info['game_ids'] != $game_ids){
|
|
|
|
if($old_info['game_ids'] != $game_ids){
|
|
|
|
// $is_change_game = true;
|
|
|
|
|
|
|
|
$oids = explode(',', $old_info['game_ids']);
|
|
|
|
$oids = explode(',', $old_info['game_ids']);
|
|
|
|
$nids = explode(',', $save['game_ids']);
|
|
|
|
$nids = explode(',',$game_ids);
|
|
|
|
$diff_ids = [];
|
|
|
|
$diff_ids = [];
|
|
|
|
if(count($oids) == 0){
|
|
|
|
if(count($oids) == 0){
|
|
|
|
$is_change_game = false;
|
|
|
|
$is_change_game = false;
|
|
|
@ -1051,19 +1050,18 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
$is_change_game = true;
|
|
|
|
$is_change_game = true;
|
|
|
|
$diff_ids = $this->changeRelationGameidToGameid($diff_ids,true);
|
|
|
|
$diff_ids = $this->changeRelationGameidToGameid($diff_ids,true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($is_change_game) {
|
|
|
|
|
|
|
|
$Promote = M("Promote", "tab_");
|
|
|
|
$Promote = M("Promote", "tab_");
|
|
|
|
$dbres = $Promote->field("id,game_ids,company_belong,company_relation")->where("company_id = '{$company_id}'")->select();
|
|
|
|
if($is_change_game){
|
|
|
|
|
|
|
|
$dbres = $Promote->field("id,game_ids")->where("company_id = '{$company_id}'")->select();
|
|
|
|
foreach ($dbres as $k=>&$v) {
|
|
|
|
foreach ($dbres as $k=>&$v) {
|
|
|
|
$temp_ids = explode(',', $v['game_ids']);
|
|
|
|
$temp_ids = explode(',', $v['game_ids']);
|
|
|
|
$v['game_ids'] = implode(',', array_diff($temp_ids, $diff_ids));
|
|
|
|
$v['game_ids'] = implode(',', array_diff($temp_ids, $diff_ids));
|
|
|
|
$v['company_belong'] = $save['company_belong'];
|
|
|
|
|
|
|
|
$v['company_relation'] = $save['develop_type'];
|
|
|
|
|
|
|
|
$Promote->save($v);
|
|
|
|
$Promote->save($v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 由于修改公司信息引起的会长信息修改
|
|
|
|
* 由于修改公司信息引起的会长信息修改
|
|
|
|