优化统计

master
chenzhi 4 years ago
parent be8a30a2e8
commit f0829e84cc

@ -3450,7 +3450,7 @@ class ExportController extends Controller
$today = total(1);
$week = total(2);
$mounth = total(3);
D("Spend")->addSubsiteWhere($map,"tab_spend");
$data = $spend
->field('tab_game.relation_game_name as game_name, tab_game.relation_game_id as game_id,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count') ->where($map)
->where($map)
@ -3471,6 +3471,7 @@ class ExportController extends Controller
//unset($_REQUEST['game_type']);
}
setPowerPromoteIds($map2);
D("Spend")->addSubsiteWhere($map2,"tab_spend");
$data2 = $spend
->field('tab_game.relation_game_id as game_id, sum(IF(pay_time ' . $today . ',pay_amount,0)) as today,
sum(IF(pay_time ' . $week . ',pay_amount,0)) as week,
@ -3660,6 +3661,7 @@ class ExportController extends Controller
$today = total(1);
$week = total(2);
$mounth = total(3);
D("Spend")->addSubsiteWhere($map);
$data = $spend
->field('pay_way,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count')
->where($map)
@ -3670,6 +3672,7 @@ class ExportController extends Controller
$map2 = array();
$map2['pay_status'] = 1;
setPowerPromoteIds($map2);
D("Spend")->addSubsiteWhere($map2);
$data2 = $spend
->field('pay_way,
sum(IF(pay_time ' . $today . ',pay_amount,0)) as today,

@ -106,6 +106,7 @@ class PlatformController extends ThinkController
"pay_time"=>["between",$yearMap],
"pay_status"=>1
];
D("Spend")->addSubsiteWhere($map);
$Payamount = M("Spend","tab_")->field("sum(pay_amount) pay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
if(empty($Payamount)) return ;
foreach ($Payamount as $v) {
@ -470,9 +471,9 @@ class PlatformController extends ThinkController
$today = total(1);
$week = total(2);
$mounth = total(3);
D("Spend")->addSubsiteWhere($map,"tab_spend");
$data = $spend
->field('tab_game.relation_game_name as game_name, tab_game.relation_game_id as game_id,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count') ->where($map)
->field('tab_game.relation_game_name as game_name, tab_game.relation_game_id as game_id,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count')
->where($map)
->join('tab_game on tab_game.id = tab_spend.game_id', 'left')
->group('tab_game.relation_game_id')
@ -492,6 +493,7 @@ class PlatformController extends ThinkController
//unset($_REQUEST['game_type']);
}
setPowerPromoteIds($map2);
D("Spend")->addSubsiteWhere($map2,"tab_spend");
$data2 = $spend
->field('tab_game.relation_game_id as game_id, sum(IF(pay_time ' . $today . ',pay_amount,0)) as today,
sum(IF(pay_time ' . $week . ',pay_amount,0)) as week,
@ -681,6 +683,7 @@ class PlatformController extends ThinkController
$today = total(1);
$week = total(2);
$mounth = total(3);
D("Spend")->addSubsiteWhere($map);
$data = $spend
->field('pay_way,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count')
->where($map)
@ -691,6 +694,7 @@ class PlatformController extends ThinkController
$map2 = array();
$map2['pay_status'] = 1;
setPowerPromoteIds($map2);
D("Spend")->addSubsiteWhere($map2);
$data2 = $spend
->field('pay_way,
sum(IF(pay_time ' . $today . ',pay_amount,0)) as today,
@ -1070,6 +1074,7 @@ class PlatformController extends ThinkController
//为数据权限添加
setPowerPromoteIds($map, 'tp1.id');
}
D("Spend")->addSubsiteWhere($map,"s");
$data = M('promote', 'tab_')->alias('tp1')
->field('tp1.account as promote_account,tp1.id,g.relation_game_id,g.relation_game_name,
@ -1260,7 +1265,7 @@ class PlatformController extends ThinkController
function day_data($model = 'User', $column1 = array(), $column2 = 'count')
{
//今日本周本月不跟随选择的实现变动 只以当前日期为基准
$table = M($model, 'tab_');
$table = SM($model, 'tab_');
$today = total(1);
$week = total(2);
$mounth = total(3);

Loading…
Cancel
Save