diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index 837eab59d..508143441 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -380,14 +380,13 @@ class PlatformController extends ThinkController count(IF(register_time ' . $today . ',1,null)) as today, count(IF(register_time ' . $week . ',1,null)) as week, count(IF(register_time ' . $mounth . ',1,null)) as mounth') - ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%')", 'left') + ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left') ->join("tab_user as u on tp2.id = u.promote_id", 'left') ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) ->where($map) ->group('tp1.id') ->order('count desc, register_time') ->select(); - $count = count($data); foreach ($data as $key => $value) { static $i = 0; @@ -507,7 +506,7 @@ class PlatformController extends ThinkController 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') - ->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") + ->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 tp2.id = tp1.id where $promote_map ) AS t ON promote_id = t.id") ->where($condition)->table('(' . $data . ') as a')->group('t.pid')->order('count desc,a.ordertime')->select(); $count = count($data); // dump($condition);die; diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 8d76ec0e6..1d0307c2a 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -151,7 +151,7 @@ class PromoteController extends BaseController count(IF(register_time ' . $today . ',1,null)) as today, count(IF(register_time ' . $week . ',1,null)) as week, count(IF(register_time ' . $mounth . ',1,null)) as mounth') - ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%')", 'left') + ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp1.id=tp2.id", 'left') ->join("tab_user as u on tp2.id = u.promote_id", 'left') ->join(false) ->where($map) @@ -319,7 +319,7 @@ class PromoteController extends BaseController $promote_map = "tp1.`id` = {$promote_id}"; $data = $spend->field('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") + ->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") ->where($condition)->table('(' . $spendData . ') as a')->group()->order('count desc,a.ordertime')->find(); $spendData1 = $spend->field('sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth')