wesmiler vor 5 Monaten
Ursprung
Commit
284486ef74
33 geänderte Dateien mit 770 neuen und 7 gelöschten Zeilen
  1. 73 0
      app/Http/Controllers/Admin/InstitutionController.php
  2. 55 0
      app/Models/InstitutionModel.php
  3. 8 2
      app/Services/Api/MemberService.php
  4. 12 0
      app/Services/Common/ActionLogService.php
  5. 13 0
      app/Services/Common/AdService.php
  6. 13 0
      app/Services/Common/AnswerRanksService.php
  7. 12 0
      app/Services/Common/ArticleService.php
  8. 13 0
      app/Services/Common/CityService.php
  9. 12 0
      app/Services/Common/ComplaintService.php
  10. 13 0
      app/Services/Common/ConfigGroupService.php
  11. 13 0
      app/Services/Common/ConfigService.php
  12. 13 0
      app/Services/Common/DepositService.php
  13. 13 0
      app/Services/Common/ExamAccessLogsService.php
  14. 13 0
      app/Services/Common/GoodsService.php
  15. 227 0
      app/Services/Common/InstitutionService.php
  16. 12 0
      app/Services/Common/LoginService.php
  17. 13 0
      app/Services/Common/MenuService.php
  18. 12 0
      app/Services/Common/MessageService.php
  19. 4 0
      app/Services/Common/NoticeService.php
  20. 13 0
      app/Services/Common/RoleMenuService.php
  21. 13 0
      app/Services/Common/RoleService.php
  22. 13 0
      app/Services/Common/UploadService.php
  23. 13 0
      app/Services/Common/UserRoleService.php
  24. 13 0
      app/Services/Common/UserService.php
  25. 12 0
      app/Services/Common/VideoCategoryService.php
  26. 49 0
      app/Services/Common/VideoService.php
  27. 13 0
      app/Services/Common/VideosCoursesService.php
  28. 13 0
      app/Services/Common/VipService.php
  29. 14 1
      app/Services/Exam/PaperService.php
  30. 13 0
      app/Services/Exam/SubjectService.php
  31. 13 0
      app/Services/Exam/TopicService.php
  32. 23 3
      app/Services/PaymentService.php
  33. 11 1
      routes/web.php

+ 73 - 0
app/Http/Controllers/Admin/InstitutionController.php

@@ -0,0 +1,73 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\InstitutionService;
+
+/**
+ * 院校管理-控制器
+ * @author laravel开发员
+ * @since 2024/01/08
+ * Class InstitutionController
+ * @package App\Http\Controllers\Admin
+ */
+class InstitutionController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2024/01/08
+     * InstitutionController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new InstitutionService();
+    }
+
+    /**
+     * 列表
+     * @return array
+     */
+    public function index()
+    {
+        $pageSize = request()->get('limit', 10);
+        $list = $this->service->getDataList(request()->all(), $pageSize);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "data" => isset($list['list']) ? $list['list'] : [],
+            "count" => isset($list['total']) ? $list['total'] : 0,
+        );
+        return $message;
+    }
+
+    /**
+     * 选项列表
+     * @return mixed
+     */
+    public function options()
+    {
+        $result = $this->service->options();
+        return message(1002, true, $result);
+    }
+
+    /**
+     * 设置排序
+     * @return mixed
+     */
+    public function sort()
+    {
+        $result = $this->service->sort();
+        return $result;
+    }
+}

+ 55 - 0
app/Models/InstitutionModel.php

@@ -0,0 +1,55 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 院校-模型
+ * @author laravel开发员
+ * @since 2024/01/08
+ * @package App\Models
+ */
+class InstitutionModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'institutions';
+
+    /**
+     * 格式化信息
+     * @param array $info 实体数据对象
+     * @return array 返回实体对象
+     * @author laravel开发员
+     * @date 2024/01/08
+     */
+    public function formatInfo($info)
+    {
+        // 格式化链接类型
+        if (isset($info['link_type'])) {
+            $linkTypeMap = [
+                1 => 'Web链接',
+                2 => '小程序链接'
+            ];
+            $info['link_type_text'] = isset($linkTypeMap[$info['link_type']]) ? $linkTypeMap[$info['link_type']] : '未知类型';
+        }
+
+        // 格式化状态
+        if (isset($info['status'])) {
+            $info['status_text'] = $info['status'] == 1 ? '正常' : '不显示';
+        }
+
+        return $info;
+    }
+
+    public function getThumbAttribute($value)
+    {
+
+    }
+}

