Bläddra i källkod

Merge branch 'dev_wf' of wufeng/fuse into version1.5

wufeng 2 år sedan
förälder
incheckning
5cb6ea39db

+ 1 - 1
app/admin/command/HandleBatchAccount.php

@@ -84,7 +84,7 @@ class HandleBatchAccount extends Command
         $insert = 'INSERT INTO `' . Config::get('database.connections.mysql.database') . '`.`' . Config::get('database.connections.mysql.prefix') . 'account` (`username`,`pwd`,`salt`,`password`,`company_id`,`card_id`,`status`,`is_del`,`starttime`,`expiretime`,`createrid`,`creater`,`addtime`,`updaterid`,`updater`,`updatetime`) VALUES ';
         $insert = 'INSERT INTO `' . Config::get('database.connections.mysql.database') . '`.`' . Config::get('database.connections.mysql.prefix') . 'account` (`username`,`pwd`,`salt`,`password`,`company_id`,`card_id`,`status`,`is_del`,`starttime`,`expiretime`,`createrid`,`creater`,`addtime`,`updaterid`,`updater`,`updatetime`) VALUES ';
         for ($i = 0; $i <= 9999; $i++) {
         for ($i = 0; $i <= 9999; $i++) {
             $pwd = randomkeys(6);
             $pwd = randomkeys(6);
-            $salt = randomkeys(4);
+            $salt = randomkeys(6);
 
 
             //拼接SQL语句
             //拼接SQL语句
             $insert .= "('" . self::$account_username_prefix . $rs['username_prefix'] . $rs['username_year'] . str_pad((string)$i, 4, '0', STR_PAD_LEFT) . "','" . $pwd . "','" . $salt . "','" . getPassword($pwd, $salt) . "'," . $rs['company_id'] . "," . $rs['card_id'] . "," . AccountModel::$status_not_active . "," . CommonModel::$del_normal . ",'" . $rs['starttime'] . "','" . $rs['expiretime'] . "'," . $rs['createrid'] . ",'" . $rs['creater'] . "','" . $date . "'," . $rs['createrid'] . ",'" . $rs['creater'] . "','" . $date . "'),";
             $insert .= "('" . self::$account_username_prefix . $rs['username_prefix'] . $rs['username_year'] . str_pad((string)$i, 4, '0', STR_PAD_LEFT) . "','" . $pwd . "','" . $salt . "','" . getPassword($pwd, $salt) . "'," . $rs['company_id'] . "," . $rs['card_id'] . "," . AccountModel::$status_not_active . "," . CommonModel::$del_normal . ",'" . $rs['starttime'] . "','" . $rs['expiretime'] . "'," . $rs['createrid'] . ",'" . $rs['creater'] . "','" . $date . "'," . $rs['createrid'] . ",'" . $rs['creater'] . "','" . $date . "'),";

+ 1 - 1
app/admin/logic/AccountLogic.php

@@ -51,7 +51,7 @@ class AccountLogic extends BaseLogic
         if (!$rs) return json_show(CommonModel::$error_param, '该账号已存在');
         if (!$rs) return json_show(CommonModel::$error_param, '该账号已存在');
 
 
         $pwd = randomkeys(6);
         $pwd = randomkeys(6);
-        $salt = randomkeys(4);
+        $salt = randomkeys(6);
         $date = date('Y-m-d H:i:s');
         $date = date('Y-m-d H:i:s');
 
 
         $res = AccountModel::create([
         $res = AccountModel::create([

+ 7 - 6
app/admin/logic/ThemeLogic.php

@@ -87,7 +87,7 @@ class ThemeLogic extends BaseLogic
             $val_modular = Validate::rule([
             $val_modular = Validate::rule([
                 'type|模块类型' => 'require|number|in:' . ThemeModel::$type_advantage . ',' . ThemeModel::$type_banner . ',' . ThemeModel::$type_exhibition . ',' . ThemeModel::$type_propaganda,
                 'type|模块类型' => 'require|number|in:' . ThemeModel::$type_advantage . ',' . ThemeModel::$type_banner . ',' . ThemeModel::$type_exhibition . ',' . ThemeModel::$type_propaganda,
                 'status|状态' => 'require|number|in:' . CommonModel::$status_normal . ',' . CommonModel::$status_disable,
                 'status|状态' => 'require|number|in:' . CommonModel::$status_normal . ',' . CommonModel::$status_disable,
-                'title|模块名称' => 'requireIf:type,' . ThemeModel::$type_advantage . '|requireIf:type,' . ThemeModel::$type_exhibition . '|requireIf:type,' . ThemeModel::$type_propaganda . '|max:255',
+                'title|模块名称' => 'requireIf:type,' . ThemeModel::$type_advantage . '|requireIf:type,' . ThemeModel::$type_exhibition . '|max:255',
                 'data|模块数据' => 'require|array|max:100',
                 'data|模块数据' => 'require|array|max:100',
             ]);
             ]);
             //数据验证规则
             //数据验证规则
@@ -96,7 +96,8 @@ class ThemeLogic extends BaseLogic
                 'img|图片' => 'require|max:255',
                 'img|图片' => 'require|max:255',
                 'jump_type|跳转类型' => 'require|number|in:' . ThemeModel::$jump_type_external . ',' . ThemeModel::$jump_type_inside . ',' . ThemeModel::$jump_type_no,
                 'jump_type|跳转类型' => 'require|number|in:' . ThemeModel::$jump_type_external . ',' . ThemeModel::$jump_type_inside . ',' . ThemeModel::$jump_type_no,
                 'jump_param|跳转参数' => 'max:255',
                 'jump_param|跳转参数' => 'max:255',
-                'good_id|商品id' => 'number|gt:0'
+                'good_id|商品id' => 'number|gt:0',
+                'title|模块数据名称名称' => 'requireIf:type,' . ThemeModel::$type_propaganda . '|max:255',
             ]);
             ]);
             foreach ($data['modular'] as $modular) {
             foreach ($data['modular'] as $modular) {
 
 
@@ -231,7 +232,7 @@ class ThemeLogic extends BaseLogic
                 'id|主题模块id' => 'require|number|gt:0',
                 'id|主题模块id' => 'require|number|gt:0',
                 'type|模块类型' => 'require|number|in:' . ThemeModel::$type_advantage . ',' . ThemeModel::$type_banner . ',' . ThemeModel::$type_exhibition . ',' . ThemeModel::$type_propaganda,
                 'type|模块类型' => 'require|number|in:' . ThemeModel::$type_advantage . ',' . ThemeModel::$type_banner . ',' . ThemeModel::$type_exhibition . ',' . ThemeModel::$type_propaganda,
                 'status|状态' => 'require|number|in:' . CommonModel::$status_normal . ',' . CommonModel::$status_disable,
                 'status|状态' => 'require|number|in:' . CommonModel::$status_normal . ',' . CommonModel::$status_disable,
-                'title|模块名称' => 'requireIf:type,' . ThemeModel::$type_advantage . '|requireIf:type,' . ThemeModel::$type_exhibition . '|requireIf:type,' . ThemeModel::$type_propaganda . '|max:255',
+                'title|模块名称' => 'requireIf:type,' . ThemeModel::$type_advantage . '|requireIf:type,' . ThemeModel::$type_exhibition . '|max:255',
                 'data|模块数据' => 'require|array|max:100',
                 'data|模块数据' => 'require|array|max:100',
             ]);
             ]);
 
 
