|
|
|
|
@ -49,6 +49,8 @@ class CourseContentCheckController extends BaseController
|
|
|
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"),
|
|
|
|
|
* @OA\Parameter(name="sort_name", in="query", @OA\Schema(type="string"), required=false, description="排序字段名字"),
|
|
|
|
|
* @OA\Parameter(name="sort_type", in="query", @OA\Schema(type="string"), required=false, description="排序类型"),
|
|
|
|
|
* @OA\Parameter(name="course_id", in="query", @OA\Schema(type="string"), required=false, description="course_id"),
|
|
|
|
|
* @OA\Parameter(name="course_content_id", in="query", @OA\Schema(type="string"), required=false, description="course_content_id"),
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
@ -59,43 +61,49 @@ class CourseContentCheckController extends BaseController
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$all = request()->all();
|
|
|
|
|
$list = CourseSign::with(['course.typeDetail', 'user'])
|
|
|
|
|
->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)) {
|
|
|
|
|
$list = CourseSign::with(['course.typeDetail', 'user', 'courseContentCheck' => function ($query) use ($all) {
|
|
|
|
|
if (isset($all['course_content_id'])) {
|
|
|
|
|
$query->where('course_content_id', $all['course_content_id']);
|
|
|
|
|
}
|
|
|
|
|
}])->where(function ($query) use ($all) {
|
|
|
|
|
if (isset($all['course_id'])) {
|
|
|
|
|
$query->where('course_id', $all['course_id']);
|
|
|
|
|
}
|
|
|
|
|
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 == '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;
|
|
|
|
|
}
|
|
|
|
|
// 等于
|
|
|
|
|
if ($op == 'eq') {
|
|
|
|
|
$query->where($key, $value);
|
|
|
|
|
}
|
|
|
|
|
// 不等于
|
|
|
|
|
if ($op == 'neq') {
|
|
|
|
|
$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]);
|
|
|
|
|
}
|
|
|
|
|
$query->whereBetween($key, [$from, $to]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')
|
|
|
|
|
}
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')
|
|
|
|
|
->orderBy('created_at', 'desc');
|
|
|
|
|
if (isset($all['is_export']) && !empty($all['is_export'])) {
|
|
|
|
|
$list = $list->limit(5000)->get()->toArray();
|
|
|
|
|
@ -122,7 +130,8 @@ class CourseContentCheckController extends BaseController
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function show()
|
|
|
|
|
public
|
|
|
|
|
function show()
|
|
|
|
|
{
|
|
|
|
|
return parent::show();
|
|
|
|
|
}
|
|
|
|
|
@ -141,7 +150,8 @@ class CourseContentCheckController extends BaseController
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function save()
|
|
|
|
|
public
|
|
|
|
|
function save()
|
|
|
|
|
{
|
|
|
|
|
return parent::save();
|
|
|
|
|
}
|
|
|
|
|
@ -160,7 +170,8 @@ class CourseContentCheckController extends BaseController
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function destroy()
|
|
|
|
|
public
|
|
|
|
|
function destroy()
|
|
|
|
|
{
|
|
|
|
|
return parent::destroy();
|
|
|
|
|
}
|
|
|
|
|
|