|
|
|
|
@ -9,12 +9,34 @@ use Illuminate\Support\Facades\Validator;
|
|
|
|
|
|
|
|
|
|
class BookController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/mobile/book/other",
|
|
|
|
|
* tags={"小程序-图书"},
|
|
|
|
|
* summary="分类配置",
|
|
|
|
|
* description="",
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="暂无"
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function other()
|
|
|
|
|
{
|
|
|
|
|
// 分类数据
|
|
|
|
|
$category = Book::get()->implode('category', ',');
|
|
|
|
|
$category = explode(',', $category);
|
|
|
|
|
$category = array_unique($category);
|
|
|
|
|
return $this->success(compact('category'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/mobile/book/index",
|
|
|
|
|
* tags={"小程序-图书"},
|
|
|
|
|
* summary="图书列表",
|
|
|
|
|
* description="",
|
|
|
|
|
* @OA\Parameter(name="category", in="query", @OA\Schema(type="integer"), required=true, description="分类"),
|
|
|
|
|
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="integer"), required=true, description="关键词"),
|
|
|
|
|
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="string"), required=false, description="每页显示的条数"),
|
|
|
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"),
|
|
|
|
|
@ -37,6 +59,9 @@ class BookController extends Controller
|
|
|
|
|
->orWhere('isbn', 'like', '%' . $all['keyword'] . '%');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (isset($all['category'])) {
|
|
|
|
|
$query->where('category_id', 'like', '%' . $all['category'] . '%');
|
|
|
|
|
}
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')
|
|
|
|
|
->paginate($all['page_size'] ?? 20);
|
|
|
|
|
return $this->success($list);
|
|
|
|
|
|