diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 7ffce8e36..b54c46875 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -244,17 +244,21 @@ class PromoteController extends BaseController $today = total(1); $week = total(2); $mounth = total(3); + $yesterday = total(5); $map1['promote_id'] = $map['promote_id'] = array('gt', 0); $map1['pay_status'] = $map['pay_status'] = 1; $map1['pay_way'] = $map['pay_way'] = array('gt', 0); $userId = []; - $promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid() . " or grand_id=" . get_pid())->select(); + $grandPromote = get_pid(); + + $promoteId = M("promote", "tab_")->field('id')->where("chain like '%/{$grandPromote}/%' or id = {$grandPromote}")->select(); $promoteId = array_column($promoteId, 'id'); - $promoteId = implode(',', $promoteId) . "," . get_pid(); + $promoteId = implode(',', $promoteId); $whereUser['promote_id'] = ['IN', $promoteId]; + if ($type == 1) { $start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; @@ -313,21 +317,26 @@ class PromoteController extends BaseController ->group('promote_id') ->select(false); + // $promote_map = "tp1.`chain` = '/'"; $promote_id = get_pid(); $promote_map = "tp1.`id` = {$promote_id}"; - $spendData = $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") ->where($condition)->table('(' . $spendData . ') as a')->group('t.pid')->order('count desc,a.ordertime')->find(); -// var_dump($spendData);die(); - $spendData['rand'] = 1; - $spendData['count'] = $spendData['count'] / 100; - $spendData['today'] = $spendData['today'] / 100; - $spendData['week'] = $spendData['week'] / 100; - $spendData['mounth'] = $spendData['mounth'] / 100; - - return $spendData; + + $spendData1 = $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, '/%') ) AS t ON promote_id = t.id") + ->where($condition)->table('(' . $spendData . ') as a')->group('t.pid')->order('count desc,a.ordertime')->find(); + + $data['rand'] = 1; + $data['count'] = $data['count'] / 100; + $data['today'] = $spendData1['today'] / 100; + $data['week'] = $spendData1['week'] / 100; + $data['mounth'] = $spendData1['mounth'] / 100; + + return $data; } private function pay_total($type = 0, $newadd = 1, $promoteId = "") diff --git a/Application/Home/View/default/Download/listsIndex.html b/Application/Home/View/default/Download/listsIndex.html index f91e25fa7..820f7c71e 100644 --- a/Application/Home/View/default/Download/listsIndex.html +++ b/Application/Home/View/default/Download/listsIndex.html @@ -106,11 +106,11 @@
- +
- +
diff --git a/Application/Home/View/default/TestResource/index.html b/Application/Home/View/default/TestResource/index.html index 467a53b4a..c83e16c00 100644 --- a/Application/Home/View/default/TestResource/index.html +++ b/Application/Home/View/default/TestResource/index.html @@ -154,14 +154,14 @@
- +
+ value="{:I('start')}" autocomplete="off">
diff --git a/Application/Home/View/default/TestResource/lists.html b/Application/Home/View/default/TestResource/lists.html index beb583e61..de2a770eb 100644 --- a/Application/Home/View/default/TestResource/lists.html +++ b/Application/Home/View/default/TestResource/lists.html @@ -46,13 +46,13 @@
- +
- +
diff --git a/Application/Home/View/default/TestResource/protectLogList.html b/Application/Home/View/default/TestResource/protectLogList.html index 59b3d3dfd..f3d1b78e3 100644 --- a/Application/Home/View/default/TestResource/protectLogList.html +++ b/Application/Home/View/default/TestResource/protectLogList.html @@ -68,13 +68,13 @@
- +
- +