|
|
|
|
@ -53,60 +53,60 @@ class CourseContentEvaluationsController extends BaseController
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$all = request()->all();
|
|
|
|
|
$list = $this->model->with('course','courseContent')
|
|
|
|
|
->withCount('courseContentEvaluationAsks','courseContentEvaluationForms')
|
|
|
|
|
$list = $this->model->with('course', 'courseContent')
|
|
|
|
|
->withCount('courseContentEvaluationAsks', 'courseContentEvaluationForms')
|
|
|
|
|
->where(function ($query) use ($all) {
|
|
|
|
|
if (isset($all['filter']) && !empty($all['filter'])) {
|
|
|
|
|
foreach ($all['filter'] as $condition) {
|
|
|
|
|
$key = $condition['key'] ?? null;
|
|
|
|
|
$op = $condition['op'] ?? null;
|
|
|
|
|
$value = $condition['value'] ?? null;
|
|
|
|
|
if (!isset($key) || !isset($op) || !isset($value)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 等于
|
|
|
|
|
if ($op == 'eq') {
|
|
|
|
|
$query->where($key, $value);
|
|
|
|
|
}
|
|
|
|
|
// 不等于
|
|
|
|
|
if ($op == 'neq') {
|
|
|
|
|
$query->where($key, '!=', $value);
|
|
|
|
|
}
|
|
|
|
|
// 大于
|
|
|
|
|
if ($op == 'gt') {
|
|
|
|
|
$query->where($key, '>', $value);
|
|
|
|
|
}
|
|
|
|
|
// 大于等于
|
|
|
|
|
if ($op == 'egt') {
|
|
|
|
|
$query->where($key, '>=', $value);
|
|
|
|
|
}
|
|
|
|
|
// 小于
|
|
|
|
|
if ($op == 'lt') {
|
|
|
|
|
$query->where($key, '<', $value);
|
|
|
|
|
}
|
|
|
|
|
// 小于等于
|
|
|
|
|
if ($op == 'elt') {
|
|
|
|
|
$query->where($key, '<=', $value);
|
|
|
|
|
}
|
|
|
|
|
// 模糊搜索
|
|
|
|
|
if ($op == 'like') {
|
|
|
|
|
$query->where($key, 'like', '%' . $value . '%');
|
|
|
|
|
}
|
|
|
|
|
// 否定模糊搜索
|
|
|
|
|
if ($op == 'notlike') {
|
|
|
|
|
$query->where($key, 'not like', '%' . $value . '%');
|
|
|
|
|
}
|
|
|
|
|
// 范围搜索
|
|
|
|
|
if ($op == 'range') {
|
|
|
|
|
list($from, $to) = explode(',', $value);
|
|
|
|
|
if (empty($from) || empty($to)) {
|
|
|
|
|
if (isset($all['filter']) && !empty($all['filter'])) {
|
|
|
|
|
foreach ($all['filter'] as $condition) {
|
|
|
|
|
$key = $condition['key'] ?? null;
|
|
|
|
|
$op = $condition['op'] ?? null;
|
|
|
|
|
$value = $condition['value'] ?? null;
|
|
|
|
|
if (!isset($key) || !isset($op) || !isset($value)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$query->whereBetween($key, [$from, $to]);
|
|
|
|
|
// 等于
|
|
|
|
|
if ($op == 'eq') {
|
|
|
|
|
$query->where($key, $value);
|
|
|
|
|
}
|
|
|
|
|
// 不等于
|
|
|
|
|
if ($op == 'neq') {
|
|
|
|
|
$query->where($key, '!=', $value);
|
|
|
|
|
}
|
|
|
|
|
// 大于
|
|
|
|
|
if ($op == 'gt') {
|
|
|
|
|
$query->where($key, '>', $value);
|
|
|
|
|
}
|
|
|
|
|
// 大于等于
|
|
|
|
|
if ($op == 'egt') {
|
|
|
|
|
$query->where($key, '>=', $value);
|
|
|
|
|
}
|
|
|
|
|
// 小于
|
|
|
|
|
if ($op == 'lt') {
|
|
|
|
|
$query->where($key, '<', $value);
|
|
|
|
|
}
|
|
|
|
|
// 小于等于
|
|
|
|
|
if ($op == 'elt') {
|
|
|
|
|
$query->where($key, '<=', $value);
|
|
|
|
|
}
|
|
|
|
|
// 模糊搜索
|
|
|
|
|
if ($op == 'like') {
|
|
|
|
|
$query->where($key, 'like', '%' . $value . '%');
|
|
|
|
|
}
|
|
|
|
|
// 否定模糊搜索
|
|
|
|
|
if ($op == 'notlike') {
|
|
|
|
|
$query->where($key, 'not like', '%' . $value . '%');
|
|
|
|
|
}
|
|
|
|
|
// 范围搜索
|
|
|
|
|
if ($op == 'range') {
|
|
|
|
|
list($from, $to) = explode(',', $value);
|
|
|
|
|
if (empty($from) || empty($to)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$query->whereBetween($key, [$from, $to]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc');
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc');
|
|
|
|
|
if (isset($all['is_export']) && !empty($all['is_export'])) {
|
|
|
|
|
$list = $list->get()->toArray();
|
|
|
|
|
$export_fields = $all['export_fields'] ?? [];
|
|
|
|
|
@ -148,7 +148,7 @@ class CourseContentEvaluationsController extends BaseController
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
|
}
|
|
|
|
|
$detail = $this->model->with('course','courseContent')->find($all['id']);
|
|
|
|
|
$detail = $this->model->with('course', 'courseContent')->find($all['id']);
|
|
|
|
|
return $this->success($detail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -160,7 +160,7 @@ class CourseContentEvaluationsController extends BaseController
|
|
|
|
|
* description="",
|
|
|
|
|
* @OA\Parameter(name="id", in="query", @OA\Schema(type="integer", format="int64"), required=true, description="课程内容评价字段ID(存在则更新,不存在则新增)"),
|
|
|
|
|
* @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="course_content_id", in="query", @OA\Schema(type="integer"), required=false, description="课程内容ID,多个英文逗号分割"),
|
|
|
|
|
* @OA\Parameter(name="title", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="问卷标题"),
|
|
|
|
|
* @OA\Parameter(name="desc", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="问卷描述"),
|
|
|
|
|
* @OA\Parameter(name="type_id", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="问卷类型ID"),
|
|
|
|
|
|