|
|
|
@ -92,19 +92,20 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
$this->model->startTrans();
|
|
|
|
|
$this->continue =true;
|
|
|
|
|
|
|
|
|
|
//获取类型为1的数据
|
|
|
|
|
//按收入类型
|
|
|
|
|
$this->setIncomeMoney();
|
|
|
|
|
// // //执行用户表统计
|
|
|
|
|
// $this->setUserCount();
|
|
|
|
|
//按合作方类型
|
|
|
|
|
$this->setPromoteMoney();
|
|
|
|
|
// // //执行月份统计
|
|
|
|
|
// $this->setMonthCount();
|
|
|
|
|
//执行
|
|
|
|
|
dump($this->adddata);
|
|
|
|
|
$this->model->commit();
|
|
|
|
|
$t2 = microtime(true);
|
|
|
|
|
die("success runtime:".round($t2-$t1,3).'s');
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取类型为1的数据
|
|
|
|
|
* 获取类型为1的数据,按收入类型
|
|
|
|
|
*/
|
|
|
|
|
public function setIncomeMoney()
|
|
|
|
|
{
|
|
|
|
@ -112,7 +113,7 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
$this->getBalanceCoinIncome();
|
|
|
|
|
$this->getGameSupersignIncome();
|
|
|
|
|
$this->getTestUserIncome();
|
|
|
|
|
dump($this->adddata);
|
|
|
|
|
|
|
|
|
|
# code...
|
|
|
|
|
}
|
|
|
|
|
//现金充值及平台币消耗
|
|
|
|
@ -136,13 +137,13 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
->find();
|
|
|
|
|
$cash_spend = $temparr;
|
|
|
|
|
$cash_spend["key_name"] = "cash_spend";
|
|
|
|
|
$cash_spend["sort"] = "1";
|
|
|
|
|
$cash_spend["sort"] = 1;
|
|
|
|
|
$cash_spend["sum_money"] = $res['cash_count'];
|
|
|
|
|
$this->adddata[]=$cash_spend;
|
|
|
|
|
|
|
|
|
|
$balance_coin_spend = $temparr;
|
|
|
|
|
$balance_coin_spend["key_name"] = "balance_coin_spend";
|
|
|
|
|
$balance_coin_spend["sort"] = "2";
|
|
|
|
|
$balance_coin_spend["sort"] = 2;
|
|
|
|
|
$balance_coin_spend["sum_money"] = $res['balance_coin_count'];
|
|
|
|
|
$this->adddata[]=$balance_coin_spend;
|
|
|
|
|
}
|
|
|
|
@ -195,7 +196,7 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
$temparr = array(
|
|
|
|
|
"key_name"=>'test_user_income',
|
|
|
|
|
"type"=>1,
|
|
|
|
|
"sort"=>4,
|
|
|
|
|
"sort"=>5,
|
|
|
|
|
"count_month"=>$this->month,
|
|
|
|
|
"count_year"=>$this->year,
|
|
|
|
|
"create_time"=>$this->nowdata
|
|
|
|
@ -228,6 +229,62 @@ class FinancialSummarySetController extends \Think\Controller
|
|
|
|
|
$temparr['sum_money'] = number_format(($cash_spend*100+$deposit*100)/100, 2, '.', '');
|
|
|
|
|
$this->adddata[]=$temparr;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取类型为2,3的数据/按合作方类型
|
|
|
|
|
*/
|
|
|
|
|
public function setPromoteMoney()
|
|
|
|
|
{
|
|
|
|
|
$map = array(
|
|
|
|
|
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
|
"pay_status"=>1
|
|
|
|
|
);
|
|
|
|
|
$res = $this->SpendModel
|
|
|
|
|
->alias('s')
|
|
|
|
|
->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count,
|
|
|
|
|
IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count,
|
|
|
|
|
IFNULL(SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END),0) as bind_coin_count,
|
|
|
|
|
promote.company_belong")
|
|
|
|
|
->where($map)
|
|
|
|
|
->join("tab_promote promote ON s.promote_id = promote.id", "left")
|
|
|
|
|
->group("company_belong")
|
|
|
|
|
->select();
|
|
|
|
|
$inside_count = 0;
|
|
|
|
|
$outer_count = 0;
|
|
|
|
|
$inside_nobind_count = 0;
|
|
|
|
|
$outer_nobind_count = 0;
|
|
|
|
|
foreach ($res as $k => $v) {
|
|
|
|
|
if($v['company_belong'] == 1){
|
|
|
|
|
$outer_count = $v['cash_count']*100+$v['balance_coin_count']*100+$v['bind_coin_count']*100;
|
|
|
|
|
$outer_nobind_count = $v['cash_count']*100+$v['balance_coin_count']*100;
|
|
|
|
|
}else{
|
|
|
|
|
//有可能存在官方渠道,company_belong=null
|
|
|
|
|
$inside_count += ($v['cash_count']*100+$v['balance_coin_count']*100+$v['bind_coin_count']*100);
|
|
|
|
|
$inside_nobind_count += ($v['cash_count']*100+$v['balance_coin_count']*100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//处理数据
|
|
|
|
|
$this->adddata[] = array(
|
|
|
|
|
"key_name"=>'inside_count',
|
|
|
|
|
"type"=>2,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
|
|
|
|
|
"sum_money"=>number_format($inside_count/100, 2, '.', '')
|
|
|
|
|
);
|
|
|
|
|
$this->adddata[] = array(
|
|
|
|
|
"key_name"=>'outer_count',
|
|
|
|
|
"type"=>2,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
|
|
|
|
|
"sum_money"=>number_format($outer_count/100, 2, '.', '')
|
|
|
|
|
);
|
|
|
|
|
$this->adddata[] = array(
|
|
|
|
|
"key_name"=>'inside_count',
|
|
|
|
|
"type"=>3,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
|
|
|
|
|
"sum_money"=>number_format($inside_nobind_count/100, 2, '.', '')
|
|
|
|
|
);
|
|
|
|
|
$this->adddata[] = array(
|
|
|
|
|
"key_name"=>'outer_count',
|
|
|
|
|
"type"=>3,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata,
|
|
|
|
|
"sum_money"=>number_format($outer_nobind_count/100, 2, '.', '')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|