diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index bfad9f77e..1f1bd0a52 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -1096,6 +1096,10 @@ class CompanyStatementSetController extends Controller { ->join("left join tab_game g on s.game_id = g.id") ->select(); + if ($company_id == 64) { + dump($all_list); + } + if(empty($list)){continue;} $game = []; foreach($list as $k=>$v){ @@ -1125,7 +1129,6 @@ class CompanyStatementSetController extends Controller { $temp = 0; for ($j=0; $j < count($v); $j++) { $turnover_type = $this->getTurnoverType($v[$j],$company_id,$begintime,$endtime); - if ($turnover_type == 2) { $temp += $allgame[$v[$j]]['pay_amount']; } else { @@ -1156,7 +1159,18 @@ class CompanyStatementSetController extends Controller { }else{ unset($v['game_id']); $res[$company_id][$p_account][$v['relation_game_id']]= $v; - $res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $game[$v['relation_game_id']]['pay_amount']; + + $turnover_type = $this->getTurnoverType($v['relation_game_id'],$company_id,$begintime,$endtime); + + if ($turnover_type == 2) { +// $temp += $allgame[$v[$j]]['pay_amount']; + $res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $allgame[$v['relation_game_id']]['pay_amount']; + } else { +// $res[$company_id][$v[$j]]['ratio_pay_amount'] = $res[$company_id][$v[$j]]['pay_amount']; + $res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $game[$v['relation_game_id']]['pay_amount']; + } + +// $res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $game[$v['relation_game_id']]['pay_amount']; $res[$company_id][$p_account][$v['relation_game_id']]['game_type_name'] = $this->getGameTypeName($v['relation_game_id']); } } @@ -1291,7 +1305,7 @@ class CompanyStatementSetController extends Controller { unset($tmpp); $this->getPuPromoteSpend($pc,array_unique(array_keys($pc)),$begintime,$endtime); - + $StatementDb = M("CompanyStatement","tab_"); $statement_begin_time = date("Y.m.d",$begintime); $statement_end_time = date("Y.m.d",$endtime); diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index c16dbb7a0..2971aacf5 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -346,7 +346,7 @@ class MarketPercentageController extends ThinkController $data = array_merge($data,[$sum]); - data2csv($data,'市场毛利统计',$title); + data2csv($data,'市场毛利统计(不结算)',$title); } $count = M("settleup_marketorder","tab_") @@ -1585,6 +1585,7 @@ class MarketPercentageController extends ThinkController if ($data['is_start']) { $time_start = $company_belong_game_data['begin_time']; + $data['begin_time'] = $company_belong_game_data['begin_time']; } $last_month = strtotime(date('Y-m-t',strtotime("-2 month"))); @@ -1598,9 +1599,13 @@ class MarketPercentageController extends ThinkController if ($data['begin_time'] < $last_month && $data['end_time'] <= $last_month) { - $this->ajaxReturn(['msg'=>"已经结算过的时间不能修改","status"=>0]); - } elseif ($data['begin_time'] <= $last_month && $data['end_time'] > $last_month) { - $data['begin_time'] = strtotime(date('Y-m-1',strtotime("-1 month"))); + + if($company_belong_game_data['end_time']<= $last_month) { + $data['end_time'] = $company_belong_game_data['end_time']; + } else { + $data['end_time'] = $last_month; + } + } $belong_game = M("company_belong_game","tab_") @@ -1637,7 +1642,6 @@ class MarketPercentageController extends ThinkController $game_ids[$key] = $value-0; } - } $data['is_start'] = 0; if($data['begin_time']where(['pay_time'=>$map['pay_time'],'is_settlement'=>0]) + ->delete(); + } else { + M("settleup_marketorder","tab_") + ->where('1=1') + ->delete(); + } $data = M("auth_group") ->where(['title'=>['like','%市场%']]) @@ -1041,6 +1050,10 @@ class TimingController extends AdminController { } + if (!$spend_map['_string']) { + $spend_map['_string'] = "relation_game_id = 0"; + } + $spend = M("spend","tab_") ->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(pay_time,'%Y-%m') pay_time, substring_index(substring_index(tab_spend.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_spend.sdk_version, @@ -1416,12 +1429,14 @@ class TimingController extends AdminController { do { $date = date('Y-m', strtotime($start . ' + ' . $i . ' month')); $i++; + M("market_altogether","tab_")->where(['pay_time'=>$date])->delete(); $this->insertAllUserBonus($date); } while ($date < date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'))); // $map['pay_time'] = []; unset($map['pay_time']); } else{ + M("market_altogether","tab_")->where(['pay_time'=>$pay_time])->delete(); $this->insertAllUserBonus($pay_time); } diff --git a/Application/Admin/View/MarketPercentage/editcompanybelonggame.html b/Application/Admin/View/MarketPercentage/editcompanybelonggame.html index 99380c9fc..54d05124a 100644 --- a/Application/Admin/View/MarketPercentage/editcompanybelonggame.html +++ b/Application/Admin/View/MarketPercentage/editcompanybelonggame.html @@ -117,7 +117,7 @@ *游戏: - 选择游戏 + 选择游戏 @@ -296,9 +296,13 @@ //获取游戏列表 var url = "{:U('MarketPercentage/getPromoteGame')}"; var id = $(this).attr('data-id'); + var is_show = $(this).attr('data-is'); var checked = 'checked'; - + if (is_show == 1) { + layer.msg("已经结算过的时间不能修改游戏"); + return; + } $.post(url,{id:id},function(res){ if(res.code==1){