CoachFlowController.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace App\Http\Controllers\Coach;
  3. use App\Http\Controllers\Controller;
  4. use App\Services\Coach\CoachFlowService;
  5. use App\Traits\ResponseTrait;
  6. use Illuminate\Http\Request;
  7. use Illuminate\Support\Facades\Auth;
  8. /**
  9. * @group 技师端
  10. *
  11. * 技师投流相关的API接口
  12. */
  13. class CoachFlowController extends Controller
  14. {
  15. use ResponseTrait;
  16. protected $flowService;
  17. public function __construct(CoachFlowService $flowService)
  18. {
  19. $this->flowService = $flowService;
  20. }
  21. /**
  22. * [投流]创建订单
  23. *
  24. * @description 创建教练投流订单
  25. *
  26. * @bodyParam position_type integer required 位置类型(1:首页 2:列表页) Example: 1
  27. * @bodyParam time_slot integer required 时间段(1:上午 2:下午 3:晚上) Example: 1
  28. * @bodyParam days integer required 投放天数(可选值:1,7,15,30,90,180,365) Example: 7
  29. *
  30. * @response {
  31. * "code": 0,
  32. * "message": "success",
  33. * "data": {
  34. * "order_id": 1,
  35. * "order_no": "FL202403201445201234",
  36. * "amount": "53.00"
  37. * }
  38. * }
  39. */
  40. public function createOrder(Request $request)
  41. {
  42. $params = $request->validate([
  43. 'position_type' => 'required|integer|in:1,2',
  44. 'time_slot' => 'required|integer|in:1,2,3',
  45. 'days' => 'required|integer|in:1,7,15,30,90,180,365',
  46. ]);
  47. $result = $this->flowService->createOrder(Auth::user()->id, $params);
  48. return $this->success($result);
  49. }
  50. /**
  51. * 技师投流-获取价格配置
  52. *
  53. * @description 获取投流价格配置信息
  54. *
  55. * @response {
  56. * "code": 200,
  57. * "message": "success",
  58. * "data": {
  59. * "time_slots": [
  60. * {"type": 1, "name": "上午", "time": "6:00~12:00", "price": 4},
  61. * {"type": 2, "name": "下午", "time": "12:00~18:00", "price": 6},
  62. * {"type": 3, "name": "晚上", "time": "18:00~6:00", "price": 8}
  63. * ],
  64. * "days": [
  65. * {"days": 1, "price": 12},
  66. * {"days": 7, "price": 53},
  67. * {"days": 15, "price": 99},
  68. * {"days": 30, "price": 160},
  69. * {"days": 90, "price": 430},
  70. * {"days": 180, "price": 760},
  71. * {"days": 365, "price": 1360}
  72. * ]
  73. * }
  74. * }
  75. */
  76. public function getPriceConfig()
  77. {
  78. return $this->flowService->getPriceConfig();
  79. }
  80. }