Ver Fonte

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

wufeng há 2 anos atrás
pai
commit
c048cc91f3

+ 7 - 3
app/admin/config/validate_rules.php

@@ -138,7 +138,12 @@ return [
     'VideoGroupAdd' => [
         'company_id|企业id' => 'require|number|gt:0',
         'card_id|卡类型id' => 'require|number|gt:0',
-        'video_list|视频集合' => 'require|array|min:1|max:100',
+    ],
+    //【视频分组明细】
+    //添加
+    'VideoGroupItemAdd' => [
+        'video_group_id|视频分组id' => 'require|number|gt:0',
+        'video_id|视频id' => 'require|number|gt:0',
     ],
     //【商品分组】
     //添加
@@ -181,8 +186,7 @@ return [
         'company_id|企业' => 'require|number|gt:0',
         'card_id|卡类型' => 'require|number|gt:0',
         'username_prefix|账户前缀' => 'require|max:255',
-        'suffix_start|账户后缀起始值' => 'require|number|max:9999|lt:suffix_end',
-        'suffix_end|账户后缀结束值' => 'require|number|max:9999|gt:suffix_start',
+        'username_year|账户年份' => 'require|number|length:2,4',
         'starttime|开始日期' => 'require|date|lt:expiretime',
         'expiretime|结束日期' => 'require|date|gt:starttime',
     ],

+ 9 - 2
app/admin/controller/Account.php

@@ -56,8 +56,7 @@ class Account extends BaseController
     //批量添加账户
     public function batchAdd()
     {
-
-        $param = $this->request->only(['company_id', 'card_id', 'username_prefix', 'suffix_start', 'suffix_end', 'starttime', 'expiretime'], 'post');
+        $param = $this->request->only(['company_id', 'card_id', 'username_prefix', 'username_year', 'starttime', 'expiretime'], 'post');
 
         $val = Validate::rule(Config::get('validate_rules.AccountBatchAdd'));
 
@@ -73,4 +72,12 @@ class Account extends BaseController
         return AccountLogic::delete($id);
     }
 
+    //批量添加账户列表
+    public function batchLog()
+    {
+        $param = $this->request->only(['page' => 1, 'size' => 10, 'company_id' => '', 'card_id' => ''], 'post');
+
+        return AccountLogic::batchLog($param);
+    }
+
 }

+ 5 - 5
app/admin/controller/VideoGroup.php

@@ -15,7 +15,7 @@ class VideoGroup extends BaseController
     //获取视频分组列表
     public function list()
     {
-        $param = $this->request->only(['page' => 1, 'size' => 10, 'status' => '', 'company_id' => '', 'card_id' => ''], 'post');
+        $param = $this->request->only(['page' => 1, 'size' => 10, 'status' => '', 'company_title' => '', 'card_title' => ''], 'post');
 
         return VideoGroupLogic::list($param);
     }
