diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index 8b2c68a29..54596f491 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -182,6 +182,8 @@ class CompanyStatementSetController extends Controller { // TODO:此处不判断现游戏名=原包名,但却不是同一款游戏 $verify_log=json_encode(["create_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"create_time"=>date("Y-m-d H:i:s")]); $GameDb = M("Game","tab_"); + $StatementDb = M("CompanyStatement","tab_"); + $statement_begin_time = date("Y-m-d",$begintime); $statement_end_time = date("Y-m-d",$endtime); foreach($cpList as $k=>$v){ @@ -250,16 +252,51 @@ class CompanyStatementSetController extends Controller { $game['statement_end_time']=$statement_end_time; $game['statement_type']=0; $add_data['statement_info'][] = $game; - + } + $add_data['platform_amount'] = $add_data['pay_amount']; + //奖罚 + $rrmap = array( + "reward_time" => ['between', [$begintime,$endtime]], + "company_type"=>1, + "company_id"=>$add_data['company_id'] + ); + $rfres = M("RewardRecord","tab_") + ->field(" + IFNULL(SUM(CASE WHEN reward_type = 1 THEN money ELSE 0 END),0) as reward_count, + IFNULL(SUM(CASE WHEN reward_type = 2 THEN money ELSE 0 END),0) as fine_count + ") + ->where($rrmap)->find(); + if($rfres['reward_count'] > 0){ + $reward_count = $rfres['reward_count']; + $add_data['statement_info'][] = array( + "statement_begin_time"=>$statement_begin_time, + "statement_end_time"=>$statement_end_time, + 'statement_type'=>2, + "game_name"=>"奖励", + 'pay_amount'=>$reward_count, + 'sum_money'=>$reward_count, + ); + $add_data['statement_money']+=$reward_count; + $add_data['pay_amount']+=$reward_count; + } + if($rfres['fine_count'] > 0){ + $fine_count = $rfres['fine_count']; + $add_data['statement_info'][] = array( + "statement_begin_time"=>$statement_begin_time, + "statement_end_time"=>$statement_end_time, + 'statement_type'=>1, + "game_name"=>"罚款", + 'pay_amount'=>$fine_count, + 'sum_money'=>$fine_count, + ); + $add_data['statement_money'] -= $fine_count; + $add_data['pay_amount'] -= $fine_count;; } - dd($add_data); - dd($v); - //获取游戏比例 - + $add_data['statement_info'] = json_encode($add_data['statement_info'],JSON_UNESCAPED_UNICODE); + //添加 + $StatementDb->add($add_data); } - - # code... } /**