From 747c97ceec90e102b535a79d4862fb8147b60c8b Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 3 Dec 2019 18:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0->=E9=A6=96?= =?UTF-8?q?=E9=A1=B5--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index f505a8857..fff5f82d7 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -259,28 +259,21 @@ class PromoteController extends BaseController $whereUser['promote_id'] = ['IN', $promoteId]; - if ($type == 1) { - $pay_time = total(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; - $whereUser['register_time'] = ['between', array($start, $end - 1)]; - $userId = M('user', 'tab_')->field('id')->where($whereUser)->select(); - - } else if ($type == 2) { - $pay_time = total(3); - $start = mktime(0, 0, 0, date('m'), 1, date('Y')); - $end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1; + if (in_array($type, [1, 2])) { + if ($type == 1) { + $pay_time = total(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; + } else { + $pay_time = total(3); + $start = mktime(0, 0, 0, date('m'), 1, date('Y')); + $end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1; + } $whereUser['register_time'] = ['between', array($start, $end - 1)]; - $userId = M('user', 'tab_')->field('id')->where($whereUser)->select(); + $userId = M('user', 'tab_')->where($whereUser)->getField('id', true); } -// if ($userId) { -// var_dump($userId); -// } if ($userId) { - - $userId = implode(',', array_column($userId, 'id')); -// var_dump($userId); $map1['user_id'] = $map['user_id'] = ['IN', $userId]; } else if (!$userId && $type != 0) { return array('sum_mounth' => 0, 'sum_today' => 0); @@ -333,9 +326,6 @@ class PromoteController extends BaseController } $data[] = $dbdata; } -// if ($userId) { -// echo $spend->_sql();die(); -// } foreach ($data as $key => $value) { $value['count'] ?: 0; $value['today'] ?: 0; @@ -353,8 +343,6 @@ class PromoteController extends BaseController $total = $this->data_total($data); return $total; -// - } public function data_total($data)