pull/1/head
wanghousheng 12 months ago
parent 1fa6a68329
commit b13a55592c
  1. 10
      app/api/controller/Server.php
  2. 6
      app/common/service/server/Order.php

@ -147,12 +147,20 @@ class Server extends Controller
{
$serverId = intval($this->request->post('server_id'));
$couponId = intval($this->request->post('coupon_id'));
$server_time = $this->request->post('server_time');
if (!$server_time) {
return $this->renderError('服务时间不能为空');
}
$server_address = $this->request->post('server_address');
if (!$server_address) {
return $this->renderError('服务地址不能为空');
}
$remake = (string)$this->request->post('remake');
if (!$serverId) {
return $this->renderError('非法请求');
}
$orderService = new ServerServiceOrder();
$result = $orderService->createOrder($serverId, $couponId, $remake);
$result = $orderService->createOrder($serverId, $couponId, $server_address, $server_time, $remake);
if ($result) {
return $this->renderSuccess($result);
}

@ -163,13 +163,15 @@ class Order extends BaseService
* @notes:生成订单
* @param int $serverId
* @param int $couponId
* @param string $server_address
* @param string $server_time
* @param string $buyer_remark
* @return array
* @throws BaseException
* @throws DbException
* @author: wanghousheng
*/
public function createOrder(int $serverId, int $couponId, string $buyer_remark = ''): array
public function createOrder(int $serverId, int $couponId, string $server_address, string $server_time, string $buyer_remark = ''): array
{
$userId = UserService::getCurrentLoginUserId();
$data = $this->onCheck($serverId, $couponId);
@ -190,6 +192,8 @@ class Order extends BaseService
'buyer_remark' => $buyer_remark,
'create_time' => time(),
'update_time' => time(),
'server_time' => $server_time,
'server_address' => $server_address,
];
$model = new ServerOrder();
$order_id = $model->insertGetId($order_data);

Loading…
Cancel
Save