You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
4.6 KiB
PHP
129 lines
4.6 KiB
PHP
<?php
|
|
namespace Admin\Controller;
|
|
class FinancialSummaryController extends AdminController
|
|
{
|
|
public $keyname=array(
|
|
"cash_spend"=>"现金充值收入",
|
|
"balance_coin_spend"=>"平台币消耗",
|
|
"balance_coin_income"=>"平台币充值收入",
|
|
"game_supersign_income"=>"超级签购买收入",
|
|
"test_user_income"=>"测试收入",
|
|
"reward_count"=>"奖励",
|
|
"fine_count"=>"违规处罚",
|
|
"inside_count"=>"内团",
|
|
"outer_count"=>"外团",
|
|
"outer_branch_count"=>"外团-分发",
|
|
"other_group_count"=>"无归属团",
|
|
// "inside_count"=>"内团",
|
|
// "outer_count"=>"外团",
|
|
"gfwx_count"=>"官方-微信",
|
|
"gfzfb_count"=>"官方-支付宝",
|
|
"sqzfb_count"=>"双乾-支付宝",
|
|
"sqkj_count"=>"双乾-快捷",
|
|
"wx_count"=>"微信",
|
|
"zfb_count"=>"支付宝",
|
|
"kj_count"=>"快捷",
|
|
"ybzf_count"=>"易宝支付",
|
|
);
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
// echo "<pre>";
|
|
}
|
|
public function index($p=1)
|
|
{
|
|
if(!array_key_exists("year",$_REQUEST) || !array_key_exists("type",$_REQUEST)){
|
|
$this->redirect(ACTION_NAME, array('year' => date('Y',time()),"type"=>2));
|
|
}
|
|
$this->getYearList();
|
|
$this->getYearData();
|
|
$this->display();
|
|
|
|
}
|
|
//获取指定年份数据
|
|
public function getYearData()
|
|
{
|
|
$senddata = array(
|
|
"income"=>[
|
|
"count"=>['0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00']
|
|
],
|
|
"promote"=>[
|
|
"count"=>['0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00']
|
|
],
|
|
"channel"=>[
|
|
"count"=>['0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00']
|
|
],
|
|
"payway"=>[
|
|
"count"=>['0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00']
|
|
]
|
|
);
|
|
$data = [];
|
|
//初始化数据
|
|
foreach ($this->keyname as $k => $v) {
|
|
$data[$k] = array("name"=>$v,"money"=>['0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00']);
|
|
}
|
|
$map = array(
|
|
"count_year"=>$_REQUEST['year'],
|
|
"type"=>array("IN","1,{$_REQUEST['type']},4,5")
|
|
);
|
|
$dbres = M("FinancialSummary","tab_")->field("*")->where($map)->select();
|
|
foreach ($dbres as $k => $v) {
|
|
if($v['type'] == 1){
|
|
if(!in_array($v['key_name'],$senddata['income']['list'])){
|
|
$senddata['income']['list'][] = $v['key_name'];
|
|
}
|
|
}
|
|
if($v['type'] == 4){
|
|
if(!in_array($v['key_name'],$senddata['channel']['list'])){
|
|
$senddata['channel']['list'][] = $v['key_name'];
|
|
}
|
|
}
|
|
if($v['type'] == 5){
|
|
if(!in_array($v['key_name'],$senddata['payway']['list'])){
|
|
$senddata['payway']['list'][] = $v['key_name'];
|
|
}
|
|
}
|
|
if($v['type'] == $_REQUEST['type']){
|
|
if(!in_array($v['key_name'],$senddata['promote']['list'])){
|
|
$senddata['promote']['list'][] = $v['key_name'];
|
|
}
|
|
}
|
|
$data[$v['key_name']]["money"][((int)$v['count_month']-1)] = $v['sum_money'];
|
|
# code...
|
|
}
|
|
foreach ($senddata as $k => $v) {
|
|
foreach ($v as $ke => $va) {
|
|
if($ke !='count'){
|
|
foreach ($va as $key => $val) {
|
|
for ($i=0; $i < 12; $i++) {
|
|
$data[$val]["money"][12] += $data[$val]["money"][$i];
|
|
$senddata[$k]['count'][$i] += $data[$val]["money"][$i];
|
|
$senddata[$k]['count'][12] +=$data[$val]["money"][$i];
|
|
}
|
|
$senddata[$k][$ke][$key] = $data[$val];
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
$this->assign('data', $senddata);
|
|
}
|
|
//获取历史年份
|
|
public function getYearList()
|
|
{
|
|
$star = 2019;
|
|
$end = date("Y",time());
|
|
$list = [];
|
|
for ($i=$star; $i <= $end; $i++) {
|
|
$temp = array(
|
|
"value"=>$i,
|
|
"name"=>"{$i}年"
|
|
);
|
|
$list[] = $temp ;
|
|
}
|
|
$this->assign('YearList', $list);
|
|
}
|
|
|
|
|
|
|
|
} |