优化财务汇总测试收入

master
chenzhi 4 years ago
parent f405faa924
commit eb2cd7d50f

@ -196,38 +196,38 @@ class FinancialSummarySetController extends \Think\Controller
"type"=>1,
"sort"=>5
);
//获取测试白名单
$testlist = M("TestWhiteList",'tab_')->field("user_id")->select();
if($testlist){
$testlist = implode(",",array_column($testlist, 'user_id'));
}else{
$testlist = false;
}
//获取现金充值
$map = array(
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1,
"pay_way"=>array("GT",0)
);
if($testlist) $map['user_id']=array("in",$testlist);
$cash_spend = $this->SpendModel
->field("IFNULL(SUM(pay_amount),0) as pay_amount")
->where($map)
->find()['pay_amount'];
//获取平台币充值
$map1 = array(
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
);
if($testlist) $map1['user_id']=array("in",$testlist);
$deposit = $this->DepositModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount'];
// //获取测试白名单
// $testlist = M("TestWhiteList",'tab_')->field("user_id")->select();
// if($testlist){
// $testlist = implode(",",array_column($testlist, 'user_id'));
// }else{
// $testlist = false;
// }
// //获取现金充值
// $map = array(
// "payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
// "pay_status"=>1,
// "pay_way"=>array("GT",0)
// );
// if($testlist) $map['user_id']=array("in",$testlist);
// $cash_spend = $this->SpendModel
// ->field("IFNULL(SUM(pay_amount),0) as pay_amount")
// ->where($map)
// ->find()['pay_amount'];
// //获取平台币充值
// $map1 = array(
// "payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
// "pay_status"=>1
// );
// if($testlist) $map1['user_id']=array("in",$testlist);
// $deposit = $this->DepositModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount'];
//测试订单录入
$map2 = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth))
);
$test_pay_amount = $this->TestOrderModel->where($map2)->field("IFNULL(sum(pay_amount),0) pay_amount")->find()['pay_amount'];
$temparr['sum_money'] = number_format(($cash_spend*100 + $deposit*100 + $test_pay_amount*100 )/100, 2, '.', '');
$temparr['sum_money'] = number_format(($test_pay_amount*100 )/100, 2, '.', '');
$this->adddata[]=$temparr;
}

Loading…
Cancel
Save