+ 8 - 2
app/Services/Api/MemberService.php

@@ -368,9 +368,12 @@ class MemberService extends BaseService
             $info['is_zsb_vip'] = $isZsbVip;
             $info['vip_expired'] = $vipExpired;
             $info['zg_vip_expired'] = $zgVipExpired;
+            $info['zg_vip_day'] = max(0, intval((strtotime($zgVipExpired) - time())/86400));
             $info['zsb_vip_expired'] = $zsbVipExpired;
+            $info['zsb_vip_day'] = max(0, intval((strtotime($zsbVipExpired) - time())/86400));
             $info['is_video_vip'] = $isVideoVip;
             $info['video_vip_expired'] = $videoVipExpired;
+            $info['video_vip_day'] = max(0, intval((strtotime($videoVipExpired) - time())/86400));
             RedisService::set($cacheKey, $info, rand(5, 10));
         }
 
@@ -693,6 +696,7 @@ class MemberService extends BaseService
 
         // 创建订单
         $orderNo = get_order_num('VP');
+        $remark = $vipType==3? "购买{$vipName}" : "购买{$vipName}VIP";
         $order = [
             'order_no'=> $orderNo,
             'user_id'=> $userId,
@@ -700,7 +704,7 @@ class MemberService extends BaseService
             'total'=> $price,
             'expired_at'=> date('Y-m-d H:i:s', $expiredTime + $day * 86400),
             'create_time'=> time(),
-            'remark'=> $vipType==3? "购买{$vipName}" : "购买{$vipName}VIP",
+            'remark'=> $remark,
             'status'=>1,
             'mark'=>1
         ];
@@ -717,7 +721,7 @@ class MemberService extends BaseService
             'type'=> 1,
             'order_no'=> $orderNo,
             'pay_money'=> $price,
-            'body'=> "购买{$vipName}VIP",
+            'body'=> $remark,
             'openid'=> $openid
         ];
 
@@ -734,6 +738,8 @@ class MemberService extends BaseService
         DB::commit();
         $this->error = '创建VIP订单成功,请前往支付~';
         RedisService::clear($cacheKey.'_lock');
+        RedisService::keyDel("caches:videos:list_by_group*");
+        RedisService::clear("caches:videos:info_{$userId}_{$cId}");
         return [
             'order_id'=> $orderId,
             'payment'=> $payment,

+ 12 - 0
app/Services/Common/ActionLogService.php

@@ -62,4 +62,16 @@ class ActionLogService extends BaseService
         }
         return message("操作成功", true, $list);
     }
+
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除操作日志信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 }

+ 13 - 0
app/Services/Common/AdService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\AdModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use App\Services\RedisService;
 
@@ -87,4 +88,16 @@ class AdService extends BaseService
         return parent::edit($data); // TODO: Change the autogenerated stub
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除广告信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/AnswerRanksService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\UserModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use App\Services\ConfigService;
 use Illuminate\Support\Facades\DB;
@@ -151,4 +152,16 @@ class AnswerRanksService extends BaseService
             'limit' => $limit,
         ];
     }
+
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除答题排行信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 }

+ 12 - 0
app/Services/Common/ArticleService.php

@@ -146,4 +146,16 @@ class ArticleService extends BaseService
         }
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除文章信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/CityService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\CityModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -69,4 +70,16 @@ class CityService extends BaseService
         return message("操作成功", true, $list);
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除城市信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 12 - 0
app/Services/Common/ComplaintService.php

@@ -98,4 +98,16 @@ class ComplaintService extends BaseService
 
         return parent::edit($data);
     }
+
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除投诉建议信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 }

+ 13 - 0
app/Services/Common/ConfigGroupService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\ConfigGroupModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -38,4 +39,16 @@ class ConfigGroupService extends BaseService
     {
         return parent::getList([],[['sort','desc']]); // TODO: Change the autogenerated stub
     }
+
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除配置分组信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 }

+ 13 - 0
app/Services/Common/ConfigService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\ConfigModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -85,4 +86,16 @@ class ConfigService extends BaseService
         return parent::edit($data); // TODO: Change the autogenerated stub
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除配置信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/DepositService.php

