You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
67 lines
1.9 KiB
|
6 months ago
|
<?php
|
||
|
|
/**
|
||
|
|
* 其他
|
||
|
|
*/
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Mobile;
|
||
|
|
|
||
|
|
use App\Models\AppointmentConfig;
|
||
|
|
use App\Models\AppointmentType;
|
||
|
|
use App\Models\Banner;
|
||
|
|
use App\Models\Config;
|
||
|
|
|
||
|
|
class OtherController extends CommonController
|
||
|
|
{
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @OA\Get(
|
||
|
|
* path="/api/mobile/other/config",
|
||
|
|
* tags={"小程序-其他"},
|
||
|
|
* summary="获取配置信息",
|
||
|
|
* @OA\Parameter(name="appointment_type_id", in="query", @OA\Schema(type="integer"), required=true, description="场地类型"),
|
||
|
|
* @OA\Response(
|
||
|
|
* response=200,
|
||
|
|
* description="操作成功"
|
||
|
|
* )
|
||
|
|
* )
|
||
|
|
*/
|
||
|
|
public function config()
|
||
|
|
{
|
||
|
|
$all = request()->all();
|
||
|
|
$config = Config::get();
|
||
|
|
$appointment = AppointmentConfig::where(function ($query) use ($all) {
|
||
|
|
if (isset($all['appointment_type_id'])) {
|
||
|
|
$query->where('appointment_type_id', $all['appointment_type_id']);
|
||
|
|
}
|
||
|
|
})->where('show_front', 1)->get();
|
||
|
|
// 场地类型
|
||
|
|
$appointment_type = AppointmentType::get();
|
||
|
|
return $this->success(compact('config', 'appointment', 'appointment_type'));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @OA\Get(
|
||
|
|
* path="/api/mobile/other/banner",
|
||
|
|
* tags={"小程序-其他"},
|
||
|
|
* summary="获取banner",
|
||
|
|
* @OA\Parameter(name="position", in="query", @OA\Schema(type="integer"), required=true, description="位置1首页"),
|
||
|
|
* @OA\Response(
|
||
|
|
* response=200,
|
||
|
|
* description="操作成功"
|
||
|
|
* )
|
||
|
|
* )
|
||
|
|
*/
|
||
|
|
public function banner()
|
||
|
|
{
|
||
|
|
$position = request('position', 1);
|
||
|
|
$config = Banner::with('image')->where(function ($query) use ($position) {
|
||
|
|
if (isset($position)) {
|
||
|
|
$query->where('position', $position);
|
||
|
|
}
|
||
|
|
})->orderBy('sort')->get();
|
||
|
|
return $this->success($config);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|