@@ -23,7 +23,7 @@ class VideoGroup extends BaseController
     //添加视频分组
     public function add()
     {
-        $param = $this->request->only(['company_id', 'card_id', 'video_list', 'remark' => ''], 'post');
+        $param = $this->request->only(['company_id', 'card_id', 'remark' => ''], 'post');
 
         $val = Validate::rule(Config::get('validate_rules.VideoGroupAdd'));
 
@@ -42,7 +42,7 @@ class VideoGroup extends BaseController
     //编辑视频分组
     public function edit()
     {
-        $param = $this->request->only(['id', 'company_id', 'card_id', 'video_list', 'remark' => ''], 'post');
+        $param = $this->request->only(['id', 'company_id', 'card_id','remark' => ''], 'post');
 
         $val = Validate::rule(array_merge(Config::get('validate_rules.VideoGroupAdd'), ['id|视频分组id' => 'require|number|gt:0']));
 
@@ -66,8 +66,8 @@ class VideoGroup extends BaseController
     //删除视频分组
     public function delete()
     {
-        $id = $this->request->post('id/d', 0);
-        return VideoGroupLogic::delete($id);
+        $ids = $this->request->post('id/a', []);
+        return VideoGroupLogic::delete($ids);
     }
 
     //视频分组置顶

+ 79 - 0
app/admin/controller/VideoGroupItem.php

@@ -0,0 +1,79 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\logic\VideoGroupItemLogic;
+use app\BaseController;
+use app\model\CommonModel;
+use think\exception\ValidateException;
+use think\facade\Config;
+use think\facade\Validate;
+
+//【视频分组明细】
+class VideoGroupItem extends BaseController
+{
+    //获取视频分组明细列表
+    public function list()
+    {
+        $param = $this->request->only(['video_group_id' => 0, 'page' => 1, 'size' => 10, 'video_title' => ''], 'post');
+
+        return VideoGroupItemLogic::list($param);
+    }
+
+    //添加视频分组明细
+    public function add()
+    {
+        $param = $this->request->only(['video_group_id', 'video_id'], 'post');
+
+        $val = Validate::rule(Config::get('validate_rules.VideoGroupItemAdd'));
+
+        if (!$val->check($param)) throw new ValidateException($val->getError());
+
+        return VideoGroupItemLogic::add($param);
+    }
+
+    //获取视频分组明细详情
+    public function read()
+    {
+        $id = $this->request->post('id/d', 0);
+        return VideoGroupItemLogic::read($id);
+    }
+
+    //编辑视频分组明细
+    public function edit()
+    {
+        $param = $this->request->only(['id', 'video_id'], 'post');
+
+        $val = Validate::rule([
+            'id|视频分组明细id' => 'require|number|gt:0',
+            'video_id|视频id' => 'require|number|gt:0',
+        ]);
+
+        if (!$val->check($param)) throw new ValidateException($val->getError());
+
+        return VideoGroupItemLogic::edit($param);
+    }
+
+    //删除视频分组明细
+    public function delete()
+    {
+        $ids = $this->request->post('id/a', []);
+        return VideoGroupItemLogic::delete($ids);
+    }
+
+    //视频分组明细置顶
+    public function top()
+    {
+        $param = $this->request->only(['id', 'is_top'], 'post');
+
+        $val = Validate::rule([
+            'id' => 'require|number|gt:0',
+            'is_top|是否置顶' => 'require|number|in:' . CommonModel::$top_no . ',' . CommonModel::$top_yes,
+        ]);
+
+        if (!$val->check($param)) throw new ValidateException($val->getError());
+
+        return VideoGroupItemLogic::top($param);
+    }
+
+}

+ 66 - 36
app/admin/logic/AccountLogic.php

@@ -4,6 +4,7 @@ namespace app\admin\logic;
 
 use app\model\AccountModel;
 use app\model\CommonModel;
+use think\Exception;
 use think\facade\Db;
 use think\response\Json;
 
@@ -111,43 +112,52 @@ class AccountLogic extends BaseLogic
     //批量添加账户
     public static function batchAdd(array $data = []): Json
     {
-        $usernames = [];
-
-        $date = date('Y-m-d H:i:s');
-
-        for ($i = $data['suffix_start']; $i <= $data['suffix_end']; $i++) {
-            $pwd = randomkeys(6);
-            $salt = randomkeys(4);
-            $usernames[] = [
-                'username' => $data['username_prefix'] . str_pad($i, 4, '0', STR_PAD_LEFT),
-                'pwd' => $pwd,
-                'salt' => $salt,
-                'password' => getPassword($pwd, $salt),
-                'company_id' => $data['company_id'],
-                'card_id' => $data['card_id'],
-                'status' => AccountModel::$status_not_active,
-                'is_del' => CommonModel::$del_normal,
-                'starttime' => $data['starttime'],
-                'expiretime' => $data['expiretime'],
-                'createrid' => self::$uid,
-                'creater' => self::$uname,
-                'addtime' => $date,
-                'updaterid' => self::$uid,
-                'updater' => self::$uname,
-                'updatetime' => $date,
-            ];
+        Db::startTrans();
+
+        try {
+
+            $rs = AccountModel::field('id,username')
+                ->where('is_del', CommonModel::$del_normal)
+                ->whereLike('username', $data['username_prefix'] . $data['username_year'] . '____')
+                ->findOrEmpty();
+            if (!$rs->isEmpty()) throw new Exception($rs->username . '账号已存在');
+
+            $date = date('Y-m-d H:i:s');
+
+            for ($i = 0; $i <= 9999; $i++) {
+                $pwd = randomkeys(6);
+                $salt = randomkeys(4);
+                Db::name('account')->insert([
+                    'username' => $data['username_prefix'] . $data['username_year'] . str_pad($i, 4, '0', STR_PAD_LEFT),
+                    'pwd' => $pwd,
+                    'salt' => $salt,
+                    'password' => getPassword($pwd, $salt),
+                    'company_id' => $data['company_id'],
+                    'card_id' => $data['card_id'],
+                    'status' => AccountModel::$status_not_active,
+                    'is_del' => CommonModel::$del_normal,
+                    'starttime' => $data['starttime'],
+                    'expiretime' => $data['expiretime'],
+                    'createrid' => self::$uid,
+                    'creater' => self::$uname,
+                    'addtime' => $date,
+                    'updaterid' => self::$uid,
+                    'updater' => self::$uname,
+                    'updatetime' => $date,
+                ]);//比insertAll方法快2/3
+
+            }
+
+            Db::name('account_batch_log')->insert($data);
+
+            Db::commit();
+
+            return json_show(CommonModel::$success, '10000个账户批量添加成功');
+
+        } catch (Exception $exception) {
+            Db::rollback();
+            return json_show(CommonModel::$error_param, '批量添加账户失败,' . $exception->getMessage());
         }
-
-        $rs = AccountModel::field('id,username')
-            ->where('is_del', CommonModel::$del_normal)
-            ->whereIn('username', array_column($usernames, 'username'))
-            ->findOrEmpty();
-        if (!$rs->isEmpty()) return json_show(CommonModel::$error_param, $rs->username . '账号已存在');
-
-        $res = Db::name('account')->insertAll($usernames);
-
-        return $res ? json_show(CommonModel::$success, $res . '个账户批量添加成功') : json_show(CommonModel::$error_param, '批量添加账户失败');
-
     }
 
     //删除
@@ -160,5 +170,25 @@ class AccountLogic extends BaseLogic
         return $rs ? json_show(CommonModel::$success, '删除成功') : json_show(CommonModel::$error_param, '删除失败,该账户不存在或不允许删除');
     }
 
+    //列表
+    public static function batchLog(array $data = []): Json
+    {
+        $where = [];
+        if ($data['company_id'] != '') $where[] = ['company_id', '=', $data['company_id']];
+        if ($data['card_id'] != '') $where[] = ['card_id', '=', $data['card_id']];
+
+        $count = Db::name('account_batch_log')
+            ->where($where)
+            ->count('id');
+
+        $list = Db::name('account_batch_log')
+            ->where($where)
+            ->field(true)
+            ->order('id', 'desc')
+            ->page($data['page'], $data['size'])
+            ->select()
+            ->toArray();
+        return json_show(CommonModel::$success, '获取批量添加账户列表成功', ['count' => $count, 'list' => $list]);
+    }
 
 }

+ 172 - 0
app/admin/logic/VideoGroupItemLogic.php

@@ -0,0 +1,172 @@
+<?php
+
+namespace app\admin\logic;
+
+use app\model\CommonModel;
+use app\model\VideoGroupModel;
+use app\model\VideoModel;
+use think\Exception;
+use think\exception\ValidateException;
+use think\facade\Db;
+use think\response\Json;
+
+class VideoGroupItemLogic extends BaseLogic
+{
+
+    //列表
+    public static function list(array $data = []): Json
+    {
+        $db = Db::name('video_group_item')
+            ->alias('a')
+            ->leftJoin('video b', 'b.id=a.video_id AND b.is_del=' . CommonModel::$del_normal)
+            ->where(['a.is_del' => CommonModel::$del_normal, 'video_group_id' => $data['video_group_id']]);
+
+        if ($data['video_title'] != '') $db->whereLike('b.video_name', '%' . $data['video_title'] . '%');
+
+        $count = $db->count('a.id');
+
+        $list = $db->field('a.id,b.video_name,b.remark video_remark,a.is_top')
+            ->page($data['page'], $data['size'])
+            ->order(['a.is_top' => 'desc', 'a.id' => 'desc'])
+            ->select()
+            ->toArray();
+
+        return json_show(CommonModel::$success, '获取视频分组明细列表成功', ['count' => $count, 'list' => $list]);
+    }
+
+    //添加
+    public static function add(array $data = []): Json
+    {
+
+        Db::startTrans();
+
+        try {
+
+            $rs = VideoGroupModel::field('id')
+                ->where(['id' => $data['video_group_id'], 'is_del' => CommonModel::$del_normal])
+                ->findOrEmpty()
+                ->isEmpty();
+            if ($rs) throw new Exception('该视频分组不存在');
+
+            $rs = VideoModel::field('id')
+                ->where(['id' => $data['video_id'], 'is_del' => CommonModel::$del_normal])
+                ->findOrEmpty()
+                ->isEmpty();
+            if ($rs) throw new Exception('该视频不存在');
+
+            $rs = Db::name('video_group_item')
+                ->field('id')
+                ->where([
+                    'is_del' => CommonModel::$del_normal,
+                    'video_group_id' => $data['video_group_id'],
+                    'video_id' => $data['video_id']])
+                ->findOrEmpty();
+            if (!empty($rs)) throw new Exception('该视频已存在,不能在同一视频分组下重复添加');
+
+            $res = Db::name('video_group_item')
+                ->insert(array_merge($data, [
+                    'is_top' => CommonModel::$top_no,
+                    'is_del' => CommonModel::$del_normal,
+                    'addtime' => date('Y-m-d H:i:s'),
+                    'updatetime' => date('Y-m-d H:i:s'),
+                ]));
+
+            Db::name('video_group')
+                ->where(['id' => $data['video_group_id'], 'is_del' => CommonModel::$del_normal])
+                ->inc('num', $res)
+                ->update(['updatetime' => date('Y-m-d H:i:s')]);
+
+            Db::commit();
+
+            return $res ? json_show(CommonModel::$success, '添加视频分组明细成功') : json_show(CommonModel::$success, '添加视频分组明细失败');
+
+        } catch (Exception $exception) {
+            Db::rollback();
+            return json_show(CommonModel::$error_param, '添加视频分组明细失败,' . $exception->getMessage());
+        }
+    }
+
+    //获取详情
+    public static function read(int $id = 0): Json
+    {
+        $res = Db::name('video_group_item')
+            ->field(true)
+            ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
+            ->findOrEmpty();
+
+        if (empty($res)) throw new ValidateException('该视频分组明细为空');
+
+        return json_show(CommonModel::$success, '获取视频分组明细详情成功', $res);
+    }
+
+    //编辑
+    public static function edit(array $data = []): Json
+    {
+        $rs = VideoModel::field('id')
+            ->where(['id' => $data['video_id'], 'is_del' => CommonModel::$del_normal])
+            ->findOrEmpty()
+            ->isEmpty();
+        if ($rs) return json_show(CommonModel::$error_param, '该视频不存在');
+
+        $res = Db::name('video_group_item')
+            ->where(['id' => $data['id'], 'is_del' => CommonModel::$del_normal])
+            ->save(array_merge($data, ['updatetime' => date('Y-m-d H:i:s')]));
+
+        return $res ? json_show(CommonModel::$success, '编辑视频分组明细成功') : json_show(CommonModel::$error_param, '编辑视频分组明细失败');
+
+    }
+
+    //删除
+    public static function delete(array $ids = []): Json
+    {
+        Db::startTrans();
+
+        try {
+
+            $video_group_id = Db::name('video_group_item')
+                ->whereIn('id', $ids)
+                ->where('is_del', CommonModel::$del_normal)
+                ->group('video_group_id')
+                ->column('video_group_id');
+
+            if (count($video_group_id) > 1) throw new Exception('不能删除不同分组下的视频');
+
+            $num = Db::name('video_group_item')
+                ->whereIn('id', $ids)
+                ->where('is_del', CommonModel::$del_normal)
+                ->update([
+                    'is_del' => CommonModel::$del_deleted,
+                    'updatetime' => date('Y-m-d H:i:s'),
+                ]);
+
+            Db::name('video_group')
+                ->where(['id' => $video_group_id[0], 'is_del' => CommonModel::$del_normal])
+                ->dec('num', $num)
+                ->update(['updatetime' => date('Y-m-d H:i:s')]);
+
+            Db::commit();
+
+            return $num ? json_show(CommonModel::$success, '删除成功') : json_show(CommonModel::$error_param, '删除失败,该视频分组明细不存在');
+
+        } catch (Exception $exception) {
+            Db::rollback();
+            return json_show(CommonModel::$error_param, '添加视频分组明细失败,' . $exception->getMessage());
+        }
+    }
+
+    //置顶
+    public static function top(array $data = []): Json
+    {
+        $res = Db::name('video_group_item')
+            ->where('id', $data['id'])
+            ->where('is_top', '<>', $data['is_top'])
+            ->update([
+                'is_top' => $data['is_top'],
+                'updatetime' => date('Y-m-d H:i:s'),
+            ]);
+
+        return $res ? json_show(CommonModel::$success, '操作成功') : json_show(CommonModel::$success, '操作失败,该视频分组明细不存在或重复操作');
+
+    }
+
+}

+ 57 - 128
app/admin/logic/VideoGroupLogic.php

@@ -4,9 +4,7 @@ namespace app\admin\logic;
 
 use app\model\CommonModel;
 use app\model\VideoGroupModel;
-use think\Exception;
 use think\exception\ValidateException;
-use think\facade\Db;
 use think\response\Json;
 
 class VideoGroupLogic extends BaseLogic
@@ -21,8 +19,8 @@ class VideoGroupLogic extends BaseLogic
             ->where('a.is_del', CommonModel::$del_normal);
 
         if ($data['status'] != '') $db->where('a.status', $data['status']);
-        if ($data['company_id'] != '') $db->where('a.company_id', $data['company_id']);
-        if ($data['card_id'] != '') $db->where('a.card_id', $data['card_id']);
+        if ($data['company_title'] != '') $db->whereLike('b.title', '%' . $data['company_title'] . '%');
+        if ($data['card_title'] != '') $db->whereLike('c.title', '%' . $data['card_title'] . '%');
 
         $count = $db->count('a.id');
 
@@ -38,58 +36,31 @@ class VideoGroupLogic extends BaseLogic
     //添加视频分组
     public static function add(array $data = []): Json
     {
-        Db::startTrans();
-        try {
 
-            $rs = VideoGroupModel::field('id')
-                ->where([
-                    'is_del' => CommonModel::$del_normal,
-                    'company_id' => $data['company_id'],
-                    'card_id' => $data['card_id']
-                ])
-                ->findOrEmpty()
-                ->isEmpty();
-            if (!$rs) throw new Exception('该分组已存在');
-
-            $date = date('Y-m-d H:i:s');
-
-            $video_group_id = Db::name('video_group')
-                ->strict(false)
-                ->insertGetId(array_merge($data, [
-                    'num' => count($data['video_list']),
-                    'is_top' => CommonModel::$top_no,
-                    'status' => CommonModel::$status_normal,
-                    'is_del' => CommonModel::$del_normal,
-                    'createrid' => self::$uid,
-                    'creater' => self::$uname,
-                    'addtime' => $date,
-                    'updaterid' => self::$uid,
-                    'updater' => self::$uname,
-                    'updatetime' => $date,
-                ]));
-
-            $da = [];
-            foreach ($data['video_list'] as $item) {
-                $da[] = [
-                    'video_group_id' => $video_group_id,
-                    'video_id' => $item['video_id'],
-                    'is_top' => $item['is_top'],
-                    'is_del' => CommonModel::$del_normal,
-                    'addtime' => $date,
-                    'updatetime' => $date,
-                ];
-            }
-
-            Db::name('video_group_item')->insertAll($da);
-
-            Db::commit();
-
-            return json_show(CommonModel::$success, '添加视频分组成功');
-
-        } catch (Exception $exception) {
-            Db::rollback();
-            return json_show(CommonModel::$error_param, '添加视频分组失败,' . $exception->getMessage());
-        }
+        $rs = VideoGroupModel::field('id')
+            ->where([
+                'is_del' => CommonModel::$del_normal,
+                'company_id' => $data['company_id'],
+                'card_id' => $data['card_id']
+            ])
+            ->findOrEmpty()
+            ->isEmpty();
+        if (!$rs) return json_show(CommonModel::$error_param, '该分组已存在');
+
+        $res = VideoGroupModel::create(array_merge($data, [
+            'num' => 0,
+            'is_top' => CommonModel::$top_no,
+            'status' => CommonModel::$status_normal,
+            'is_del' => CommonModel::$del_normal,
+            'createrid' => self::$uid,
+            'creater' => self::$uname,
+            'addtime' => date('Y-m-d H:i:s'),
+            'updaterid' => self::$uid,
+            'updater' => self::$uname,
+            'updatetime' => date('Y-m-d H:i:s'),
+        ]))->save();
+
+        return $res ? json_show(CommonModel::$success, '添加视频分组成功') : json_show(CommonModel::$success, '添加视频分组失败');
 
     }
 
@@ -103,86 +74,38 @@ class VideoGroupLogic extends BaseLogic
 
         if (empty($res)) throw new ValidateException('该视频分组为空');
 
-        $res['child'] = Db::name('video_group_item')
-            ->alias('a')
-            ->field('a.id,a.video_id,a.is_top,a.is_del,b.video_name,b.remark')
-            ->leftJoin('video b', 'b.id=a.video_id AND b.is_del=' . CommonModel::$del_normal)
-            ->where(['a.is_del' => CommonModel::$del_normal, 'a.video_group_id' => $id])
-            ->order(['a.is_top' => 'desc', 'a.id' => 'desc'])
-            ->select()
-            ->toArray();
-
         return json_show(CommonModel::$success, '获取视频分组详情成功', $res);
     }
 
     //编辑视频分组
     public static function edit(array $data = []): Json
     {
-        Db::startTrans();
-        try {
 
-            $rs = VideoGroupModel::field('id,company_id,card_id')
+        $rs = VideoGroupModel::field('id,company_id,card_id')
+            ->where([
+                'id' => $data['id'],
+                'is_del' => CommonModel::$del_normal,
+            ])
+            ->findOrEmpty();
+        if ($rs->isEmpty()) return json_show(CommonModel::$error_param, '该视频分组不存在');
+
+        if (($rs->company_id != $data['company_id']) || ($rs->card_id != $data['card_id'])) {
+
+            $temp = VideoGroupModel::field('id')
                 ->where([
                     'is_del' => CommonModel::$del_normal,
-                    'id' => $data['id']
+                    'company_id' => $data['company_id'],
+                    'card_id' => $data['card_id']
                 ])
-                ->findOrEmpty();
-            if ($rs->isEmpty()) throw new Exception('该视频分组不存在');
-
-            if (($rs->company_id != $data['company_id']) || ($rs->card_id != $data['card_id'])) {
-
-                $temp = VideoGroupModel::field('id')
-                    ->where([
-                        'is_del' => CommonModel::$del_normal,
-                        'company_id' => $data['company_id'],
-                        'card_id' => $data['card_id']
-                    ])
-                    ->findOrEmpty()
-                    ->isEmpty();
-                if (!$temp) throw new Exception('该分组已存在');
-
-            }
-
-            $date = date('Y-m-d H:i:s');
-
-            VideoGroupModel::where(['id' => $data['id'], 'is_del' => CommonModel::$del_normal])
-                ->strict(false)
-                ->save(array_merge($data, ['updatetime' => $date, 'updaterid' => self::$uid, 'updater' => self::$uid]));
-
-            $del = $ins = [];
-
-            foreach ($data['video_list'] as $item) {
-                if (isset($item['id']) && $item['id'] != 0) {
-                    if ($item['is_del'] == CommonModel::$del_deleted) $del[] = $item['id'];
-                    else Db::name('video_group_item')->where('is_del', CommonModel::$del_normal)->where('id', $item['id'])->save(array_merge($item, ['updatetime' => $date]));
-                } else $ins[] = [
-                    'video_group_id' => $data['id'],
-                    'video_id' => $item['video_id'],
-                    'is_top' => $item['is_top'],
-                    'is_del' => CommonModel::$del_normal,
-                    'addtime' => $date,
-                    'updatetime' => $date,
-                ];
-            }
-
-            if ($del) Db::name('video_group_item')
-                ->whereIn('id', $del)
-                ->where('is_del', CommonModel::$del_normal)
-                ->update([
-                    'is_del' => CommonModel::$del_deleted,
-                    'updatetime' => $date,
-                ]);
-
-            if ($ins) Db::name('video_group_item')->insertAll($ins);
-
-            Db::commit();
+                ->findOrEmpty()
+                ->isEmpty();
+            if (!$temp) return json_show(CommonModel::$error_param, '该视频分组已存在');
+        }
 
-            return json_show(CommonModel::$success, '编辑视频分组成功');
+        $res = VideoGroupModel::where(['id' => $data['id'], 'is_del' => CommonModel::$del_normal])
+            ->save(array_merge($data, ['updatetime' => date('Y-m-d H:i:s'), 'updaterid' => self::$uid, 'updater' => self::$uid]));
 
-        } catch (Exception $exception) {
-            Db::rollback();
-            return json_show(CommonModel::$error_param, '编辑视频分组失败,' . $exception->getMessage());
-        }
+        return $res ? json_show(CommonModel::$success, '编辑视频分组成功') : json_show(CommonModel::$error_param, '编辑视频分组失败');
 
     }
 
