1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace App\Http\Controllers\Coach;
- use App\Http\Controllers\Controller;
- use App\Services\Coach\CoachFlowService;
- use App\Traits\ResponseTrait;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Auth;
- /**
- * @group 技师端
- *
- * 技师投流相关的API接口
- */
- class CoachFlowController extends Controller
- {
- use ResponseTrait;
- protected $flowService;
- public function __construct(CoachFlowService $flowService)
- {
- $this->flowService = $flowService;
- }
- /**
- * [投流]创建订单
- *
- * @description 创建教练投流订单
- *
- * @bodyParam position_type integer required 位置类型(1:首页 2:列表页) Example: 1
- * @bodyParam time_slot integer required 时间段(1:上午 2:下午 3:晚上) Example: 1
- * @bodyParam days integer required 投放天数(可选值:1,7,15,30,90,180,365) Example: 7
- *
- * @response {
- * "code": 0,
- * "message": "success",
- * "data": {
- * "order_id": 1,
- * "order_no": "FL202403201445201234",
- * "amount": "53.00"
- * }
- * }
- */
- public function createOrder(Request $request)
- {
- $params = $request->validate([
- 'position_type' => 'required|integer|in:1,2',
- 'time_slot' => 'required|integer|in:1,2,3',
- 'days' => 'required|integer|in:1,7,15,30,90,180,365',
- ]);
- $result = $this->flowService->createOrder(Auth::user()->id, $params);
- return $this->success($result);
- }
- /**
- * 技师投流-获取价格配置
- *
- * @description 获取投流价格配置信息
- *
- * @response {
- * "code": 200,
- * "message": "success",
- * "data": {
- * "time_slots": [
- * {"type": 1, "name": "上午", "time": "6:00~12:00", "price": 4},
- * {"type": 2, "name": "下午", "time": "12:00~18:00", "price": 6},
- * {"type": 3, "name": "晚上", "time": "18:00~6:00", "price": 8}
- * ],
- * "days": [
- * {"days": 1, "price": 12},
- * {"days": 7, "price": 53},
- * {"days": 15, "price": 99},
- * {"days": 30, "price": 160},
- * {"days": 90, "price": 430},
- * {"days": 180, "price": 760},
- * {"days": 365, "price": 1360}
- * ]
- * }
- * }
- */
- public function getPriceConfig()
- {
- return $this->flowService->getPriceConfig();
- }
- }
|