master
chenzhi 5 years ago
parent a770dc14e5
commit 256545a59a

@ -417,8 +417,6 @@ class PlatformController extends ThinkController
$this->assign('total', $total); $this->assign('total', $total);
$this->display(); $this->display();
} }
function promotepay_statistics($p = 0) function promotepay_statistics($p = 0)
{ {
$page = intval($p); $page = intval($p);
@ -451,7 +449,7 @@ class PlatformController extends ThinkController
$today = total(1); $today = total(1);
$week = total(2); $week = total(2);
$mounth = total(3); $mounth = total(3);
$map1['pay_way'] = $map['pay_way'] = array('gt', 0); // $map1['pay_way'] = $map['pay_way'] = array('gt', 0);
$bindrecharge_data = M('bind_recharge', 'tab_') $bindrecharge_data = M('bind_recharge', 'tab_')
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
@ -495,8 +493,8 @@ class PlatformController extends ThinkController
floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week, floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth') floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
->where($map) ->where($map)
->union(' (' . $bindrecharge_data . ') ') // ->union(' (' . $bindrecharge_data . ') ')
->union(' (' . $deposit_data . ') ') // ->union(' (' . $deposit_data . ') ')
->group('promote_id') ->group('promote_id')
->select(false); ->select(false);
} }
@ -506,10 +504,10 @@ class PlatformController extends ThinkController
unset($_REQUEST['promote_id']); unset($_REQUEST['promote_id']);
} }
$data = $spend->field('t.pid as promote_id,t.promote_account,sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth') $data = $spend->field('t.pid as promote_id,t.promote_account,sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth')
->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id or promote_id = t.pid") ->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp1.id = tp2.id where $promote_map ) AS t ON promote_id = t.id or promote_id = t.pid")
->where($condition)->table('(' . $data . ') as a')->group('t.pid')->order('count desc,a.ordertime')->select(); ->where($condition)->table('(' . $data . ') as a')->group('t.pid')->order('count desc,a.ordertime')->select(false);
$count = count($data); $count = count($data);
// dump($condition);die;
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
static $i = 0; static $i = 0;
$i++; $i++;

@ -100,7 +100,6 @@ class SpendController extends ThinkController
$map = '1 = 2'; $map = '1 = 2';
$map1 = $map; $map1 = $map;
} }
$total = null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); $total = null_to_0(D(self::model_name)->where($map1)->sum('pay_amount'));
$ttotal = null_to_0(D(self::model_name)->where('pay_time' . total(1))->where(array('pay_status' => 1))->sum('pay_amount')); $ttotal = null_to_0(D(self::model_name)->where('pay_time' . total(1))->where(array('pay_status' => 1))->sum('pay_amount'));
$ytotal = null_to_0(D(self::model_name)->where('pay_time' . total(5))->where(array('pay_status' => 1))->sum('pay_amount')); $ytotal = null_to_0(D(self::model_name)->where('pay_time' . total(5))->where(array('pay_status' => 1))->sum('pay_amount'));

Loading…
Cancel
Save