@@ -194,23 +117,27 @@ class VideoGroupLogic extends BaseLogic
             ->save([
                 'status' => $data['status'],
                 'updatetime' => date('Y-m-d H:i:s'),
+                'updaterid' => self::$uid,
+                'updater' => self::$uid
             ]);
 
-        return $res ? json_show(CommonModel::$success, '操作成功') : json_show(CommonModel::$success, '操作失败');
+        return $res ? json_show(CommonModel::$success, '操作成功') : json_show(CommonModel::$success, '操作失败,该视频分组不存在或重复操作');
 
     }
 
     //删除视频分组
-    public static function delete(int $id = 0): Json
+    public static function delete(array $ids = []): Json
     {
-        $res = VideoGroupModel::where('id', $id)
+        $res = VideoGroupModel::whereIn('id', $ids)
             ->where('is_del', CommonModel::$del_normal)
             ->save([
                 'is_del' => CommonModel::$del_deleted,
                 'updatetime' => date('Y-m-d H:i:s'),
+                'updaterid' => self::$uid,
+                'updater' => self::$uid
             ]);
 
-        return $res ? json_show(CommonModel::$success, '删除成功') : json_show(CommonModel::$error_param, '删除失败');
+        return $res ? json_show(CommonModel::$success, '删除成功') : json_show(CommonModel::$error_param, '删除失败,该视频分组不存在');
 
     }
 
