瀏覽代碼

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

wufeng 2 年之前
父節點
當前提交
56b9722d7c

+ 24 - 2
app/mobile/controller/Account.php

@@ -2,6 +2,7 @@
 
 
 namespace app\mobile\controller;
 namespace app\mobile\controller;
 
 
+use app\admin\logic\CommonLogic;
 use app\BaseController;
 use app\BaseController;
 use app\mobile\logic\AccountLogic;
 use app\mobile\logic\AccountLogic;
 use think\exception\ValidateException;
 use think\exception\ValidateException;
@@ -27,12 +28,33 @@ class Account extends BaseController
     //登出
     //登出
     public function logout()
     public function logout()
     {
     {
-        return AccountLogic::logout($this->request->post('token', ''));
+        return AccountLogic::logout();
     }
     }
 
 
     //详情
     //详情
-    public function info(){
+    public function info()
+    {
         return AccountLogic::info();
         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);
+    }
+
+    //手机主题
+    public function theme()
+    {
+        return AccountLogic::theme();
+    }
+
 }
 }

+ 28 - 0
app/mobile/controller/Service.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace app\mobile\controller;
+
+use app\BaseController;
+use app\mobile\logic\ServiceLogic;
+
+
+//服务
+class Service extends BaseController
+{
+    //列表
+    public function list()
+    {
+        $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
+        return ServiceLogic::list($param);
+    }
+    
+    //详情
+    public function read()
+    {
+        $id = $this->request->post('id/d', 0);
+        return ServiceLogic::read($id);
+    }
+
+
+
+}

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

@@ -5,6 +5,9 @@ namespace app\mobile\logic;
 use app\model\AccountModel;
 use app\model\AccountModel;
 use app\model\AccountTokenModel;
 use app\model\AccountTokenModel;
 use app\model\CommonModel;
 use app\model\CommonModel;
+use app\model\GroupModel;
+use app\model\ThemeModel;
+use app\model\VideoModel;
 use think\Exception;
 use think\Exception;
 use think\facade\Config;
 use think\facade\Config;
 use think\facade\Db;
 use think\facade\Db;
@@ -65,7 +68,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')]);
         $info = AccountTokenModel::where(['accountid' => self::$aid])->save(['token' => '', 'expiretime' => date('Y-m-d H:i:s')]);
@@ -87,4 +90,62 @@ 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, '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);
+    }
+
+
 }
 }

+ 1 - 1
app/mobile/logic/AddrLogic.php

@@ -50,7 +50,7 @@ class AddrLogic extends BaseLogic
     //详情
     //详情
     public static function read(int $id = 0): Json
     public static function read(int $id = 0): Json
     {
     {
-        $rs = AddrModel::field(true)
+        $rs = AddrModel::withoutField('uid,is_del')
             ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
             ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
             ->withAttr('addr_code', function ($val) {
             ->withAttr('addr_code', function ($val) {
                 return explode(',', $val);
                 return explode(',', $val);

+ 51 - 0
app/mobile/logic/ServiceLogic.php

@@ -0,0 +1,51 @@
+<?php
+
+namespace app\mobile\logic;
+
+use app\model\AccountModel;
+use app\model\AccountTokenModel;
+use app\model\CommonModel;
+use app\model\ServiceModel;
+use app\model\VideoModel;
+use think\Exception;
+use think\facade\Config;
+use think\facade\Db;
+use think\response\Json;
+
+class ServiceLogic extends BaseLogic
+{
+    //列表
+    public static function list(array $data = []): Json
+    {
+        $db = ServiceModel::where([
+            'is_del' => CommonModel::$del_normal,
+            'company_id' => self::$company_id,
+            'card_id' => self::$card_id,
+        ]);
+
+        $count = $db->count('id');
+
+        $list = $db
+            ->field('id,original_price,activity_price,title,activity_status')
+            ->page($data['page'], $data['size'])
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+
+        return json_show(CommonModel::$success, '获取服务列表成功', ['count' => $count, 'list' => $list]);
+    }
+
+    //详情
+    public static function read(int $id = 0): Json
+    {
+        $info = ServiceModel::field('id,original_price,activity_price,title,content,starttime,endtime,expiretime,activity_status')
+            ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
+            ->findOrEmpty()
+            ->toArray();
+
+        return $info ? json_show(CommonModel::$success, '获取服务详情成功', $info) : json_show(CommonModel::$error_param, '服务为空');
+
+    }
+
+
+}

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

@@ -2,13 +2,23 @@
 
 
 use think\facade\Route;
 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('theme', 'Account/theme');//手机主题
 
 
 //【地址】
 //【地址】
-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');//删除
+
+//【服务】
+Route::rule('serviceList', 'Service/list');//列表
+Route::rule('serviceRead', 'Service/read');//读取
+
+
+