优化游戏统计

master
chenzhi 4 years ago
parent c0926299dc
commit 40005b7177

@ -740,6 +740,7 @@ class FinanceController extends ThinkController
$searchGameIds = M('game', 'tab_')->where($gameWhere)->getField('id', true); $searchGameIds = M('game', 'tab_')->where($gameWhere)->getField('id', true);
$startTime = time(); $startTime = time();
D("spend")->addSubsiteWhere($map);
//游戏统计列表 //游戏统计列表
if(isset($_REQUEST['export'])){ if(isset($_REQUEST['export'])){
$data = D("spend")->gameStatistics($map,$searchGameIds, 0, 0); $data = D("spend")->gameStatistics($map,$searchGameIds, 0, 0);
@ -1066,15 +1067,17 @@ class FinanceController extends ThinkController
if (!empty(I('user_nickname'))) { if (!empty(I('user_nickname'))) {
$map['game_player_name'] = array('like',I("user_nickname").'%'); $map['game_player_name'] = array('like',I("user_nickname").'%');
} }
D("Spend")->addSubsiteWhere($map);
// var_dump($map);die(); // var_dump($map);die();
$field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,sdk_version,merchant_id"; $field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,sdk_version,merchant_id";
$group = ""; $group = "";
$order = "payed_time DESC"; $order = "payed_time DESC";
if(isset($_REQUEST['export'])){ if(isset($_REQUEST['export'])){
$data = D('spend')->getSubSpendData($map,$field,$group,$order,0,0); $data = D('spend')->getSpendData($map,$field,$group,$order,0,0);
}else{ }else{
$data = D('spend')->getSubSpendData($map,$field,$group,$order,$page,$row); $data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row);
} }
$merchant_data = M("payment_merchant","tab_") $merchant_data = M("payment_merchant","tab_")
@ -1143,7 +1146,7 @@ class FinanceController extends ThinkController
$this->assign('sumInside', $sumInside); $this->assign('sumInside', $sumInside);
$this->assign('sumAll', null_to_0($sumAll)); $this->assign('sumAll', null_to_0($sumAll));
$count = D("spend")->getSubSpendData($map,'count(*) as count',$group,$order); $count = D("spend")->getSpendData($map,'count(*) as count',$group,$order);
$this->checkListOrCountAuthRestMap($map,[]); $this->checkListOrCountAuthRestMap($map,[]);
$count = $count[0]['count']; $count = $count[0]['count'];

@ -824,22 +824,7 @@ class SpendModel extends Model
return $data; return $data;
} }
/**
* 获取多站点查询
*/
public function getSubSpendData($map = [], $field = '', $group = '', $order = '', $page = 0, $row = 0)
{
$query = $this->field($field)->where($map)->group($group)->order($order);
if ($row == 0) {
$data = $query->select();
} else {
$data = $query->page($page, $row)->select();
}
return $data;
}
/** /**
* 获取统计 $map,$page,$row * 获取统计 $map,$page,$row
*/ */

Loading…
Cancel
Save