Pārlūkot izejas kodu

【Add】增加课程客服

liuxiangxin 2 mēneši atpakaļ
vecāks
revīzija
de1353b0db

+ 4 - 4
app/Http/Controllers/Admin/Business.php

@@ -240,7 +240,7 @@ class Business extends Auth{
 		// 查询用户
 		$oldData					= $Model->where(['id'=>$id])->first();
         // 当前用户角色
-        $session				    = session('userRule') ? session('userRule') : ['menu_type'=>0,'company_id'=>0,'business_id'=>0];
+        $session				    = session('userRule') ? session('userRule') : ['menu_type'=>0,'company_id'=>1,'business_id'=>0];
 		// 修改
 		if(request()->isMethod('post')){
 			// 验证参数
@@ -333,9 +333,9 @@ class Business extends Auth{
             }
         }
         $leaderList					= $AdminRule::query()
-            ->join('admin','admin.uid','=','admin_rule.admin_uid')
-            ->where($mp)
-            ->get(['admin.uid','admin.username']);
+                                    ->join('admin','admin.uid','=','admin_rule.admin_uid')
+                                    ->where($mp)
+                                    ->get(['admin.uid','admin.username']);
 		// 分配数据
 		$this->assign('oldData',$oldData);
 		$this->assign('adminInfo',$adminInfo);

+ 2 - 1
app/Http/Controllers/Admin/Login.php

@@ -33,7 +33,8 @@ class Login extends Admin {
             if( md5($code) != $admin['password'] ) return json_send(['code'=>'error','msg'=>'密码错误或账号不存在']);
             $admin                          =   $admin->toArray();
             // 获取数据
-            $adminRule						= $AdminRule::query()->where('admin_uid',$admin['uid'])->first();
+            $adminRule						= $AdminRule->query()->where([['admin_uid','=',$admin['uid']]])->first();
+			$adminRule						= $adminRule ? $adminRule->toArray() : [];
             // 查询用户的组别
             $group							= DB::table('auth_group_access')->where(['user_uid'=>$admin['uid']])->pluck('group_id')->toArray();
             // 权限小组

+ 31 - 18
app/Http/Controllers/Admin/VideoCourse.php

@@ -4,6 +4,9 @@ use App\Facades\Servers\Aliyun\Oss;
 use App\Http\Requests\Admin\Video\Course as Request;
 use App\Models\Video\Course as Model;
 use App\Models\Video\CourseType;
+use App\Models\Video\CourseService;
+
+
 /**
  * 课程管理
  *
@@ -22,45 +25,51 @@ class VideoCourse extends Auth{
 	 * 首页列表
 	 * 
 	 * */
-    public function index(Model $Model,CourseType $CourseType){
+    public function index(Model $Model,CourseType $CourseType,CourseService $CourseService){
 		// 接受参数
-		$name					= request('name','');
-		$status					= request('status');
-		$typeId					= request('type_id',0);
-		$startTime				= request('start_time','');
-		$endTime				= request('end_time','');
+		$name						= request('name','');
+		$status						= request('status');
+		$serviceId					= request('service_id',0);
+		$typeId						= request('type_id',0);
+		$startTime					= request('start_time','');
+		$endTime					= request('end_time','');
 		// 查询条件
-		$map 					= [];
+		$map 						= [];
 		// 编码ID
-		if( $name )				$map[] = ['name','LIKE','%'.$name.'%'];
-		if( $typeId )			$map[] = ['type_id','=',$typeId];
-		if( $startTime )		$map[] = ['insert_time','>=',strtotime($startTime)];
-		if( $endTime )			$map[] = ['insert_time','<=',strtotime($endTime)];
-		if( !is_null($status) )	$map[] = ['status','=',$status];
+		if( $name )					$map[] = ['name','LIKE','%'.$name.'%'];
+		if( $typeId )				$map[] = ['type_id','=',$typeId];
+		if( $serviceId )			$map[] = ['service_id','=',$serviceId];
+		if( $startTime )			$map[] = ['insert_time','>=',strtotime($startTime)];
+		if( $endTime )				$map[] = ['insert_time','<=',strtotime($endTime)];
+		if( !is_null($status) )		$map[] = ['status','=',$status];
 		// 查询数据
-		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
+		$list						= $Model->query()->where($map)->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
 		// 循环处理数据
 		foreach ($list as $key => $value) {
 			// 类型名称
-			$value['type_name'] = $CourseType->getOne($value['type_id'],'name');
+			$value['service_name'] 	= $CourseService->getOne($value['service_id'],'name');
+			// 类型名称
+			$value['type_name'] 	= $CourseType->getOne($value['type_id'],'name');
 			// 重组
-			$list[$key]			= $value;
+			$list[$key]				= $value;
 		}
 		// 获取类型列表
 		$typeList					= $CourseType->getList();
+		$serviceList				= $CourseService->getList();
 		// 分配数据
 		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('serviceList',$serviceList);
 		$this->assign('typeList',$typeList);
 		$this->assign('list', $list);
 		// 加载模板
-		return					$this->fetch();
+		return						$this->fetch();
     }
 
 	/**
 	 * 添加
 	 * 
 	 * */
-	public function add( Request $request, Model $Model,CourseType $CourseType){
+	public function add( Request $request, Model $Model,CourseType $CourseType,CourseService $CourseService){
 		if( request()->isMethod('post') ){
 			// 验证参数
 			$request->scene('add')->validate();
@@ -86,9 +95,11 @@ class VideoCourse extends Auth{
 		}
 		// 获取类型列表
 		$typeList					= $CourseType->getList();
+		$serviceList				= $CourseService->getList();
 		// 分配数据
 		$this->assign('crumbs','新增');
 		$this->assign('typeList',$typeList);
+		$this->assign('serviceList',$serviceList);
 		// 加载模板
 		return 						$this->fetch();
 	}
@@ -97,7 +108,7 @@ class VideoCourse extends Auth{
 	 * 编辑
 	 * 
 	 * */
-	public function edit( Request $request, Model $Model,CourseType $CourseType){
+	public function edit( Request $request, Model $Model,CourseType $CourseType,CourseService $CourseService){
 		// 接收参数
 		$id							= request('id',0);
 		// 查询数据
@@ -132,7 +143,9 @@ class VideoCourse extends Auth{
 		if( !$oldData ) 			return $this->error('查无数据');
 		// 获取类型列表
 		$typeList					= $CourseType->getList();
+		$serviceList				= $CourseService->getList();
 		// 分配数据
+		$this->assign('serviceList',$serviceList);
 		$this->assign('typeList',$typeList);
 		$this->assign('oldData',$oldData);
 		$this->assign('crumbs','修改');

+ 130 - 0
app/Http/Controllers/Admin/VideoCourseService.php

@@ -0,0 +1,130 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Http\Requests\Admin\Video\CourseService as Request;
+use App\Models\Video\CourseService as Model;
+
+/**
+ * 课程管理
+ *
+ * @author    huanglei
+ *
+ */
+class VideoCourseService extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','课程管理');
+		$this->assign('breadcrumb2','课程客服');
+	}
+
+	/**
+	 * 首页列表
+	 * 
+	 * */
+    public function index(Model $Model){
+		
+		// 接受参数
+		$name					= request('name','');
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $name )				$map[] = ['name','LIKE','%'.$name.'%'];
+		// 查询数据
+		$list					= $Model->query()->where($map)->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// 重组
+			$list[$key]				= $value;
+		}
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('list', $list);
+		// 加载模板
+		return					$this->fetch();
+    }
+
+	/**
+	 * 添加
+	 * 
+	 * */
+	public function add( Request $request, Model $Model){
+		if( request()->isMethod('post') ){
+			// 验证参数
+			$request->scene('add')->validate();
+			// 组合数据
+			$data['name']			= request('name','');
+			$data['url']			= request('url','');
+			$data['corpid']			= request('corpid','wwcdbc686326b51a89');
+			// 写入
+			$id						= $Model->add($data);
+			// 提示新增失败
+			if( !$id )				return json_send(['code'=>'error','msg'=>'新增失败']);
+			// 记录行为
+			$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,1,[],$data);
+			// 告知结果
+			return					json_send(['code'=>'success','msg'=>'新增成功','action'=>'add']);
+		}
+		// 分配数据
+		$this->assign('crumbs','新增');
+		// 加载模板
+		return 						$this->fetch();
+	}
+	
+	/**
+	 * 编辑
+	 * 
+	 * */
+	public function edit( Request $request, Model $Model){
+		// 接收参数
+		$id							= request('id',0);
+		// 查询数据
+		$oldData					= $Model->where(['id'=>$id])->first();
+		$oldData					= $oldData ? $oldData->toArray() : [];
+		// 修改
+		if(request()->isMethod('post')){
+			// 验证参数
+			$request->scene('edit')->validate();
+			// 组合数据
+			$data['name']			= request('name','');
+			$data['url']			= request('url','');
+			$data['corpid']			= request('corpid','wwcdbc686326b51a89');
+			// 写入
+			$result					= $Model->edit($id,$data);
+			// 提示新增失败
+			if( !$result )			return json_send(['code'=>'error','msg'=>'修改失败']);
+			// 删除结果
+			unset($oldData['content']);
+			// 记录行为
+			$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,$oldData,$data);
+			// 告知结果
+			return					json_send(['code'=>'success','msg'=>'修改成功','action'=>'edit']);
+		}
+		// 如果是没有数据
+		if( !$oldData ) 			return $this->error('查无数据');
+		// 分配数据
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','修改');
+		// 加载模板
+		return 						$this->fetch();
+	}
+
+	/**
+	 * 状态
+	 * 
+	 * */
+	public function set_status( Request $request, Model $Model){
+		// 验证参数
+		
+		$request->scene('set_status')->validate();
+		// 接收参数
+		$id				= request('id',0);
+		$status			= request('status',0);
+		// 查询数据
+		$result			= $Model->edit($id,['status'=>$status]);
+		// 提示新增失败
+		if( !$result )	return json_send(['code'=>'error','msg'=>'设置失败']);
+		// 告知结果
+		return			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
+	}
+
+}

+ 7 - 2
app/Http/Controllers/Api/Video/Course.php

@@ -9,6 +9,9 @@ use Illuminate\Support\Facades\DB;
 use App\Models\Video\Answer as VideoAnswer;
 use App\Models\Video\Question as VideoQuestion;
 use App\Models\Video\ExamRecord;
+use App\Models\Video\CourseService;
+
+
 /**
  * 课程
  *
@@ -74,7 +77,7 @@ class Course extends Api{
 	 * 课程详情		/api/video_course/get_detail
 	 * 
 	 * */
-    public function get_detail(Model $Model,LearnRecord $LearnRecord,LearnQuestion $LearnQuestion,VideoQuestion $VideoQuestion,VideoAnswer $VideoAnswer){
+    public function get_detail(Model $Model,LearnRecord $LearnRecord,LearnQuestion $LearnQuestion,VideoQuestion $VideoQuestion,VideoAnswer $VideoAnswer,CourseService $CourseService){
 		// 检查登录
 		$uid 							= $this->checkLogin();
 		// 接受参数
@@ -82,7 +85,7 @@ class Course extends Api{
 		// 用户是否点赞
 		if( !$id )						return json_send(['code'=>'error','msg'=>'课程ID不能为空']);
 		// 获取旧数据
-        $courseData            			= $Model->query()->where([['status','=',0]])->find($id,['id','name','thumb','video_src','content','start_time','end_time','insert_time']);
+        $courseData            			= $Model->query()->where([['status','=',0]])->find($id,['id','name','thumb','service','video_src','content','start_time','end_time','insert_time']);
 		// 用户是否点赞
 		if( !$courseData )				return json_send(['code'=>'error','msg'=>'课程不存在或者已下架']);
 		// 转数组
@@ -127,6 +130,8 @@ class Course extends Api{
 		$data['video_inittime']			= $courseData['inittime'];
 		$data['video_lasttime']			= $courseData['inittime'];
 		$data['question_total']			= count($questionList);
+		$data['service']				= $CourseService->getOne($courseData['service']);
+		$data['service']				= $data['service'] ? $data['service'] : (object)[];
 		// 查询是不是有记录在使用中
 		// $oldRecordId			 		= $LearnRecord->query()->where([['custom_uid','=',$uid],['course_id','=',$id],['status','=',0]])->value('id');
 		// 新增记录

+ 56 - 0
app/Http/Requests/Admin/Video/CourseService.php

@@ -0,0 +1,56 @@
+<?php namespace App\Http\Requests\Admin\Video;
+
+use App\Http\Requests\BaseRequest;
+/**
+ * 验证器
+ * 
+ */
+class CourseService extends BaseRequest
+{
+    /**
+     * 获取应用于请求的规则
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        // 编辑时排除ID
+        // 返回结果
+        return      [
+            // 有时候我们希望某个字段在第一次验证失败后就停止运行验证规则,只需要将 bail 添加到规则中:
+            // 验证字段,验证规则,提示信息
+            'id'            => 'required|integer|gt:0',
+            'name'          => 'required|unique:video_course_service,name,'.request('id',0),
+            'url'           => 'required|url',
+            'status'        => 'required|integer|gte:0',
+        ];
+    }
+
+    // 场景列表
+    protected   $scenes         = [
+        'add'                   => ['name','url'],
+        'edit'                  => ['id','name','url'],
+        'set_status'            => ['id','status'],
+	];
+
+    /**
+     * 获取已定义验证规则的错误消息
+     *
+     * @return array
+     */
+    public function messages()
+    {
+        return [
+            'id.required'   		    => 'ID未知',
+            'id.integer'   		        => 'ID格式错误',
+            'id.gt'   		            => 'ID格式错误',
+            'name.required'   		    => '请输入类型名称',
+            'name.unique'   		    => '课程类型已存在',
+            'url.required'   		    => '请输入客服链接',
+            'url.url'   		        => '客服链接格式有误',
+            'status.integer'   		    => '状态格式错误',
+            'status.gte'   		        => '状态格式错误',
+        ];
+    }
+
+}

+ 99 - 0
app/Models/Video/CourseService.php

@@ -0,0 +1,99 @@
+<?php namespace App\Models\Video;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+
+/**
+ * 模型
+ * 
+ */
+class CourseService extends Model
+{
+    use HasFactory;
+
+    // 与模型关联的表名
+    protected $table = 'video_course_service';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function add($data)
+    {
+        // 时间
+        $data['insert_time']				= time();
+        $data['update_time']				= time();
+        // 写入数据表
+        $id						            = $this->query()->insertGetId($data);
+        // 更新缓存
+        $this->getList(true);
+        // 返回结果
+        return                              $id;
+    }
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where(['id'=>$id])->update($data);
+        // 更新缓存
+        $this->getList(true);
+        // 返回结果
+        return                              $result;
+    }
+
+    /**
+     * 获取列表
+     * @param   Bool    $force  是否强制更新
+     * 
+     */
+    public function getList($force = false)
+    {
+        // 结果数据
+        $list                  = $force ? [] : cache('admin:video:course:service:list');
+        // 不存在数据
+        if ( !$list ) {
+            // 从数据库获取数据
+            $data              = $this->query()->where([['status','=',0]])->get(['id','name','corpid','url','status'])->toArray();
+            // 循环处理数据
+            $list              = [];
+            // 进行更新
+            foreach ($data as $value) {
+                // 重组数据
+                $list[$value['id']] = $value;
+            }
+            // 存起来
+            cache(['admin:video:course:service:list'=>$list]);
+        }
+        // 返回结果
+        return                  $list;
+    }
+
+    /**
+     * 获取配置平台对应的应用数据
+     * 
+     * @param   Array      用户ID
+     * @param   String     指定字段
+     * 
+     */
+    public function getOne($id,$field='')
+    {
+        // 获取列表数据
+        $list                   = $this->getList();
+        // 获取数据
+        $one                    = isset($list[$id]) ? $list[$id] : [];
+        // 返回值
+        return                  empty($field) ? $one : ( isset($one[$field]) ? $one[$field] : null);
+    }
+
+}

+ 10 - 2
resources/views/admin/video_course/add.blade.php

@@ -22,7 +22,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<input type="hidden" name="video_src" value=""  />
 		</div>
 	</div>
-	<div class="form-group col-sm-2">
+	<div class="form-group col-sm-4">
 		<label class="control-label">课程名称</label>
 		<input class="form-control" required="required" type="text" placeholder="课程名称" maxlength="40" name="name" value="" />
 	</div>
@@ -35,10 +35,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		</select>
 	</div>
 	<div class="form-group col-sm-2">
+		<label class="control-label">课程客服</label>
+		<select class="form-control" name="service_id" >
+			@foreach ($serviceList as $value)
+				<option value="{{$value['id']}}"  >{{$value['name']}}</option>
+			@endforeach
+		</select>
+	</div>
+	<div class="form-group col-sm-4">
 		<label class="control-label">开始时间</label>
 		<input class="form-control" required="required" type="datetime-local" placeholder="开始时间"  name="start_time" value="" />
 	</div>
-	<div class="form-group col-sm-2">
+	<div class="form-group col-sm-4">
 		<label class="control-label">结束时间</label>
 		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
 	</div>

+ 11 - 3
resources/views/admin/video_course/edit.blade.php

@@ -17,12 +17,12 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<label class="control-label">课程视频 [720P]</label>
 		<div id="video_src">
 			<a id="video_upload" href="javascript:;" class="img-thumb" >
-				<video src="{{$oldData['video_src']}}" height="100" width="100" ></video>
+				<video src="{{$oldData['video_src']}}" poster="{{$oldData['video_src'] ? path_compat($oldData['thumb']) : path_compat('')}}" height="100" width="100" ></video>
 			</a>
 			<input type="hidden" name="video_src" value="{{$oldData['video_src']}}"  />
 		</div>
 	</div>
-	<div class="form-group col-sm-2">
+	<div class="form-group col-sm-4">
 		<label class="control-label">课程名称</label>
 		<input class="form-control" required="required" type="text" placeholder="课程名称" maxlength="40" name="name" value="{{$oldData['name']}}" />
 	</div>
@@ -35,10 +35,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		</select>
 	</div>
 	<div class="form-group col-sm-2">
+		<label class="control-label">课程客服</label>
+		<select class="form-control" name="service_id" >
+			@foreach ($serviceList as $value)
+				<option value="{{$value['id']}}" @if( $value['id'] == $oldData['service_id'])  selected @endif >{{$value['name']}}</option>
+			@endforeach
+		</select>
+	</div>
+	<div class="form-group col-sm-4">
 		<label class="control-label">开始时间</label>
 		<input class="form-control" required="required" type="datetime-local" placeholder="开始时间"  name="start_time" value="{{date('Y-m-d H:i',$oldData['start_time'])}}" />
 	</div>
-	<div class="form-group col-sm-2">
+	<div class="form-group col-sm-4">
 		<label class="control-label">结束时间</label>
 		<input class="form-control" required="required" type="datetime-local" placeholder="结束时间" name="end_time" value="{{date('Y-m-d H:i',$oldData['end_time'])}}" />
 	</div>

+ 10 - 0
resources/views/admin/video_course/index.blade.php

@@ -20,6 +20,14 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			@endforeach
 		</select>
 	</div>
+	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
+		<select class="form-control" name="service_id" >
+			<option value="0" >课程客服</option>
+			@foreach ($serviceList as $value)
+				<option value="{{$value['id']}}" @if( $value['id'] == request('service_id','') )  selected @endif >{{$value['name']}}</option>
+			@endforeach
+		</select>
+	</div>
 	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
 		<select class="form-control" name="status" >
 			<option value="" >课程状态</option>
@@ -50,6 +58,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>课程有效期</th>
 						<th>课程状态</th>
 						<th>课程类型</th>
+						<th>课程客服</th>
 						<th>修改时间</th>
 						<th>操作</th>
 					</tr>
@@ -79,6 +88,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						</td>
 						<td> @if ($a['status'] == 0) 启用 @endif @if ($a['status'] == 1) 停用 @endif</td>
 						<td> {{$a['type_name']}}</td>
+						<td> {{$a['service_name']}}</td>
 						<td> {{date('Y/m/d H:i',$a['update_time'])}}</td>
 						<td>
 							@if( check_auth('admin/video_course/edit') )

+ 20 - 0
resources/views/admin/video_course_service/add.blade.php

@@ -0,0 +1,20 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-4">
+		<label class="control-label">客服名称</label>
+		<input class="form-control" required="required" type="text" placeholder="客服名称" maxlength="10" name="name" value="" />
+	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">客服链接</label>
+		<input class="form-control" required="required" type="url" placeholder="客服链接" maxlength="120" name="url" value="" />
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection

+ 21 - 0
resources/views/admin/video_course_service/edit.blade.php

@@ -0,0 +1,21 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;" 
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-4">
+		<label class="control-label">客服名称</label>
+		<input class="form-control" required="required" type="text" placeholder="客服名称" maxlength="10" name="name" value="{{$oldData['name']}}" />
+	</div>
+	<div class="form-group col-sm-4">
+		<label class="control-label">客服链接</label>
+		<input class="form-control" required="required" type="url" placeholder="客服链接" maxlength="120" name="url" value="{{$oldData['url']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input type="hidden" name="id" value="{{$oldData['id']}}" />
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection

+ 71 - 0
resources/views/admin/video_course_service/index.blade.php

@@ -0,0 +1,71 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<div class="page-header">
+	@if( check_auth('admin/video_course_service/add') )
+	<a href="{{url('admin/video_course_service/add')}}" class="btn btn-primary">新增</a>
+	@endif
+</div>
+<form action="" method="get" class="form-horizontal form-line">
+	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入客服名称查询" />
+	</div>
+	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
+	<a href="{{url('admin/video_course_service/index')}}" class="btn btn-sm btn-default" >重置</a>
+	@csrf
+</form>
+<div class="row">
+	<div class="col-xs-12">
+		<div class="table-responsive">
+			<table class="table table-striped table-bordered table-hover">
+				<thead>
+					<tr>
+						<th>ID</th>
+						<th>客服名称</th>
+						<th>客服状态</th>
+						<th>修改时间</th>
+						<th>操作</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach ($list as $a)
+					<tr>
+						<td> {{$a['id']}}</td>
+						<td> {{$a['name']}}</td>
+						<td> @if ($a['status'] == 0) 启用 @endif @if ($a['status'] == 1) 停用 @endif</td>
+						<td> {{date('Y/m/d H:i',$a['update_time'])}}</td>
+						<td>
+							@if( check_auth('admin/video_course_service/edit') )
+							<a class="btn btn-sm btn-warning" href="{{url('admin/video_course_service/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
+								修改
+							</a>
+							@endif
+							@if( check_auth('admin/video_course_service/set_status') )
+								@if ( $a['status'] )
+									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/video_course_service/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
+										启用
+									</a>
+								@else
+									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/video_course_service/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
+										停用
+									</a>
+								@endif
+							@endif
+						</td>
+					</tr>
+					@endforeach
+					<tr>
+						<td colspan="20" class="page">{{$list->render()}}</td>
+					</tr>
+					<tr>
+						<td colspan="20">总计 {{$list->total()}} 个客服</td>
+					</tr>
+				</tbody>
+
+			</table>
+		</div>
+	</div>
+</div>
+@endsection

+ 11 - 0
routes/web.php

@@ -664,6 +664,17 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     Route::any('video_course_type/edit',[App\Http\Controllers\Admin\VideoCourseType::class,'edit']);
     // 状态
     Route::any('video_course_type/set_status',[App\Http\Controllers\Admin\VideoCourseType::class,'set_status']);
+    
+    
+    /* 视频课程客服管理 */
+    // 文章
+    Route::any('video_course_service/index',[App\Http\Controllers\Admin\VideoCourseService::class,'index']);
+    // 新增
+    Route::any('video_course_service/add',[App\Http\Controllers\Admin\VideoCourseService::class,'add']);
+    // 编辑
+    Route::any('video_course_service/edit',[App\Http\Controllers\Admin\VideoCourseService::class,'edit']);
+    // 状态
+    Route::any('video_course_service/set_status',[App\Http\Controllers\Admin\VideoCourseService::class,'set_status']);
 
     /* 视频课程管理 */
     // 文章