@@ -241,7 +242,8 @@ class ThemeLogic extends BaseLogic
                 'img|图片' => 'require|max:255',
                 'img|图片' => 'require|max:255',
                 'jump_type|跳转类型' => 'require|number|in:' . ThemeModel::$jump_type_external . ',' . ThemeModel::$jump_type_inside . ',' . ThemeModel::$jump_type_no,
                 'jump_type|跳转类型' => 'require|number|in:' . ThemeModel::$jump_type_external . ',' . ThemeModel::$jump_type_inside . ',' . ThemeModel::$jump_type_no,
                 'jump_param|跳转参数' => 'max:255',
                 'jump_param|跳转参数' => 'max:255',
-                'good_id|商品id' => 'number'
+                'good_id|商品id' => 'number',
+                'title|模块数据名称' => 'requireIf:type,' . ThemeModel::$type_propaganda . '|max:255',
             ]);
             ]);
 
 
             $del = $ins = [];
             $del = $ins = [];
@@ -265,7 +267,6 @@ class ThemeLogic extends BaseLogic
                     ->where('is_del', CommonModel::$del_normal)
                     ->where('is_del', CommonModel::$del_normal)
                     ->column('good_name', 'id');
                     ->column('good_name', 'id');
 
 
-
                 foreach ($da as &$v) {
                 foreach ($da as &$v) {
 
 
                     if ($modular['type'] == ThemeModel::$type_exhibition) $val_data->append('good_id', 'require');
                     if ($modular['type'] == ThemeModel::$type_exhibition) $val_data->append('good_id', 'require');
@@ -284,6 +285,7 @@ class ThemeLogic extends BaseLogic
                                     'good_name' => $modular['type'] == ThemeModel::$type_exhibition ? $goods[$v['good_id']] ?? '' : '',
                                     'good_name' => $modular['type'] == ThemeModel::$type_exhibition ? $goods[$v['good_id']] ?? '' : '',
                                     'good_id' => $v['good_id'],
                                     'good_id' => $v['good_id'],
                                     'style_type' => $v['style_type'],
                                     'style_type' => $v['style_type'],
+                                    'title' => $v['title'],
                                     'updatetime' => $date,
                                     'updatetime' => $date,
                                 ]);
                                 ]);
 
 