@@ -15,6 +15,7 @@ use App\Models\AccountLogModel;
 use App\Models\DepositModel;
 use App\Models\MemberModel;
 use App\Models\MessageModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use App\Services\ConfigService;
 use App\Services\PaymentService;
@@ -357,4 +358,16 @@ class DepositService extends BaseService
         return $data;
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除充值记录信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/ExamAccessLogsService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\UserModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use App\Services\ConfigService;
 use Illuminate\Support\Facades\DB;
@@ -113,4 +114,16 @@ class ExamAccessLogsService extends BaseService
         ];
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除考试访问日志信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/GoodsService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\GoodsModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use App\Services\RedisService;
 use wxkxklmyt\Scws;
@@ -243,4 +244,16 @@ class GoodsService extends BaseService
 
         return $data;
     }
+
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除商品信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 }

+ 227 - 0
app/Services/Common/InstitutionService.php

@@ -0,0 +1,227 @@
+<?php
+
+namespace App\Services\Common;
+
+use App\Models\InstitutionModel;
+use App\Models\ActionLogModel;
+use App\Services\BaseService;
+
+/**
+ * InstitutionService 服务类
+ * @author laravel开发员
+ * @since 2024/01/08
+ * Class InstitutionService
+ * @package App\Services\Common
+ */
+class InstitutionService extends BaseService
+{
+    public static $instance = null;
+
+    /**
+     * 构造函数
+     * @since 2024/01/08
+     */
+    public function __construct()
+    {
+        $this->model = new InstitutionModel();
+    }
+
+    /**
+     * 静态入口
+     * @return static|null
+     */
+    public static function make()
+    {
+        if (!self::$instance) {
+            self::$instance = (new static());
+        }
+        return self::$instance;
+    }
+
+    /**
+     * 获取院校列表
+     * @param $params
+     * @param int $pageSize
+     * @return array
+     */
+    public function getDataList($params, $pageSize = 15)
+    {
+        $query = $this->getQuery($params);
+
+        $model = clone $query;
+        $counts = [
+            'count' => $model->count('id'),
+        ];
+
+        $list = $query->select(['*'])
+            ->orderBy('sort', 'desc')
+            ->orderBy('id', 'desc')
+            ->paginate($pageSize > 0 ? $pageSize : 9999999);
+        $list = $list ? $list->toArray() : [];
+
+        if ($list) {
+            foreach ($list['data'] as &$item) {
+                // 格式化时间
+                $item['create_time'] = $item['create_time'] ? datetime($item['create_time'], 'Y-m-d H:i:s') : '';
+                $item['update_time'] = $item['update_time'] ? datetime($item['update_time'], 'Y-m-d H:i:s') : '';
+                // 格式化状态
+                $item['status_text'] = $item['status'] == 1 ? '正常' : '不显示';
+                // 格式化链接类型
+                $item['link_type_text'] = $item['link_type'] == 1 ? 'Web链接' : '小程序链接';
+            }
+        }
+
+        return [
+            'pageSize' => $pageSize,
+            'total' => isset($list['total']) ? $list['total'] : 0,
+            'counts' => $counts,
+            'list' => isset($list['data']) ? $list['data'] : []
+        ];
+    }
+
+    /**
+     * 查询院校
+     * @param $params
+     * @return \Illuminate\Database\Eloquent\Builder
+     */
+    public function getQuery($params)
+    {
+        $where = ['mark' => 1];
+        $status = isset($params['status']) ? $params['status'] : 0;
+        $linkType = isset($params['link_type']) ? $params['link_type'] : 0;
+
+        if ($status > 0) {
+            $where['status'] = $status;
+        }
+        if ($linkType > 0) {
+            $where['link_type'] = $linkType;
+        }
+
+        return $this->model->where($where)
+            ->where(function ($query) use ($params) {
+                $keyword = isset($params['keyword']) ? $params['keyword'] : '';
+                if ($keyword) {
+                    $query->where(function ($q) use ($keyword) {
+                        $q->where('name', 'like', "%{$keyword}%")
+                            ->orWhere('code', 'like', "%{$keyword}%");
+                    });
+                }
+
+                // 处理日期区间
+                $date = isset($params['date']) ? $params['date'] : [];
+                $start = isset($date[0]) ? $date[0] : '';
+                $end = isset($date[1]) ? $date[1] : '';
+                if ($start) {
+                    $query->where('create_time', '>=', strtotime($start));
+                }
+                if ($end) {
+                    $query->where('create_time', '<=', strtotime($end));
+                }
+            });
+    }
+
+    /**
+     * 添加或编辑院校
+     * @return array
+     */
+    public function edit()
+    {
+        $data = request()->all();
+
+        // 验证必填字段
+        if (empty($data['name'])) {
+            return message('院校名称不能为空', false);
+        }
+        if (empty($data['code'])) {
+            return message('院校代码不能为空', false);
+        }
+
+        // 检查院校代码是否重复
+        $existId = $this->checkExists('code', $data['code'], 'id', 0);
+        if ($existId && $existId != ($data['id'] ?? 0)) {
+            return message('院校代码已存在', false);
+        }
+
+        // 确保所有必填字段都存在
+        $data = [
+            'name' => $data['name'] ?? '',
+            'code' => $data['code'] ?? '',
+            'thumb' => $data['thumb'] ?? '',
+            'link_url' => $data['link_url'] ?? '',
+            'link_type' => $data['link_type'] ?? 1,
+            'description' => $data['description'] ?? '',
+            'sort' => $data['sort'] ?? 0,
+            'status' => $data['status'] ?? 1,
+        ];
+
+        return parent::edit($data);
+    }
+
+    /**
+     * 删除院校
+     * @return array
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除院校信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+
+        // 删除七天之前标记软删除的数据
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
+    /**
+     * 院校选项
+     * @return array
+     */
+    public function options()
+    {
+        // 获取参数
+        $param = request()->all();
+        // 关键词
+        $keyword = getter($param, "keyword");
+        $datas = $this->model
+            ->where(function ($query) {
+                $query->where(['status' => 1, 'mark' => 1]);
+            })
+            ->where(function ($query) use ($keyword) {
+                if ($keyword) {
+                    $query->where('name', 'like', "%{$keyword}%");
+                }
+            })
+            ->select(['id', 'name', 'code'])
+            ->orderBy('sort', 'desc')
+            ->orderBy('id', 'desc')
+            ->get();
+
+        return $datas ? $datas->toArray() : [];
+    }
+
+    /**
+     * 设置排序
+     * @return array
+     */
+    public function sort()
+    {
+        $data = request()->all();
+        if (!$data['id']) {
+            return message('记录ID不能为空', false);
+        }
+        if (!isset($data['sort'])) {
+            return message('排序值不能为空', false);
+        }
+
+        $error = '';
+        $item = [
+            'id' => $data['id'],
+            'sort' => $data['sort']
+        ];
+        $rowId = $this->model->edit($item, $error);
+        if (!$rowId) {
+            return message($error, false);
+        }
+        return message();
+    }
+}

