财务分类-支付渠道/支付类型

master
chenzhi 5 years ago
parent cb4e457ace
commit 7657db3b18

@ -96,8 +96,8 @@ class FinancialSummarySetController extends \Think\Controller
$this->setIncomeMoney();
//按合作方类型
$this->setPromoteMoney();
// // //执行月份统计
// $this->setMonthCount();
//支付渠道/支付类型
$this->setPayWayMoney();
//执行
dump($this->adddata);
$this->model->commit();
@ -284,11 +284,138 @@ class FinancialSummarySetController extends \Think\Controller
"sum_money"=>number_format($outer_nobind_count/100, 2, '.', '')
);
}
/**
* 获取类型为4,5的数据/按支付渠道类型,支付类型类型
*/
public function setPayWayMoney()
{
$moneyarry=[
"wx"=>0,
"zfb"=>0,
"gfzfb"=>0,
"sqzfb"=>0,
"sqkj"=>0
];
$this->getSpendPayWay($moneyarry);
$this->getGameSupersignPayWay($moneyarry);
$this->getDepositPayWay($moneyarry);
$this->getCoinPayOrderPayWay($moneyarry);
//统计数据
$moneyarry['zfb'] = ($moneyarry['gfzfb']-0+$moneyarry['sqzfb']);
$this->adddata[] = array(
"key_name"=>'gfwx_count',
"type"=>4,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
"sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'gfzfb_count',
"type"=>4,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
"sum_money"=>number_format($moneyarry['gfzfb']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'sqzfb_count',
"type"=>4,"sort"=>3,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
"sum_money"=>number_format($moneyarry['sqzfb']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'sqkj_count',
"type"=>4,"sort"=>4,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
"sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'wx_count',
"type"=>5,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
"sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'zfb_count',
"type"=>5,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
"sum_money"=>number_format($moneyarry['zfb']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'kj_count',
"type"=>5,"sort"=>3,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
"sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '')
);
}
//获取spend表
protected function getSpendPayWay(&$moneyarry){
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1,
"pay_way"=>array("IN","1,2,3,9,15")
);
$dbres=$this->SpendModel
->field("
IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wxsm_count,
IFNULL(SUM(CASE WHEN pay_way = 3 THEN pay_amount ELSE 0 END),0) as wxapp_count,
IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfbgf_count,
IFNULL(SUM(CASE WHEN pay_way = 9 THEN pay_amount ELSE 0 END),0) as zfbsq_count,
IFNULL(SUM(CASE WHEN pay_way = 15 THEN pay_amount ELSE 0 END),0) as kjsq_count
")
->where($map)
->find();
$moneyarry['wx'] += ($dbres['wxsm_count']*100+$dbres['wxapp_count']*100);
$moneyarry['gfzfb'] += $dbres['zfbgf_count']*100;
$moneyarry['sqzfb'] += $dbres['zfbsq_count']*100;
$moneyarry['sqkj'] += $dbres['kjsq_count']*100;
}
//获取超级签购买
protected function getGameSupersignPayWay(&$moneyarry)
{
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
);
$dbres=$this->GameSupersignModel
->field("
IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_price ELSE 0 END),0) as wx_count,
IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_price ELSE 0 END),0) as zfb_count
")
->where($map)
->find();
$moneyarry['wx'] += $dbres['wx_count'];
$moneyarry['gfzfb'] += $dbres['zfb_count'];
}
//玩家购买平台币
protected function getDepositPayWay(&$moneyarry)
{
$map = array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1,
"pay_way"=>array("IN","1,2,3,9,15")
);
$dbres=$this->DepositModel
->field("
IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wxsm_count,
IFNULL(SUM(CASE WHEN pay_way = 3 THEN pay_amount ELSE 0 END),0) as wxapp_count,
IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfbgf_count,
IFNULL(SUM(CASE WHEN pay_way = 9 THEN pay_amount ELSE 0 END),0) as zfbsq_count,
IFNULL(SUM(CASE WHEN pay_way = 15 THEN pay_amount ELSE 0 END),0) as kjsq_count
")
->where($map)
->find();
$moneyarry['wx'] += ($dbres['wxsm_count']*100+$dbres['wxapp_count']*100);
$moneyarry['gfzfb'] += $dbres['zfbgf_count']*100;
$moneyarry['sqzfb'] += $dbres['zfbsq_count']*100;
$moneyarry['sqkj'] += $dbres['kjsq_count']*100;
}
//会长充值平台币
protected function getCoinPayOrderPayWay(&$moneyarry)
{
$map= array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"order_status"=>array("EGT",1)
);
$dbres= $this->CoinPayOrderModel
->field("
IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wx_count,
IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfb_count
")
->where($map)
->find();
$moneyarry['wx'] += $dbres['wx_count'];
$moneyarry['gfzfb'] += $dbres['zfb_count'];
}
}

Loading…
Cancel
Save