@@ -312,7 +314,6 @@ class ThemeLogic extends BaseLogic
                     ]);
                     ]);
             }
             }
             if ($ins) {
             if ($ins) {
-
                 Db::name('theme_modular_data')->insertAll($ins);
                 Db::name('theme_modular_data')->insertAll($ins);
             }
             }
 
 

+ 15 - 10
app/admin/middleware/adminMiddleware.php

@@ -3,6 +3,7 @@
 namespace app\admin\middleware;
 namespace app\admin\middleware;
 
 
 use app\admin\logic\BaseLogic;
 use app\admin\logic\BaseLogic;
+use app\model\CommonModel;
 use think\Exception;
 use think\Exception;
 use think\exception\ValidateException;
 use think\exception\ValidateException;
 use think\facade\Cache;
 use think\facade\Cache;
@@ -33,16 +34,22 @@ class adminMiddleware
 
 
         //判断白名单
         //判断白名单
         if (!in_array(request()->pathinfo(), $this->white_list)) {
         if (!in_array(request()->pathinfo(), $this->white_list)) {
-            $val = Validate::rule(['token'=>'require']);
 
 
-            if(!$val->check($param)) throw new ValidateException($val->getError());
+            try {
 
 
-            //获取用户信息
-            $user = verifyToken($param['token']);
-            BaseLogic::setUserInfo($user);
-            $request->uid = $user['uid'];
-            $request->uname = $user['uname'];
-            $request->roleid = $user['roleid'];
+                $val = Validate::rule(['token' => 'require']);
+
+                if (!$val->check($param)) throw new ValidateException($val->getError());
+
+                //获取用户信息
+                $user = verifyToken($param['token']);
+                BaseLogic::setUserInfo($user);
+                $request->uid = $user['uid'];
+                $request->uname = $user['uname'];
+                $request->roleid = $user['roleid'];
+            } catch (ValidateException $validateException) {
+                return json_show(CommonModel::$error_token, $validateException->getError());
+            }
         }
         }
 
 
         return $next($request);
         return $next($request);
@@ -62,6 +69,4 @@ class adminMiddleware
     }
     }
 
 
 
 
-
-
 }
 }

+ 10 - 0
app/mobile/config/validate_rules.php

@@ -38,5 +38,15 @@ return [
         'mobile|联系电话' => 'require|mobile',
         'mobile|联系电话' => 'require|mobile',
     ],
     ],
 
 