+ 12 - 0
app/Services/Common/LoginService.php

@@ -174,4 +174,16 @@ class LoginService extends BaseService
         return message();
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除登录记录信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/MenuService.php

@@ -13,6 +13,7 @@ namespace App\Services\Common;
 
 
 use App\Models\MenuModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -301,4 +302,16 @@ class MenuService extends BaseService
         return array_filter(array_values($list));
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除菜单信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 12 - 0
app/Services/Common/MessageService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\MessageModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use App\Services\RedisService;
 
@@ -278,5 +279,16 @@ class MessageService extends BaseService
         return $result;
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除消息信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 
 }

+ 4 - 0
app/Services/Common/NoticeService.php

@@ -14,6 +14,7 @@ namespace App\Services\Common;
 use App\Models\NoticeModel;
 use App\Services\BaseService;
 use App\Services\RedisService;
+use App\Models\ActionLogModel;
 
 /**
  * 通知公告-服务类
@@ -153,6 +154,9 @@ class NoticeService extends BaseService
 
     public function delete()
     {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除通知公告信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
         RedisService::clear("caches:index:notices");
         return parent::delete(); // TODO: Change the autogenerated stub
     }

+ 13 - 0
app/Services/Common/RoleMenuService.php

@@ -11,6 +11,7 @@
 
 namespace App\Services\Common;
 
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -23,4 +24,16 @@ use App\Services\BaseService;
 class RoleMenuService extends BaseService
 {
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除角色菜单关系信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/RoleService.php

@@ -14,6 +14,7 @@ namespace App\Services\Common;
 use App\Models\MenuModel;
 use App\Models\RoleMenuModel;
 use App\Models\RoleModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -126,4 +127,16 @@ class RoleService extends BaseService
         return message();
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除角色信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/UploadService.php

@@ -11,6 +11,7 @@
 
 namespace App\Services\Common;
 
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use Illuminate\Support\Facades\File;
 
@@ -55,4 +56,16 @@ class UploadService extends BaseService
         $rowId = $this->model->edit($data, $error, false);
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除上传文件信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/UserRoleService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\UserRoleModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -89,4 +90,16 @@ class UserRoleService extends BaseService
         }
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除用户角色关系信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Common/UserService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\UserModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use App\Services\ConfigService;
 
@@ -252,4 +253,16 @@ class UserService extends BaseService
         return message("重置密码成功");
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除用户信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 12 - 0
app/Services/Common/VideoCategoryService.php

@@ -12,6 +12,7 @@
 namespace App\Services\Common;
 
 use App\Models\VideoCategoryModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use Illuminate\Support\Facades\DB;
 
@@ -133,5 +134,16 @@ class VideoCategoryService extends BaseService
         return $datas ? $datas->toArray() : [];
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除视频分类信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 
 }

+ 49 - 0
app/Services/Common/VideoService.php

@@ -2,6 +2,7 @@
 namespace App\Services\Common;
 
 use App\Models\VideoModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use App\Services\RedisService;
 use Illuminate\Support\Facades\DB;
@@ -151,4 +152,52 @@ class VideoService extends BaseService
 
         return $datas ? $datas->toArray() : [];
     }
+<<<<<<< HEAD
+=======
+
+    /**
+     * 获取
+     * @param $type
+     * @param int $num
+     * @return array|mixed
+     */
+    public function getListByType($type, $num = 0)
+    {
+        $num = $num? $num : \App\Services\ConfigService::make()->getConfigByCode('show_course_num', 4);
+        $cacheKey = "caches:videos:type_list_{$type}_{$num}";
+        $datas = RedisService::get($cacheKey);
+        if($datas){
+            return $datas;
+        }
+
+        $datas = $this->model->where(['type'=>$type,'status'=>1,'mark'=>1])
+                ->select(['id','video_name','poster','type','description','is_recommend','status'])
+                ->orderBy('is_recommend','asc')
+                ->orderBy('create_time','desc')
+                ->limit($num)
+                ->get();
+        $datas = $datas? $datas->toArray() : [];
+        if($datas){
+            foreach ($datas as &$item){
+                $item['poster'] = $item['poster'] ? get_image_url($item['poster']) : '';
+            }
+
+            RedisService::set($cacheKey, $datas, rand(3600, 7200));
+        }
+
+        return $datas;
+    }
+
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除视频信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+>>>>>>> 9fe3ebdb5f6152e2be13b11c08901349803b4db7
 }

