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.

27 lines
705 B

5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Controller;
  3. use App\Constants\ErrorCode;
  4. use App\Request\OrderOnlineRequest;
  5. use Hyperf\Di\Annotation\Inject;
  6. use App\Service\OrderServiceInterface;
  7. use Hyperf\HttpMessage\Stream\SwooleStream;
  8. class OrderController extends BaseController
  9. {
  10. /**
  11. * @Inject
  12. * @var OrderServiceInterface
  13. */
  14. protected $orderService;
  15. public function addOnlineOrder(OrderOnlineRequest $request)
  16. {
  17. $orderMainId = $this->orderService->addOnlineOrder($request->validated());
  18. if (!is_int($orderMainId)) {
  19. return $this->result(ErrorCode::ORDER_FAILURE, '', $orderMainId);
  20. }
  21. return $this->success(['order_id' => $orderMainId]);
  22. }
  23. }