+    //修改密码
+    'changePassword'=>[
+        'old_password|旧密码' => 'require|min:6|max:255',
+        'new_password|新密码' => 'require|min:6|max:255',
+    ],
+
+    //商品详情
+    'goodInfo'=>[
+        'code|编码'=>'require|length:18'
+    ],
 
 
 ];
 ];

+ 9 - 16
app/mobile/controller/Account.php

@@ -37,24 +37,17 @@ class Account extends BaseController
         return AccountLogic::info();
         return AccountLogic::info();
     }
     }
 
 
-    //省市区编码
-    public function area()
-    {
-        $parent_code = $this->request->post('parent_code', '');
-        return CommonLogic::getAddr($parent_code);
-    }
+    //更改密码
+    public function updatePassword(){
+        $param = $this->request->only(['old_password', 'new_password'], 'post');
 
 
-    //视频列表
-    public function getVideoList()
-    {
-        $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
-        return AccountLogic::getVideoList($param);
-    }
+        $val = Validate::rule(Config::get('validate_rules.changePassword'));
 
 
-    //手机主题
-    public function theme()
-    {
-        return AccountLogic::theme();
+        if (!$val->check($param)) throw new ValidateException($val->getError());
+
+        return AccountLogic::updatePassword($param);
     }
     }
 
 
+
+
 }
 }

+ 34 - 0
app/mobile/controller/Common.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace app\mobile\controller;
+
+use app\mobile\logic\CommonLogic;
+use app\admin\logic\CommonLogic as AdminCommonLogic;
+use app\BaseController;
+use app\mobile\logic\AccountLogic;
+
+//公共
+class Common extends BaseController
+{
+
+    //省市区编码
+    public function area()
+    {
+        $parent_code = $this->request->post('parent_code', '');
+        return AdminCommonLogic::getAddr($parent_code);
+    }
+
+    //视频列表
+    public function getVideoList()
+    {
+        $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
+        return CommonLogic::getVideoList($param);
+    }
+
+    //手机主题
+    public function theme()
+    {
+        return CommonLogic::theme();
+    }
+
+}

+ 33 - 0
app/mobile/controller/Exchange.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace app\mobile\controller;
+
+use app\BaseController;
+use app\mobile\logic\ExchangeLogic;
+use think\exception\ValidateException;
+use think\facade\Config;
+use think\facade\Validate;
+
+//兑换
+class Exchange extends BaseController
+{
+    //商品列表
+    public function goodList()
+    {
+        $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
+        return ExchangeLogic::goodList($param);
+    }
+
+    //商品详情
+    public function goodInfo()
+    {
+        $code = $this->request->post('code', '');
+
+        $val=Validate::rule(Config::get('validate_rules.goodInfo'));
+        if(!$val->check(['code'=>$code])) throw new ValidateException($val->getError());
+
+        return ExchangeLogic::goodInfo($code);
+    }
+
+
+}

+ 22 - 48
app/mobile/logic/AccountLogic.php

@@ -86,65 +86,39 @@ class AccountLogic extends BaseLogic
             ->findOrEmpty()
             ->findOrEmpty()
             ->toArray();
             ->toArray();
 
 
-        return $info ? json_show(CommonModel::$success, '获取账户详情成功', $info) : json_show(CommonModel::$error_param, '账户为空');
+        return $info ? json_show(CommonModel::$success, '获取账户详情成功', $info) : json_show(CommonModel::$error_token, '账户为空');
 
 
     }
     }
 
 
