From 4a9e3e37498d668ab9f6be1445872b42a9d9917f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cwanyongkang=E2=80=9D?= <“937888580@qq.com”> Date: Sun, 17 Sep 2023 18:07:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=B4=A6=E5=8F=B7=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/manager/controller/Account.php | 67 ++++++++++++++++++++++++++++ app/manager/model/ProductAccount.php | 12 ++++- 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 app/manager/controller/Account.php diff --git a/app/manager/controller/Account.php b/app/manager/controller/Account.php new file mode 100644 index 0000000..eaa2f4d --- /dev/null +++ b/app/manager/controller/Account.php @@ -0,0 +1,67 @@ + "测试卡" AND DeleteTag=0 '; + //根据用户id + if (!empty($data['UserId'])) { + $where1['UserId'] = $data['UserId']; + } + //根据用户会员号 + if (!empty($data['keyWord'])) { + $where1['UserCode'] = $data['keyWord']; + } + //根据产品 + if (!empty($data['ProductIds'])) { + $where1['ProductId'] = ['in', $data['ProductIds']]; + } + //根据套餐 + if (!empty($data['PackageNames'])) { + $where1['PackageName'] = ['in', $data['PackageNames']]; + } + //根据账号类型 + if (!empty($data['accountTypes'])) { + $where1['AccountType'] = ['in', $data['accountTypes']]; + } + //根据账号过期时间 + if ($data['ExpirdDay'] > -100) + { + if ($data['ExpirdDay'] == 0) + { + $where2 .= ' AND EndTime-4) { + $where2 .= ' AND TO_DAYS(EndTime) - (TO_DAYS(now()))>='.$data['ExpirdDay'].' AND EndTime < now() '; + } elseif ($data['ExpirdDay']==-4) { + $where2 .= ' AND TO_DAYS(EndTime) - (TO_DAYS(now()))<='.$data['ExpirdDay'].' '; + } elseif ($data['ExpirdDay'] > 0){ + $where2 .= ' AND TO_DAYS(EndTime) - (TO_DAYS(now()))<='.$data['ExpirdDay'].' AND EndTime>now() '; + // $where2 .= ' AND EndTimegetCountConnect($where1,$where2); + + $count = !empty($count)?$count:0; + + \result($count,'',30000); + + } +} diff --git a/app/manager/model/ProductAccount.php b/app/manager/model/ProductAccount.php index 9fe7268..6ae11bc 100644 --- a/app/manager/model/ProductAccount.php +++ b/app/manager/model/ProductAccount.php @@ -4,8 +4,8 @@ * @version: * @Author: kangkang * @Date: 2020-10-16 14:44:02 - * @LastEditors: Please set LastEditors - * @LastEditTime: 2020-11-25 14:56:10 + * @LastEditors: “wanyongkang” “937888580@qq.com” + * @LastEditTime: 2023-09-17 17:39:17 */ namespace app\manager\model; @@ -88,4 +88,12 @@ class ProductAccount extends Model ->limit($limit) ->fetchAll(); } + + //获取账号总连接数 + public function getCountConnect($where1 = [], $where2 = '') { + return $this->field('sum(ConnectCount) as sum') + ->where($where1) + ->where($where2) + ->fetch(); + } }