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.
28 lines
705 B
28 lines
705 B
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Constants\ErrorCode;
|
|
use App\Request\OrderOnlineRequest;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use App\Service\OrderServiceInterface;
|
|
use Hyperf\HttpMessage\Stream\SwooleStream;
|
|
|
|
class OrderController extends BaseController
|
|
{
|
|
|
|
/**
|
|
* @Inject
|
|
* @var OrderServiceInterface
|
|
*/
|
|
protected $orderService;
|
|
|
|
public function addOnlineOrder(OrderOnlineRequest $request)
|
|
{
|
|
$orderMainId = $this->orderService->addOnlineOrder($request->validated());
|
|
if (!is_int($orderMainId)) {
|
|
return $this->result(ErrorCode::ORDER_FAILURE, '', $orderMainId);
|
|
}
|
|
return $this->success(['order_id' => $orderMainId]);
|
|
}
|
|
}
|