From 2bf051498b2a955fa9f32c1688904f15e7cf02dc Mon Sep 17 00:00:00 2001 From: Anyon Date: Sat, 24 Oct 2020 10:58:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=A4=9A=E4=BD=99=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/controller/LuckdrawConfig.php | 145 ----------------------- app/data/controller/LuckdrawPrize.php | 94 --------------- app/data/controller/LuckdrawRecord.php | 61 ---------- app/data/controller/api/auth/Address.php | 10 +- vendor/composer/autoload_classmap.php | 3 - vendor/composer/autoload_static.php | 3 - vendor/services.php | 2 +- 7 files changed, 6 insertions(+), 312 deletions(-) delete mode 100644 app/data/controller/LuckdrawConfig.php delete mode 100644 app/data/controller/LuckdrawPrize.php delete mode 100644 app/data/controller/LuckdrawRecord.php diff --git a/app/data/controller/LuckdrawConfig.php b/app/data/controller/LuckdrawConfig.php deleted file mode 100644 index 23d0a13e6..000000000 --- a/app/data/controller/LuckdrawConfig.php +++ /dev/null @@ -1,145 +0,0 @@ -request->get('action') === 'qrc') try { - [$wechat, $code] = [WechatService::WeChatQrcode(), $this->request->get('code', '')]; - $short = $wechat->shortUrl(url("@data/app.luckdraw/index/code/{$code}", [], true, true)->build()); - $result = $wechat->create("reply#text:活动地址:\n{$short['short_url']}"); - $this->success('生成二维码成功!', "javascript:$.previewImage('{$wechat->url($result['ticket'])}')"); - } catch (\think\exception\HttpResponseException $exception) { - throw $exception; - } catch (\Exception $exception) { - $this->error("生成二维码失败,请稍候再试!
{$exception->getMessage()}"); - } - $this->title = '抽奖活动管理'; - $query = $this->_query($this->table)->like('code,name')->equal('status'); - $query->dateBetween('create_at')->where(['deleted' => 0])->order('sort desc,id desc')->page(); - } - - /** - * 添加抽奖活动 - * @auth true - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function add() - { - $this->title = '添加抽奖活动'; - $this->_form($this->table, 'form', 'code'); - } - - /** - * 编辑抽奖活动 - * @auth true - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function edit() - { - $this->title = '编辑抽奖活动'; - $this->_form($this->table, 'form', 'code'); - } - - /** - * 表单数据处理 - * @param array $vo - * @throws \think\Exception - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\ModelNotFoundException - * @throws \think\exception\DbException - * @throws \think\exception\PDOException - */ - protected function _form_filter(array &$vo) - { - $vo['code'] = $vo['code'] ?? CodeExtend::uniqidDate(16, 'A'); - if ($this->request->isGet()) { - $this->prizes = $this->app->db->name('ActivityLuckdrawPrize')->where(['deleted' => 0, 'status' => 1])->select()->toArray(); - $this->selectPrizes = $this->app->db->name('ActivityLuckdrawConfigRecord')->where(['code' => $vo['code']])->select()->toArray(); - } elseif ($this->request->isPost()) { - [$post, $records] = [$this->request->post(), []]; - if (empty($post['cover'])) $this->error('活动图片不能为空!'); - if (empty($post['prize_code']) || !is_array($post['prize_code'])) $this->error('请配置奖品信息!'); - $prizes = $this->app->db->name('ActivityLuckdrawPrize')->whereIn('code', $post['prize_code'])->select(); - foreach (array_keys($post['prize_code']) as $key) foreach ($prizes as $pz) { - if (intval($pz['code']) === intval($post['prize_code'][$key])) $records[] = [ - 'code' => $vo['code'], - 'prize_code' => $pz['code'], - 'prize_name' => $pz['name'], - 'prize_cover' => $pz['cover'], - 'prize_num' => $post['prize_num'][$key], - 'prize_rate' => $post['prize_rate'][$key], - 'prize_level' => $post['prize_level'][$key], - ]; - } - $this->app->db->name('ActivityLuckdrawConfigRecord')->where(['code' => $vo['code']])->delete(); - $this->app->db->name('ActivityLuckdrawConfigRecord')->insertAll($records); - } - } - - /** - * 保存成功后的处理 - * @param boolean $result - */ - protected function _form_result(bool $result) - { - if ($result) { - $this->success('活动配置成功!', 'javascript:history.back()'); - } - } - - /** - * 修改活动状态 - * @auth true - * @throws \think\db\exception\DbException - */ - public function state() - { - $this->_save($this->table, $this->_vali([ - 'status.in:0,1' => '状态值范围异常!', - 'status.require' => '状态值不能为空!', - ])); - } - - /** - * 删除抽奖活动 - * @auth true - * @throws \think\db\exception\DbException - */ - public function remove() - { - $this->_delete($this->table); - } - -} \ No newline at end of file diff --git a/app/data/controller/LuckdrawPrize.php b/app/data/controller/LuckdrawPrize.php deleted file mode 100644 index c94f8e8ae..000000000 --- a/app/data/controller/LuckdrawPrize.php +++ /dev/null @@ -1,94 +0,0 @@ -title = '活动奖品管理'; - $query = $this->_query($this->table)->like('code,name'); - $query->equal('status')->dateBetween('create_at')->page(); - } - - /** - * 添加活动奖品 - * @auth true - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function add() - { - $this->_form($this->table, 'form', 'code'); - } - - /** - * 编辑活动奖品 - * @auth true - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function edit() - { - $this->_form($this->table, 'form', 'code'); - } - - /** - * 表单数据处理 - * @param array $data - */ - protected function _form_filter(array &$data) - { - $data['code'] = $data['code'] ?? CodeExtend::uniqidNumber(16, 'P'); - } - - /** - * 修改奖品状态 - * @auth true - * @throws \think\db\exception\DbException - */ - public function state() - { - $this->_save($this->table, $this->_vali([ - 'status.in:0,1' => '状态值范围异常!', - 'status.require' => '状态值不能为空!', - ])); - } - - /** - * 删除活动奖品 - * @auth true - * @throws \think\db\exception\DbException - */ - public function remove() - { - $this->_delete($this->table); - } - -} \ No newline at end of file diff --git a/app/data/controller/LuckdrawRecord.php b/app/data/controller/LuckdrawRecord.php deleted file mode 100644 index 5f3d89eaa..000000000 --- a/app/data/controller/LuckdrawRecord.php +++ /dev/null @@ -1,61 +0,0 @@ -title = '中奖记录管理'; - $query = $this->_query($this->table)->like('phone,username,prize_name,prize_level'); - $query->equal('uncode_status,code')->dateBetween('create_at,uncode_datetime')->order('id desc'); - if (input('output') === 'json') { - $result = $query->page(true, false); - $this->success('获取数据列表成功', $result); - } else { - $query->page(); - } - } - - /** - * 页面数据处理 - * @param array $data - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - protected function _page_filter(array &$data) - { - $this->prizes = $this->app->db->name('ActivityLuckdrawConfig')->where(['deleted' => 0])->order('id desc')->select()->toArray(); - $members = $this->app->db->name('ActivityLuckdrawMember')->whereIn('id', array_unique(array_column($data, 'mid')))->column('*', 'mid'); - $acitves = $this->app->db->name('ActivityLuckdrawConfig')->whereIn('code', array_unique(array_column($data, 'code')))->column('*', 'code'); - foreach ($data as &$vo) { - $vo['info'] = $acitves[$vo['code']] ?? []; - $vo['member'] = $members[$vo['mid']] ?? []; - } - } - -} \ No newline at end of file diff --git a/app/data/controller/api/auth/Address.php b/app/data/controller/api/auth/Address.php index 7266c2223..69df1cd52 100644 --- a/app/data/controller/api/auth/Address.php +++ b/app/data/controller/api/auth/Address.php @@ -29,9 +29,9 @@ class Address extends Auth 'code.default' => '', 'type.default' => 0, 'type.in:0,1' => '地址状态不在范围!', - 'name.require' => '收货人姓名不能为空!', - 'phone.mobile' => '收货人手机格式错误!', - 'phone.require' => '收货人手机不能为空!', + 'name.require' => '收货姓名不能为空!', + 'phone.mobile' => '收货手机格式错误!', + 'phone.require' => '收货手机不能为空!', 'province.require' => '地址省份不能为空!', 'city.require' => '地址城市不能为空!', 'area.require' => '地址区域不能为空!', @@ -124,12 +124,12 @@ class Address extends Auth /** * 获取指定的收货地址 * @param string $code - * @return array|\think\Model|null + * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - private function _getAddress($code) + private function _getAddress(string $code) { $map = ['code' => $code, 'mid' => $this->mid, 'deleted' => 0]; return $this->app->db->name($this->table)->withoutField('deleted')->where($map)->find(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index ad5675566..9a8233cd1 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -200,9 +200,6 @@ return array( 'app\\admin\\controller\\api\\Update' => $baseDir . '/app/admin/controller/api/Update.php', 'app\\admin\\controller\\api\\Upload' => $baseDir . '/app/admin/controller/api/Upload.php', 'app\\data\\controller\\Config' => $baseDir . '/app/data/controller/Config.php', - 'app\\data\\controller\\LuckdrawConfig' => $baseDir . '/app/data/controller/LuckdrawConfig.php', - 'app\\data\\controller\\LuckdrawPrize' => $baseDir . '/app/data/controller/LuckdrawPrize.php', - 'app\\data\\controller\\LuckdrawRecord' => $baseDir . '/app/data/controller/LuckdrawRecord.php', 'app\\data\\controller\\Member' => $baseDir . '/app/data/controller/Member.php', 'app\\data\\controller\\NewsItem' => $baseDir . '/app/data/controller/NewsItem.php', 'app\\data\\controller\\NewsMark' => $baseDir . '/app/data/controller/NewsMark.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index cdbd07ce0..f6fc7056a 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -328,9 +328,6 @@ class ComposerStaticInit33b66ed99ea8fcca84c95dfb0e7ed409 'app\\admin\\controller\\api\\Update' => __DIR__ . '/../..' . '/app/admin/controller/api/Update.php', 'app\\admin\\controller\\api\\Upload' => __DIR__ . '/../..' . '/app/admin/controller/api/Upload.php', 'app\\data\\controller\\Config' => __DIR__ . '/../..' . '/app/data/controller/Config.php', - 'app\\data\\controller\\LuckdrawConfig' => __DIR__ . '/../..' . '/app/data/controller/LuckdrawConfig.php', - 'app\\data\\controller\\LuckdrawPrize' => __DIR__ . '/../..' . '/app/data/controller/LuckdrawPrize.php', - 'app\\data\\controller\\LuckdrawRecord' => __DIR__ . '/../..' . '/app/data/controller/LuckdrawRecord.php', 'app\\data\\controller\\Member' => __DIR__ . '/../..' . '/app/data/controller/Member.php', 'app\\data\\controller\\NewsItem' => __DIR__ . '/../..' . '/app/data/controller/NewsItem.php', 'app\\data\\controller\\NewsMark' => __DIR__ . '/../..' . '/app/data/controller/NewsMark.php', diff --git a/vendor/services.php b/vendor/services.php index 34531ae38..5dba645ae 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\admin\\Library',