diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index 1db73a6e0..54eca4274 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -256,7 +256,6 @@ class CompanyStatementSetController extends Controller { $verify_log=json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]); $GameDb = M("Game","tab_"); $StatementDb = SM("CompanyStatement","tab_"); - dump($cpList); $statement_begin_time = date("Y.m.d",$begintime); $statement_end_time = date("Y.m.d",$endtime); foreach($cpList as $k=>$v){ @@ -425,7 +424,6 @@ class CompanyStatementSetController extends Controller { //非重算 return $add_data; } - dump($add_data); $StatementDb->add($add_data); } @@ -452,7 +450,8 @@ class CompanyStatementSetController extends Controller { "payed_time"=>["BETWEEN",[$begintime,$endtime]], "game_id"=>["in",$gmstr] ]; - $paydb = SM('spend','tab_'); + D("Spend")->addSubsiteWhere($paywhere); + $paydb = M('spend','tab_'); $paylist = $paydb->field("game_id,SUM(pay_amount) pay_amount")->where($paywhere)->group("game_id")->select(); if(empty($paylist)){ return []; @@ -536,6 +535,7 @@ class CompanyStatementSetController extends Controller { "s.payed_time"=>['between', [$begintime,$endtime]], "s.promote_id"=>0 ]; + D("Spend")->addSubsiteWhere($spenMap,"s"); $list = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,g.relation_game_id,g.relation_game_name game_name')->where($spenMap)->group('relation_game_id') ->join("left join tab_game g on s.game_id = g.id") ->select(); @@ -560,7 +560,7 @@ class CompanyStatementSetController extends Controller { //非重算 return $add_data; } - M("CompanyStatement","tab_")->add($add_data); + SM("CompanyStatement","tab_")->add($add_data); } /** @@ -654,7 +654,7 @@ class CompanyStatementSetController extends Controller { //数据整合 $verify_log=json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]); - $StatementDb = M("CompanyStatement","tab_"); + $StatementDb = SM("CompanyStatement","tab_"); $statement_begin_time = date("Y.m.d",$begintime); $statement_end_time = date("Y.m.d",$endtime); @@ -955,14 +955,17 @@ class CompanyStatementSetController extends Controller { "s.payed_time"=>['between', [$begintime,$endtime]], "s.is_check"=>1 ]; + D("Spend")->addSubsiteWhere($spenMap); $cpMap = [ "s.pay_status"=>1, "s.payed_time"=>['between', [$begintime,$endtime]] ]; + D("Spend")->addSubsiteWhere($cpMap); $cpAllMap =[ "s.pay_status"=>1, "s.payed_time"=>['elt',$endtime] ]; + D("Spend")->addSubsiteWhere($cpAllMap); for ($i=0; $i ['between', [$begintime,$endtime]], "s.is_check"=>1 ]; + D("Spend")->addSubsiteWhere($spenMap,"s"); $cpallgame = []; $cpgame = []; $cpMap = [ "s.pay_status"=>1, "s.payed_time"=>['between', [$begintime,$endtime]] ]; - + D("Spend")->addSubsiteWhere($cpMap,"s"); $cpAllMap = [ "s.pay_status"=>1, "s.payed_time"=>['elt',$endtime] ]; + D("Spend")->addSubsiteWhere($cpAllMap,"s"); // unset($cpAllMap["s.payed_time"]); for ($i=0; $i add($data); + $id = SM("company_statement_pool","tab_")->add($data); //回写 if(!empty($info)){ $save["pool_id"]=$id; - M("company_statement_info","tab_")->where("id in ({$info})")->save($save); + SM("company_statement_info","tab_")->where("id in ({$info})")->save($save); } if(!empty($data['del_lack_ids'])){ - M("company_lack_statement_info","tab_")->where("id in ({$data['del_lack_ids']})")->save(["is_pool"=>1]); + SM("company_lack_statement_info","tab_")->where("id in ({$data['del_lack_ids']})")->save(["is_pool"=>1]); } } @@ -2150,6 +2155,7 @@ class CompanyStatementSetController extends Controller { $game_id = D("Game")->changeRelationGameidToGameid($relation_game_id); // dd($game_id); $spenMap['s.game_id'] =['in',$game_id]; + D("Spend")->addSubsiteWhere($spenMap); //获取支付记录 $pay_amount = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount')->where($spenMap)->find(); return $pay_amount['pay_amount'] ?? 0; @@ -2166,6 +2172,7 @@ class CompanyStatementSetController extends Controller { "s.payed_time"=>['between', [$begintime,$endtime]], "s.is_check"=>1 ]; + D("Spend")->addSubsiteWhere($spenMap); $Pmap = [ "chain"=>["LIKE","%/{$promote_id}/%"], @@ -2306,7 +2313,7 @@ class CompanyStatementSetController extends Controller { public function updateCompanyStatementData($id,$admin_user='system') { //获取数据 - $StatementDb = M("CompanyStatement","tab_"); + $StatementDb = SM("CompanyStatement","tab_"); $dbres = $StatementDb->where("id='{$id}'")->find(); //获取时间 $stime = $dbres['statement_end_time']-0+1;