@@ -222,9 +149,11 @@ class VideoGroupLogic extends BaseLogic
             ->save([
                 'is_top' => $data['is_top'],
                 'updatetime' => date('Y-m-d H:i:s'),
+                'updaterid' => self::$uid,
+                'updater' => self::$uid
             ]);
 
-        return $res ? json_show(CommonModel::$success, '操作成功') : json_show(CommonModel::$success, '操作失败');
+        return $res ? json_show(CommonModel::$success, '操作成功') : json_show(CommonModel::$success, '操作失败,该视频分组不存在或重复操作');
 
     }
 

+ 8 - 0
app/admin/route/app.php

@@ -80,6 +80,13 @@ Route::rule('videoGroupEdit', 'admin/VideoGroup/edit');//编辑视频分组
 Route::rule('videoGroupChange', 'admin/VideoGroup/status');//视频分组启禁用
 Route::rule('videoGroupDelete', 'admin/VideoGroup/delete');//删除视频分组
 Route::rule('videoGroupTop', 'admin/VideoGroup/top');//视频分组置顶
+//【视频分组明细】
+Route::rule('videoGroupItemList', 'admin/VideoGroupItem/list');//列表
+Route::rule('videoGroupItemAdd', 'admin/VideoGroupItem/add');//添加
+Route::rule('videoGroupItemRead', 'admin/VideoGroupItem/read');//获取详情
+Route::rule('videoGroupItemEdit', 'admin/VideoGroupItem/edit');//编辑
+Route::rule('videoGroupItemDelete', 'admin/VideoGroupItem/delete');//删除
+Route::rule('videoGroupItemTop', 'admin/VideoGroupItem/top');//置顶
 
 //【商品】
 Route::rule('goodList', 'admin/Good/list');//获取商品列表
@@ -113,6 +120,7 @@ Route::rule('inventoryShoppingLog', 'admin/InventoryShopping/log');//商城商
 
 //【账户】
 Route::rule('accoountBatchAdd', 'admin/Account/batchAdd');//批量添加账户
+Route::rule('accoountBatchLog', 'admin/Account/batchLog');//获取批量添加账户列表
 Route::rule('accoountAdd', 'admin/Account/add');//添加
 Route::rule('accoountList', 'admin/Account/list');//列表
 Route::rule('accoountRead', 'admin/Account/read');//读取