From c1f57d709cd4a0c0db6c06b650aa8ed2a97f8867 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Mon, 22 Nov 2021 18:14:21 +0800 Subject: [PATCH] setter --- app/controller/manager/Consumer.php | 46 +++++++++++++ config/database.php | 6 +- public/static/manager/js/consumer/info.js | 6 +- view/manager/consumer/blank_list.html | 79 +++++++++++++++++++++++ view/manager/consumer/index.html | 2 +- 5 files changed, 130 insertions(+), 9 deletions(-) create mode 100644 view/manager/consumer/blank_list.html diff --git a/app/controller/manager/Consumer.php b/app/controller/manager/Consumer.php index 1aae2a7..b100529 100644 --- a/app/controller/manager/Consumer.php +++ b/app/controller/manager/Consumer.php @@ -123,4 +123,50 @@ class Consumer extends Base return $this->view(); } + /** + * 黑名单列表 + * + * @return Json|View + * @throws Exception + */ + public function blankList() + { + $stateArray = Account::allState(); + if ($this->request->isPost()) { + $repo = AccountRepository::getInstance(); + $keyword = $this->request->param('keyword/s', ''); + $state = $this->request->param('state/d', "-1"); + $page = $this->request->param('page/d', 1); + $size = $this->request->param('size/d', 30); + + $whereMap = [ + ["type", "=", Account::type_consumer], + ["blank_total", ">", 0], + ]; + $orders = ['id' => 'desc']; + if (!empty($keyword)) { + $whereMap[] = ['nick_name', 'like', "%$keyword%"]; + } + if (isset($stateArray[$state])) { + $whereMap[] = ['state', '=', $state]; + } + $list = $repo->findList($whereMap, [], $page, $size, function ($q) { + return $q->with("tag"); + }, $orders); + $list["list"]->each(function ($item) { + //优惠券领取总数 + $item->coupon_total_count = Coupon::where(["consumer_code" => $item->user_code])->count("id"); + //优惠券使用总数 + $item->coupon_used_count = Coupon::where(["consumer_code" => $item->user_code])->where("is_verificated", Coupon::is_verificated_on)->count("id"); + //优惠券未使用总数 + $item->coupon_not_use_count = Coupon::where(["consumer_code" => $item->user_code])->where("is_verificated", Coupon::is_verificated_off)->count("id"); + }); + + return $this->json(0, 'success', $list); + + } + $this->data["state"] = $stateArray; + return $this->view(); + } + } \ No newline at end of file diff --git a/config/database.php b/config/database.php index f38d109..5acedeb 100644 --- a/config/database.php +++ b/config/database.php @@ -22,13 +22,13 @@ return [ // 数据库类型 'type' => Env::get('database.type', 'mysql'), // 服务器地址 - 'hostname' => Env::get('database.hostname', '127.0.0.1'), + 'hostname' => Env::get('database.hostname', '211.149.245.223'), // 数据库名 'database' => Env::get('database.database', 'coupon'), // 用户名 - 'username' => Env::get('database.username', 'root'), + 'username' => Env::get('database.username', 'coupon'), // 密码 - 'password' => Env::get('database.password', 'root'), + 'password' => Env::get('database.password', 'ReykreFGihazxPnj'), // 端口 'hostport' => Env::get('database.hostport', '3306'), // 数据库连接参数 diff --git a/public/static/manager/js/consumer/info.js b/public/static/manager/js/consumer/info.js index 47f4e13..f9a5bdb 100644 --- a/public/static/manager/js/consumer/info.js +++ b/public/static/manager/js/consumer/info.js @@ -16,11 +16,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function let insTb = table.render({ elem: '#table-container', toolbar: '#toolbar-tpl', - defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可 - title: '搜索' - , layEvent: 'search' - , icon: 'layui-icon-search' - }], + defaultToolbar: null, url: listUrl, method: 'post', even: true, diff --git a/view/manager/consumer/blank_list.html b/view/manager/consumer/blank_list.html new file mode 100644 index 0000000..fa58c4e --- /dev/null +++ b/view/manager/consumer/blank_list.html @@ -0,0 +1,79 @@ +{layout name="manager/layout" /} + + +