+ 13 - 0
app/Services/Common/VideosCoursesService.php

@@ -3,6 +3,7 @@ namespace App\Services\Common;
 
 use App\Models\VideoCoursesModel;
 use App\Models\VideosCoursesModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use Illuminate\Support\Facades\DB;
 
@@ -157,4 +158,16 @@ class VideosCoursesService extends BaseService
         $info['poster'] = $info['poster'] ? get_image_url($info['poster']) : '';
         return message(MESSAGE_OK, true, $info);
     }
+
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除视频课程信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 }

+ 13 - 0
app/Services/Common/VipService.php

@@ -2,6 +2,7 @@
 namespace App\Services\Common;
 
 use App\Models\VipModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -243,4 +244,16 @@ class VipService extends BaseService
         }
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除VIP套餐信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 14 - 1
app/Services/Exam/PaperService.php

@@ -3,6 +3,7 @@ namespace App\Services\Exam;
 
 use App\Models\ExamPaperModel;
 use App\Models\ExamTopicModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use Illuminate\Support\Facades\DB;
 
@@ -30,7 +31,7 @@ class PaperService extends BaseService
 
     public function customList($params, $pageSize = 15)
     {
-        $query = $this->model->where('mark', operator: 1);
+        $query = $this->model->where('mark',  1);
 
         if (!empty($params['scene_type'])) {
             $query->where('scene_type', $params['scene_type']);
@@ -116,4 +117,16 @@ class PaperService extends BaseService
         }
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除试卷信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 13 - 0
app/Services/Exam/SubjectService.php

@@ -2,6 +2,7 @@
 namespace App\Services\Exam;
 
 use App\Models\ExamSubjectsModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 
 /**
@@ -116,4 +117,16 @@ class SubjectService extends BaseService
 
         return $datas ? $datas->toArray() : [];
     }
+
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除科目信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
 }

+ 13 - 0
app/Services/Exam/TopicService.php

@@ -2,6 +2,7 @@
 namespace App\Services\Exam;
 
 use App\Models\ExamTopicModel;
+use App\Models\ActionLogModel;
 use App\Services\BaseService;
 use Illuminate\Support\Facades\DB;
 
@@ -171,4 +172,16 @@ class TopicService extends BaseService
         return parent::edit($data); // 调用父类的 edit 方法
     }
 
+    /**
+     * 删除七天之前标记软删除的数据
+     */
+    public function delete()
+    {
+        // 设置日志标题
+        ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除题目信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
+        ActionLogModel::record();
+        $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
+        return parent::delete();
+    }
+
 }