-    //视频列表
-    public static function getVideoList(array $data = []): Json
+    //更改密码
+    public static function updatePassword(array $data = []): Json
     {
     {
-        $rs = AccountModel::field('id,video_ids')
-            ->where(['id' => self::$aid, 'is_del' => CommonModel::$del_normal])
+        $rs = AccountModel::field('id,password,salt')
+            ->where(['is_del' => CommonModel::$del_normal, 'id' => self::$aid])
             ->findOrEmpty()
             ->findOrEmpty()
-            ->toArray();
+            ->getData();//password,salt这两个字段在模型里定义了隐藏,所以要在这里使用getData方法获取原始数据
 
 
-        if (empty($rs)) return json_show(CommonModel::$error_param, '该账户不存在');
+        if (empty($rs)) return json_show(CommonModel::$error_token, '该账户不存在');
 
 
-        $db = VideoModel::where(['is_del' => CommonModel::$del_normal, 'status' => CommonModel::$status_normal])
-            ->whereIn('id', $rs['video_ids']);
+        if (getPassword($data['old_password'], $rs['salt']) != $rs['password']) return json_show(CommonModel::$error_param, '密码错误');
 
 
-        $count = $db->count('id');
+        $salt = randomkeys(6);
+        $password = getPassword($data['new_password'], $salt);
 
 
-        $list = $db
-            ->field('id,video_sn,video_name,video_url,video_img')
-            ->page($data['page'], $data['size'])
-            ->order(['weight' => 'desc', 'id' => 'desc'])
-            ->select()
-            ->toArray();
+        $da = [
+            'pwd' => $data['new_password'],
+            'salt' => $salt,
+            'password' => $password,
+            'updaterid' => self::$aid,
+            'updater' => self::$aname,
+            'updatetime' => date('Y-m-d H:i:s'),
+        ];
 
 
-        return json_show(CommonModel::$success, '获取视频列表成功', ['count' => $count, 'list' => $list]);
-    }
+        $rs = AccountModel::where(['id' => self::$aid, 'is_del' => CommonModel::$del_normal])
+            ->save($da);
+
+        return $rs ? json_show(CommonModel::$error_token, '修改密码成功') : json_show(CommonModel::$error_param, '修改密码失败');
 
 
-    //手机主题
-    public static function theme(): Json
-    {
-        $group_id = GroupModel::where(['is_del' => CommonModel::$del_normal, 'company_id' => self::$company_id, 'card_id' => self::$card_id])
-            ->value('id', 0);
-        if (!$group_id) return json_show(CommonModel::$error_param, '该账户所对应的分组不存在');
-
-        $rs = ThemeModel::field('id,code')
-            ->where(['is_del' => CommonModel::$del_normal, 'group_id' => $group_id, 'status' => CommonModel::$status_normal])
-            ->append(['modular'])
-            ->withAttr('modular', function ($val, $data) {
-                return Db::name('theme_modular')
-                    ->field('id,title,type')
-                    ->where(['is_del' => CommonModel::$del_normal, 'theme_id' => $data['id'], 'status' => CommonModel::$status_normal])
-                    ->order(['addtime' => 'desc', 'id' => 'desc'])
-                    ->append(['data'])
-                    ->withAttr('data', function ($v, $d) {
-                        return Db::name('theme_modular_data')
-                            ->field('id,img,jump_type,jump_param,good_name,good_id,style_type')
-                            ->where(['is_del' => CommonModel::$del_normal, 'theme_modular_id' => $d['id']])
-                            ->order(['addtime' => 'desc', 'id' => 'desc'])
-                            ->select()
-                            ->toArray();
-                    })
-                    ->select()
-                    ->toArray();
-            })
-            ->findOrEmpty()
-            ->toArray();
-        return empty($rs) ? json_show(CommonModel::$error_param, '该手机主题不存在') : json_show(CommonModel::$success, '获取手机主题成功', $rs);
     }
     }
 
 
 
 

+ 74 - 0
app/mobile/logic/CommonLogic.php

