|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
|
|
|
|
|
|
|
|
use App\Exports\BaseExport;
|
|
|
|
|
|
use App\Helpers\ResponseCode;
|
|
|
|
|
|
use App\Models\AppointmentType;
|
|
|
|
|
|
use App\Models\Book;
|
|
|
|
|
|
use App\Models\Calendar;
|
|
|
|
|
|
use App\Models\CourseContentEvaluationAsk;
|
|
|
|
|
|
use App\Models\CourseContentEvaluationForm;
|
|
|
|
|
|
use App\Models\CustomForm;
|
|
|
|
|
|
use App\Models\CustomFormField;
|
|
|
|
|
|
use App\Models\SupplyDemand;
|
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
|
|
|
|
use Rap2hpoutre\FastExcel\FastExcel;
|
|
|
|
|
|
|
|
|
|
|
|
class CalendarsController extends BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构造函数
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function __construct()
|
|
|
|
|
|
{
|
|
|
|
|
|
parent::__construct(new Calendar());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
|
* path="/api/admin/calendars/index",
|
|
|
|
|
|
* tags={"日历管理"},
|
|
|
|
|
|
* summary="列表",
|
|
|
|
|
|
* description="",
|
|
|
|
|
|
* @OA\Parameter(name="month", in="query", @OA\Schema(type="string"), required=true, description="月份"),
|
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
|
* response="200",
|
|
|
|
|
|
* description="暂无"
|
|
|
|
|
|
* )
|
|
|
|
|
|
* )
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function index()
|
|
|
|
|
|
{
|
|
|
|
|
|
$all = \request()->all();
|
|
|
|
|
|
$messages = [
|
|
|
|
|
|
'month.required' => '月份必填',
|
|
|
|
|
|
];
|
|
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
|
|
'month' => 'required',
|
|
|
|
|
|
], $messages);
|
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
|
|
}
|
|
|
|
|
|
$list = Calendar::with('course', 'courseContent')->where('start_time', 'like', $all['month'] . '%')->orderBy('date')->get();
|
|
|
|
|
|
return $this->success($list);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
|
* path="/api/admin/calendars/show",
|
|
|
|
|
|
* tags={"日历管理"},
|
|
|
|
|
|
* summary="详情",
|
|
|
|
|
|
* description="",
|
|
|
|
|
|
* @OA\Parameter(name="id", in="query", @OA\Schema(type="string"), required=true, description="id"),
|
|
|
|
|
|
* @OA\Parameter(name="show_relation", in="query", @OA\Schema(type="string"), required=false, description="需要输出的关联关系数组,填写输出指定数据"),
|
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
|
* response="200",
|
|
|
|
|
|
* description="暂无"
|
|
|
|
|
|
* )
|
|
|
|
|
|
* )
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function show()
|
|
|
|
|
|
{
|
|
|
|
|
|
$all = \request()->all();
|
|
|
|
|
|
$messages = [
|
|
|
|
|
|
'id.required' => 'Id必填',
|
|
|
|
|
|
];
|
|
|
|
|
|
$validator = Validator::make($all, [
|
|
|
|
|
|
'id' => 'required'
|
|
|
|
|
|
], $messages);
|
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
|
|
}
|
|
|
|
|
|
$detail = $this->model->with('courseContent')->find($all['id']);
|
|
|
|
|
|
return $this->success($detail);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
|
* path="/api/admin/calendars/save",
|
|
|
|
|
|
* tags={"日历管理"},
|
|
|
|
|
|
* summary="保存",
|
|
|
|
|
|
* description="",
|
|
|
|
|
|
* @OA\Parameter(name="id", in="query", @OA\Schema(type="integer", format="int64"), required=true, description="ID(存在则更新,不存在则新增)"),
|
|
|
|
|
|
* @OA\Parameter(name="type", in="query", @OA\Schema(type="integer"), required=false, description="类型1课程2课堂3事件"),
|
|
|
|
|
|
* @OA\Parameter(name="course_id", in="query", @OA\Schema(type="integer"), required=false, description="课程ID"),
|
|
|
|
|
|
* @OA\Parameter(name="course_content_id", in="query", @OA\Schema(type="integer"), required=false, description="课程课堂ID"),
|
|
|
|
|
|
* @OA\Parameter(name="date", in="query", @OA\Schema(type="string", format="date"), required=false, description="日期(YYYY-MM-DD)"),
|
|
|
|
|
|
* @OA\Parameter(name="title", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="标题"),
|
|
|
|
|
|
* @OA\Parameter(name="url", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="url"),
|
|
|
|
|
|
* @OA\Parameter(name="content", in="query", @OA\Schema(type="string", format="mediumtext"), required=false, description="内容"),
|
|
|
|
|
|
* @OA\Parameter(name="start_time", in="query", @OA\Schema(type="string", format="date-time"), required=false, description="开始时间(YYYY-MM-DD HH:MM:SS)"),
|
|
|
|
|
|
* @OA\Parameter(name="end_time", in="query", @OA\Schema(type="string", format="date-time"), required=false, description="结束时间(YYYY-MM-DD HH:MM:SS)"),
|
|
|
|
|
|
* @OA\Parameter(name="is_publish", in="query", @OA\Schema(type="string"), required=true, description="是否向用户发布0否1是"),
|
|
|
|
|
|
* @OA\Parameter(name="address", in="query", @OA\Schema(type="string"), required=true, description="地址"),
|
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="认证token"),
|
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
|
* response="200",
|
|
|
|
|
|
* description="操作成功"
|
|
|
|
|
|
* )
|
|
|
|
|
|
* )
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function save()
|
|
|
|
|
|
{
|
|
|
|
|
|
return parent::save();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
|
* path="/api/admin/calendars/destroy",
|
|
|
|
|
|
* tags={"日历管理"},
|
|
|
|
|
|
* summary="删除",
|
|
|
|
|
|
* description="",
|
|
|
|
|
|
* @OA\Parameter(name="id", in="query", @OA\Schema(type="string"), required=true, description="id"),
|
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
|
* response="200",
|
|
|
|
|
|
* description="暂无"
|
|
|
|
|
|
* )
|
|
|
|
|
|
* )
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function destroy()
|
|
|
|
|
|
{
|
|
|
|
|
|
return parent::destroy();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|