|
|
|
@ -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'){
|
|
|
|
|