|
|
|
@ -32,6 +32,8 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
$this->SpendModel = M("Spend",'tab_');
|
|
|
|
|
$this->GameSupersignModel = M("GameSupersign",'tab_');
|
|
|
|
|
$this->CoinPayOrderModel = M("CoinPayOrder",'tab_');//会长充值平台币表
|
|
|
|
|
$this->TestOrderModel = M("TestOrder",'tab_');//测试订单录入
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -85,16 +87,23 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
if($countRes > 0){
|
|
|
|
|
die("error:Repeated statistics,msg:{$this->date}已经聚合过");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//按收入类型
|
|
|
|
|
echo "{$this->date}开始统计".PHP_EOL;
|
|
|
|
|
echo "--收入类型统计中".PHP_EOL;
|
|
|
|
|
$this->setIncomeMoney();
|
|
|
|
|
//按合作方类型
|
|
|
|
|
|
|
|
|
|
echo "--合作方类型统计中".PHP_EOL;
|
|
|
|
|
$this->setPromoteMoney();
|
|
|
|
|
//支付渠道/支付类型
|
|
|
|
|
$this->setPayWayMoney();
|
|
|
|
|
//按支付商户
|
|
|
|
|
//
|
|
|
|
|
echo "--支付渠道统计中".PHP_EOL;
|
|
|
|
|
$this->setChannelMoney();
|
|
|
|
|
|
|
|
|
|
echo "--支付类型统计中".PHP_EOL;
|
|
|
|
|
$this->setPaywayMoney();
|
|
|
|
|
|
|
|
|
|
echo "--支付商户统计中".PHP_EOL;
|
|
|
|
|
$this->setMerchantMoney();
|
|
|
|
|
//存入数据
|
|
|
|
|
|
|
|
|
|
echo "--数据保存".PHP_EOL;
|
|
|
|
|
$this->addDb();
|
|
|
|
|
|
|
|
|
|
$t2 = microtime(true);
|
|
|
|
@ -210,7 +219,7 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
$map2 = array(
|
|
|
|
|
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth))
|
|
|
|
|
);
|
|
|
|
|
$test_pay_amount = M("TestOrder")->where($map2)->field("IFNULL(sum(pay_amount),0) pay_amount")->find()['pay_amount'];
|
|
|
|
|
$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, '.', '');
|
|
|
|
|
|
|
|
|
@ -402,8 +411,20 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
->group("p.channel")
|
|
|
|
|
->where($co_map)
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
$dbres = array_merge($spres,$ssres,$dpres,$cores);
|
|
|
|
|
|
|
|
|
|
//测试的订单
|
|
|
|
|
$to_map =[
|
|
|
|
|
"s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
|
"s.merchant_id"=>["GT","0"]
|
|
|
|
|
];
|
|
|
|
|
$tores=$this->TestOrderModel
|
|
|
|
|
->alias("s")
|
|
|
|
|
->field("SUM(s.pay_amount) pay_amount,p.channel")
|
|
|
|
|
->join("left join tab_payment_merchant p ON p.id = s.merchant_id")
|
|
|
|
|
->group("p.channel")
|
|
|
|
|
->where($to_map)
|
|
|
|
|
->select();
|
|
|
|
|
$dbres = array_merge($spres,$ssres,$dpres,$cores,$tores);
|
|
|
|
|
foreach ($dbres as $k=>$v){
|
|
|
|
|
$Channel[$v['channel']] = $Channel[$v['channel']]-0;
|
|
|
|
|
$Channel[$v['channel']] += $v['pay_amount'];
|
|
|
|
@ -474,8 +495,20 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
->group("s.merchant_way")
|
|
|
|
|
->where($co_map)
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
//测试的订单
|
|
|
|
|
$to_map =[
|
|
|
|
|
"s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
|
"s.merchant_id"=>["GT","0"]
|
|
|
|
|
];
|
|
|
|
|
$tores=$this->TestOrderModel
|
|
|
|
|
->alias("s")
|
|
|
|
|
->field("SUM(s.pay_amount) pay_amount,s.merchant_way")
|
|
|
|
|
->group("s.merchant_way")
|
|
|
|
|
->where($to_map)
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
$dbres = array_merge($spres,$ssres,$dpres,$cores);
|
|
|
|
|
$dbres = array_merge($spres,$ssres,$dpres,$cores,$tores);
|
|
|
|
|
foreach ($dbres as $k=>$v){
|
|
|
|
|
$Ways[$v['merchant_way']] = $Ways[$v['merchant_way']]-0;
|
|
|
|
|
$Ways[$v['merchant_way']] += $v['pay_amount'];
|
|
|
|
|