@@ -0,0 +1,74 @@
+<?php
+
+namespace app\mobile\logic;
+
+use app\model\AccountModel;
+use app\model\CommonModel;
+use app\model\GroupModel;
+use app\model\ThemeModel;
+use app\model\VideoModel;
+use think\facade\Db;
+use think\response\Json;
+
+//公共
+class CommonLogic extends BaseLogic
+{
+    //视频列表
+    public static function getVideoList(array $data = []): Json
+    {
+        $rs = AccountModel::field('id,video_ids')
+            ->where(['id' => self::$aid, 'is_del' => CommonModel::$del_normal])
+            ->findOrEmpty()
+            ->toArray();
+
+        if (empty($rs)) return json_show(CommonModel::$error_param, '该账户不存在');
+
+        $db = VideoModel::where(['is_del' => CommonModel::$del_normal, 'status' => CommonModel::$status_normal])
+            ->whereIn('id', $rs['video_ids']);
+
+        $count = $db->count('id');
+
+        $list = $db
+            ->field('id,video_sn,video_name,video_url,video_img')
+            ->page($data['page'], $data['size'])
+            ->order(['weight' => 'desc', 'id' => 'desc'])
+            ->select()
+            ->toArray();
+
+        return json_show(CommonModel::$success, '获取视频列表成功', ['count' => $count, 'list' => $list]);
+    }
+
+    //手机主题
+    public static function theme(): Json
+    {
+        $group_id = GroupModel::where(['is_del' => CommonModel::$del_normal, 'company_id' => self::$company_id, 'card_id' => self::$card_id])
+            ->value('id', 0);
+        if (!$group_id) return json_show(CommonModel::$error_param, '该账户所对应的分组不存在');
+
+        $rs = ThemeModel::field('id,code')
+            ->where(['is_del' => CommonModel::$del_normal, 'group_id' => $group_id, 'status' => CommonModel::$status_normal])
+            ->append(['modular'])
+            ->withAttr('modular', function ($val, $data) {
+                return Db::name('theme_modular')
+                    ->field('id,title,type')
+                    ->where(['is_del' => CommonModel::$del_normal, 'theme_id' => $data['id'], 'status' => CommonModel::$status_normal])
+                    ->order(['addtime' => 'desc', 'id' => 'desc'])
+                    ->append(['data'])
+                    ->withAttr('data', function ($v, $d) {
+                        return Db::name('theme_modular_data')
+                            ->field('id,img,jump_type,jump_param,good_name,good_id,style_type')
+                            ->where(['is_del' => CommonModel::$del_normal, 'theme_modular_id' => $d['id']])
+                            ->order(['addtime' => 'desc', 'id' => 'desc'])
+                            ->select()
+                            ->toArray();
+                    })
+                    ->select()
+                    ->toArray();
+            })
+            ->findOrEmpty()
+            ->toArray();
+        return empty($rs) ? json_show(CommonModel::$error_param, '该手机主题不存在') : json_show(CommonModel::$success, '获取手机主题成功', $rs);
+    }
+
+
+}

+ 64 - 0
app/mobile/logic/ExchangeLogic.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace app\mobile\logic;
+
+use app\model\CommonModel;
+use app\model\CompanyGoodModel;
+use app\model\GoodModel;
+use app\model\GroupModel;
+use think\response\Json;
+
+class ExchangeLogic extends BaseLogic
+{
+
+    //商品列表
+    public static function goodList(array $data = []): Json
+    {
+
+        $group_id = GroupModel::where(['is_del' => CommonModel::$del_normal, 'company_id' => self::$company_id, 'card_id' => self::$card_id])
+            ->value('id', 0);
+        if (!$group_id) return json_show(CommonModel::$error_param, '该账户所对应的分组不存在');
+
+
+        $db = CompanyGoodModel::alias('a')
+            ->leftJoin('good b', 'b.id=a.good_id AND b.type=' . GoodModel::$type_exchange . ' AND b.is_del=' . CommonModel::$del_normal)
+            ->leftJoin('inventory_exchange c', 'c.account_id=' . self::$aid . ' AND c.good_id=a.good_id')
+            ->where(['a.is_del' => CommonModel::$del_normal, 'a.group_id' => $group_id]);
+
+        $count = $db->count('a.id');
+
+        $list = $db
+            ->field('a.id,a.code,a.good_id,b.good_cover_img,b.good_name,b.moq,b.step,c.inventory')
+            ->page($data['page'], $data['size'])
+            ->order(['a.is_top' => 'desc', 'a.weight' => 'desc', 'a.id' => 'desc'])
+            ->select()
+            ->toArray();
+
+        return json_show(CommonModel::$success, '获取兑换商品列表成功', ['count' => $count, 'list' => $list]);
+
+    }
+
+    //商品详情
+    public static function goodInfo(string $code = ''): Json
+    {
+        $rs = CompanyGoodModel::alias('a')
+            ->field('a.id,a.code,a.good_id,b.good_cover_img,b.good_code,b.good_name,b.moq,b.step,b.good_banner_img,b.good_img,b.good_param,b.status,c.inventory,d.unit')
+            ->leftJoin('good b', 'b.id=a.good_id AND b.is_del=' . CommonModel::$del_normal)
+            ->leftJoin('inventory_exchange c', 'c.account_id=' . self::$aid . ' AND c.good_id=a.good_id')
+            ->leftJoin('unit d', 'd.id=b.unit_id AND d.is_del=' . CommonModel::$del_normal)
+            ->where(['a.is_del' => CommonModel::$del_normal, 'a.code' => $code])
+            ->withAttr('good_param', function ($val) {
+                return json_decode($val, true);
+            })
+            ->withAttr('good_img', function ($val) {
+                return explode(',',$val);
+            })
+            ->findOrEmpty()
+            ->toArray();
+
+        return json_show(CommonModel::$success, '获取兑换商品详情成功', $rs);
+
+    }
+
+
+}

