Ver Fonte

去除多余控制器

Anyon há 4 anos atrás
pai
commit
2bf051498b

+ 0 - 145
app/data/controller/LuckdrawConfig.php

@@ -1,145 +0,0 @@
-<?php
-
-namespace app\data\controller;
-
-use app\wechat\service\WechatService;
-use think\admin\Controller;
-use think\admin\extend\CodeExtend;
-
-/**
- * 抽奖活动配置
- * Class LuckdrawConfig
- * @package app\data\controller
- */
-class LuckdrawConfig extends Controller
-{
-    /**
-     * 绑定数据表
-     * @var string
-     */
-    protected $table = 'ActivityLuckdrawConfig';
-
-    /**
-     * 抽奖活动配置
-     * @auth true
-     * @menu true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function index()
-    {
-        if ($this->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("生成二维码失败,请稍候再试!<br> {$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);
-    }
-
-}

+ 0 - 94
app/data/controller/LuckdrawPrize.php

@@ -1,94 +0,0 @@
-<?php
-
-namespace app\data\controller;
-
-use think\admin\Controller;
-use think\admin\extend\CodeExtend;
-
-/**
- * 活动奖品管理
- * Class LuckdrawPrize
- * @package app\data\controller
- */
-class LuckdrawPrize extends Controller
-{
-    /**
-     * 绑定数据表
-     * @var string
-     */
-    protected $table = 'ActivityLuckdrawPrize';
-
-    /**
-     * 活动奖品管理
-     * @auth true
-     * @menu true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function index()
-    {
-        $this->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);
-    }
-
-}

+ 0 - 61
app/data/controller/LuckdrawRecord.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace app\data\controller;
-
-use think\admin\Controller;
-
-/**
- * 奖品领取记录
- * Class LuckdrawRecord
- * @package app\activity\controller
- */
-class LuckdrawRecord extends Controller
-{
-    /**
-     * 绑定数据表
-     * @var string
-     */
-    protected $table = 'ActivityLuckdrawRecord';
-
-    /**
-     * 中奖记录管理
-     * @auth true
-     * @menu true
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\exception\PDOException
-     */
-    public function index()
-    {
-        $this->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']] ?? [];
-        }
-    }
-
-}

+ 5 - 5
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();

+ 0 - 3
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',

+ 0 - 3
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',

+ 1 - 1
vendor/services.php

@@ -1,5 +1,5 @@
 <?php 
-// This file is automatically generated at:2020-10-24 10:43:30
+// This file is automatically generated at:2020-10-24 10:57:42
 declare (strict_types = 1);
 return array (
   0 => 'think\\admin\\Library',