内部公司功能完善

master
zhengyongxing 4 years ago
parent ab9be65422
commit ceef36a7d1

@ -1426,6 +1426,16 @@ class CompanyStatementController extends ThinkController
$data = json_decode($_REQUEST['data'],true);
$company_ids = implode(',',array_column($data,'company_id'));
if ($company_ids) {
$inside = M("promote_company",'tab_')->field("company_name")->where(['id'=>['in',$company_ids],'is_inside'=>1])->select();
$inside = implode(',',array_column($inside,'company_name'));
$this->ajaxReturn(['status'=>0,'msg'=>$inside.'为内部公司不能添加特殊补点']);
}
$withdraw_type = 3;
$statement_data = [];
M()->startTrans();

@ -26,6 +26,37 @@ class OldCountController extends \Think\Controller
echo "changeCompanyGameidToPromoteGameid success";
}
public function changeDevelopTypeData() {
$is_save = M("promote","tab_")->where(['company_relation'=>2])->save(['company_relation'=>1]);
$is_save = M("promote_company","tab_")->where(['develop_type'=>2])->save(['develop_type'=>1]);
//更新tab_company_statement_info表的数据
$company_statement = M("company_statement_info","tab_")->field("id,company_info")->where(['company_info'=>['like',"%自主开发及维护%"]])->select();
foreach ($company_statement as $key => $value) {
$replace_statement = str_replace('自主开发及维护','自主开发',$value['company_info']);
M("company_statement_info","tab_")->where(['id'=>$value['id']])->save(['company_info'=>$replace_statement]);
}
//更新tab_company_lack_statement_info表的数据
$company_statement = M("company_lack_statement_info","tab_")->field("id,company_info")->where(['company_info'=>['like',"%自主开发及维护%"]])->select();
foreach ($company_statement as $key => $value) {
$replace_statement = str_replace('自主开发及维护','自主开发',$value['company_info']);
M("company_lack_statement_info","tab_")->where(['id'=>$value['id']])->save(['company_info'=>$replace_statement]);
}
echo "success\n";
}
/**
* 公会关系及游戏迁移
* 1. 迁移 公会company_relation到公司

@ -1295,6 +1295,7 @@ class PromoteCompanyController extends ThinkController
* @return void
*/
protected function getGamePromoteCompanyRadio($company_id,$game_ids,$is_export = false){
$is_inside = M("PromoteCompany","tab_")->field("is_inside")->where("id='{$company_id}'")->find()['is_inside'];
//判断是否有生效
$senddata = [];
$game = $this->getGameInfo($game_ids);
@ -1312,10 +1313,10 @@ class PromoteCompanyController extends ThinkController
foreach ($cgr_res as $k => $v) {
$t_gid = $v['relation_game_id'];
unset($game_arr[$t_gid]);
$senddata[$t_gid] = ["turnover_ratio"=>$v['turnover_ratio'],"ratio"=>$v['ratio'],"relation_game_id"=>$v['relation_game_id']];
$senddata[$t_gid] = ["turnover_ratio"=>$v['turnover_ratio'],"ratio"=>!$is_inside?$v['ratio']:0,"relation_game_id"=>$v['relation_game_id']];
$senddata[$t_gid] += $game[$t_gid];
$this->setPromoteRadio($senddata[$t_gid]);
$this->setPromoteRadio($senddata[$t_gid],$is_inside);
if($is_export){
if(isset($CpRadio[$t_gid])){
@ -1342,6 +1343,7 @@ class PromoteCompanyController extends ThinkController
$diff_ids = implode(",",array_keys($game_arr));
$company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
$mwhere = "company_belong='{$company_belong}' and relation_game_id in ({$diff_ids})";
$m_res = M("GameRatioMould","tab_")->where($mwhere)->select();
@ -1349,9 +1351,9 @@ class PromoteCompanyController extends ThinkController
foreach ($m_res as $k => $v) {
$t_gid = $v['relation_game_id'];
unset($game_arr[$t_gid]);
$senddata[$t_gid] = ["turnover_ratio"=>$v['turnover_ratio'],"ratio"=>$v['ratio'],"relation_game_id"=>$v['relation_game_id']];
$senddata[$t_gid] = ["turnover_ratio"=>$v['turnover_ratio'],"ratio"=>!$is_inside?$v['ratio']:0,"relation_game_id"=>$v['relation_game_id']];
$senddata[$t_gid] += $game[$t_gid];
$this->setPromoteRadio($senddata[$t_gid]);
$this->setPromoteRadio($senddata[$t_gid],$is_inside);
if($is_export){
if(isset($CpRadio[$t_gid])){
$senddata[$t_gid]["cp_ratio"] = $CpRadio[$t_gid];
@ -1465,14 +1467,14 @@ class PromoteCompanyController extends ThinkController
return $parseGameRadiores;
}
//设置比例阶梯
protected function setPromoteRadio(&$v){
protected function setPromoteRadio(&$v,$is_inside=0){
$turnover_ratio = json_decode($v['turnover_ratio'],true);
$v['turnover_ratio'] = array(
array("ratio"=>floatval($v['ratio'])."%","name"=>"默认比例")
array("ratio"=>floatval(!$is_inside?$v['ratio']:0)."%","name"=>"默认比例")
);
foreach($turnover_ratio as $ke=>$va){
$t=array("ratio"=>floatval($va["ratio"])."%");
$t=array("ratio"=>floatval(!$is_inside?$va["ratio"]:0)."%");
if(array_key_exists("instanceof",$va)){
//存在
if($va['instanceof']=='1'){

@ -356,7 +356,7 @@
} else {
is_submit = 1;
layer.msg("未知错误");
layer.msg(result.msg);
}
layer.closeAll("loading");
}});

Loading…
Cancel
Save