+ 23 - 3
app/Services/PaymentService.php

@@ -467,6 +467,7 @@ class PaymentService extends BaseService
             }
 
             /* TODO 订单验证和状态处理 */
+            $orderInfo = [];
             // VIP购买
             if ($scene == 'vip') {
                 $orderInfo = OrderModel::with(['vip'])->where(['order_no' => $orderNo, 'mark' => 1])
@@ -603,10 +604,29 @@ class PaymentService extends BaseService
                     }
 
                     break;
+                case 'course':
+                    $price = isset($orderInfo['pay_money']) ? $orderInfo['pay_money'] : 0;
+                    $remark = isset($orderInfo['remark']) && $orderInfo['remark'] ? $orderInfo['remark'] : '购买VIP会员';
+                    // 账单记录
+                    $log = [
+                        'user_id' => $orderUserId,
+                        'source_order_no' => $orderNo,
+                        'type' => 2,
+                        'money' => $price,
+                        'date' => date('Y-m-d H:i:s'),
+                        'create_time' => time(),
+                        'remark' => $remark,
+                        'status' => 1,
+                        'mark' => 1
+                    ];
+                    RedisService::set("caches:payments:notify_{$scene}:catch_{$orderNo}_{$orderUserId}_log", ['order' => $orderInfo, 'log' => $log, 'notify' => $data], 600);
+                    if (!AccountLogModel::insertGetId($log)) {
+                        $this->error = 2635;
+                        return false;
+                    }
+                    break;
                 default:
-                    DB::rollBack();
-                    $this->error = 2631;
-                    return false;
+                    break;
             }
 
             $this->error = 2638;

+ 11 - 1
routes/web.php

@@ -33,6 +33,7 @@ use App\Http\Controllers\Admin\VideoCategoryController;
 use App\Http\Controllers\Admin\VideoCoursesController;
 use App\Http\Controllers\Admin\ComplaintController;
 use App\Http\Controllers\Admin\VipController;
+use App\Http\Controllers\Admin\InstitutionController;
 
 /*
 |--------------------------------------------------------------------------
@@ -275,4 +276,13 @@ Route::post('/vips/delete', [VipController::class, 'delete']);
 Route::post('/vips/status', [VipController::class, 'status']);
 Route::post('/vips/sort', [VipController::class, 'sort']);
 Route::post('/vips/options', [VipController::class, 'options']);
-Route::post('/vips/batchSet', [VipController::class, 'batchSet']);
+Route::post('/vips/batchSet', [VipController::class, 'batchSet']);
+
+// 院校管理
+Route::get('/institutions/index', [InstitutionController::class, 'index']);
+Route::get('/institutions/info', [InstitutionController::class, 'info']);
+Route::post('/institutions/edit', [InstitutionController::class, 'edit']);
+Route::post('/institutions/delete', [InstitutionController::class, 'delete']);
+Route::post('/institutions/status', [InstitutionController::class, 'status']);
+Route::post('/institutions/sort', [InstitutionController::class, 'sort']);
+Route::get('/institutions/options', [InstitutionController::class, 'options']);