+ 14 - 9
app/mobile/middleware/mobileMiddleware.php

@@ -35,19 +35,24 @@ class mobileMiddleware
 
 
         //判断白名单
         //判断白名单
         if (!in_array(request()->pathinfo(), $this->white_list)) {
         if (!in_array(request()->pathinfo(), $this->white_list)) {
-            $val = Validate::rule(['token' => 'require']);
 
 
-            if (!$val->check($param)) throw new ValidateException($val->getError());
+            try {
 
 
-            //获取用户信息
-            $account = $this->verifyMobileToken($param['token']);
-            BaseLogic::setUserInfo($account['aid'], $account['aname'], $account['company_id'], $account['card_id']);
+                $val = Validate::rule(['token' => 'require']);
 
 
-            $request->aid = $account['aid'];
-            $request->aname = $account['aname'];
-            $request->company_id = $account['company_id'];
-            $request->card_id = $account['card_id'];
+                if (!$val->check($param)) throw new ValidateException($val->getError());
 
 
+                //获取用户信息
+                $account = $this->verifyMobileToken($param['token']);
+                BaseLogic::setUserInfo($account['aid'], $account['aname'], $account['company_id'], $account['card_id']);
+
+                $request->aid = $account['aid'];
+                $request->aname = $account['aname'];
+                $request->company_id = $account['company_id'];
+                $request->card_id = $account['card_id'];
+            } catch (ValidateException $validateException) {
+                return json_show(CommonModel::$error_token, $validateException->getError());
+            }
         }
         }
 
 
         return $next($request);
         return $next($request);

+ 7 - 3
app/mobile/route/app.php

@@ -5,9 +5,10 @@ use think\facade\Route;
 Route::rule('login', 'Account/login');//登录
 Route::rule('login', 'Account/login');//登录
 Route::rule('logout', 'Account/logout');//登出
 Route::rule('logout', 'Account/logout');//登出
 Route::rule('info', 'Account/info');//账户详情
 Route::rule('info', 'Account/info');//账户详情
-Route::rule('video', 'Account/getVideoList');//视频列表
-Route::rule('area', 'Account/area');//省市区编码
-Route::rule('theme', 'Account/theme');//手机主题
+Route::rule('updatePassword', 'Account/updatePassword');//修改密码
+Route::rule('video', 'Common/getVideoList');//视频列表
+Route::rule('area', 'Common/area');//省市区编码
+Route::rule('theme', 'Common/theme');//手机主题
 
 
 //【地址】
 //【地址】
 Route::rule('addrList', 'Addr/list');//列表
 Route::rule('addrList', 'Addr/list');//列表
@@ -20,5 +21,8 @@ Route::rule('addrDelete', 'Addr/delete');//删除
 Route::rule('serviceList', 'Service/list');//列表
 Route::rule('serviceList', 'Service/list');//列表
 Route::rule('serviceRead', 'Service/read');//读取
 Route::rule('serviceRead', 'Service/read');//读取
 
 
+//【兑换商品】
+Route::rule('exchangeGoodList', 'Exchange/goodList');//商品列表
+Route::rule('exchangeGoodInfo', 'Exchange/goodInfo');//商品详情