Browse Source

视频列表和省市区编码

wufeng 2 years ago
parent
commit
adf49f6280
3 changed files with 56 additions and 10 deletions
  1. 14 1
      app/mobile/controller/Account.php
  2. 28 1
      app/mobile/logic/AccountLogic.php
  3. 14 8
      app/mobile/route/app.php

+ 14 - 1
app/mobile/controller/Account.php

@@ -2,6 +2,7 @@
 
 namespace app\mobile\controller;
 
+use app\admin\logic\CommonLogic;
 use app\BaseController;
 use app\mobile\logic\AccountLogic;
 use think\exception\ValidateException;
@@ -27,7 +28,7 @@ class Account extends BaseController
     //登出
     public function logout()
     {
-        return AccountLogic::logout($this->request->post('token', ''));
+        return AccountLogic::logout();
     }
 
     //详情
@@ -35,4 +36,16 @@ class Account extends BaseController
         return AccountLogic::info();
     }
 
+    //省市区编码
+    public function area(){
+        $parent_code = $this->request->post('parent_code', '');
+        return CommonLogic::getAddr($parent_code);
+    }
+
+    //视频列表
+    public function getVideoList(){
+        $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
+        return AccountLogic::getVideoList($param);
+    }
+
 }

+ 28 - 1
app/mobile/logic/AccountLogic.php

@@ -5,6 +5,7 @@ namespace app\mobile\logic;
 use app\model\AccountModel;
 use app\model\AccountTokenModel;
 use app\model\CommonModel;
+use app\model\VideoModel;
 use think\Exception;
 use think\facade\Config;
 use think\facade\Db;
@@ -65,7 +66,7 @@ class AccountLogic extends BaseLogic
     }
 
     //登出
-    public static function logout(string $token = ''): Json
+    public static function logout(): Json
     {
 
         $info = AccountTokenModel::where(['accountid' => self::$aid])->save(['token' => '', 'expiretime' => date('Y-m-d H:i:s')]);
@@ -87,4 +88,30 @@ class AccountLogic 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)
+            ->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]);
+    }
+
+
 }

+ 14 - 8
app/mobile/route/app.php

@@ -2,13 +2,19 @@
 
 use think\facade\Route;
 
-Route::rule('login', 'mobile/Account/login');//登录
-Route::rule('logout', 'mobile/Account/logout');//登出
-Route::rule('info', 'mobile/Account/info');//账户详情
+Route::rule('login', 'Account/login');//登录
+Route::rule('logout', 'Account/logout');//登出
+Route::rule('info', 'Account/info');//账户详情
+Route::rule('video', 'Account/getVideoList');//视频列表
+Route::rule('area', 'Account/area');//省市区编码
 
 //【地址】
-Route::rule('addrList', 'mobile/Addr/list');//列表
-Route::rule('addrAdd', 'mobile/Addr/add');//添加
-Route::rule('addrRead', 'mobile/Addr/read');//读取
-Route::rule('addrEdit', 'mobile/Addr/edit');//修改
-Route::rule('addrDelete', 'mobile/Addr/delete');//删除
+Route::rule('addrList', 'Addr/list');//列表
+Route::rule('addrAdd', 'Addr/add');//添加
+Route::rule('addrRead', 'Addr/read');//读取
+Route::rule('addrEdit', 'Addr/edit');//修改
+Route::rule('addrDelete', 'Addr/delete');//删除
+
+//【视频】
+
+