市场结算修正

master
zhengyongxing 5 years ago
parent 42e07d0f2f
commit 3741b0d27f

@ -1577,14 +1577,22 @@ class QueryController extends ThinkController
$map['my_time'] = $_REQUEST['count_date']; $map['my_time'] = $_REQUEST['count_date'];
} }
// if ($_REQUEST['device']) {
// $map['game_name'] = ['like','%'.$_REQUEST['device'].'%'];
// }
if ($_REQUEST['device']) { if ($_REQUEST['device']) {
$map['game_name'] = ['like','%'.$_REQUEST['device'].'%']; // $map['tab_spend.sdk_version'] = $_REQUEST['device'];
$spendMap['tab_spend.sdk_version'] = $_REQUEST['device'];
} }
$spendMap['tab_spend.pay_status'] = 1;
//获取spend表中的数据同时根据会长id进行group分类 //获取spend表中的数据同时根据会长id进行group分类
$data = M('Spend','tab_') $data = M('Spend','tab_')
->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,game_name,SUBSTRING_INDEX(`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id,pay_way ") ->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,game_name,SUBSTRING_INDEX(`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id,pay_way ")
->join("left join tab_promote on promote_id = tab_promote.id") ->join("left join tab_promote on promote_id = tab_promote.id")
->where(['pay_status'=>1]) ->where($spendMap)
->group("my_time,game_names,root_id,pay_way") ->group("my_time,game_names,root_id,pay_way")
->order("my_time Desc") ->order("my_time Desc")
->select(false); ->select(false);

Loading…
Cancel
Save