diff --git a/app/api/controller/Server.php b/app/api/controller/Server.php index 48312c17..2e8df859 100644 --- a/app/api/controller/Server.php +++ b/app/api/controller/Server.php @@ -243,14 +243,13 @@ class Server extends Controller /** * @notes:确认订单支付事件 - * @return array * @throws BaseException * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException * @author: wanghousheng */ - public function orderPay(): array + public function orderPay(): Json { $orderId = intval($this->request->post('order_id')); if (!$orderId) { diff --git a/app/api/service/Server/PaySuccess.php b/app/api/service/Server/PaySuccess.php index a0845ebe..4e8c8ace 100644 --- a/app/api/service/Server/PaySuccess.php +++ b/app/api/service/Server/PaySuccess.php @@ -8,6 +8,7 @@ use app\api\model\User as UserModel; use app\api\model\user\BalanceLog as BalanceLogModel; use app\common\enum\order\PayStatus as PayStatusEnum; use app\common\enum\payment\Method as PaymentMethodEnum; +use app\common\enum\ServerEnum; use app\common\enum\user\balanceLog\Scene as SceneEnum; use app\common\library\Lock; use app\common\library\Log; @@ -210,6 +211,7 @@ class PaySuccess extends BaseService // 更新订单状态 $this->orderModel()->save([ 'pay_method' => $this->method, + 'order_status' => ServerEnum::APPLYDISPATCH, 'pay_status' => PayStatusEnum::SUCCESS, 'pay_time' => time(), 'trade_id' => $this->tradeId ?: 0, diff --git a/app/api/service/Server/ServerPayment.php b/app/api/service/Server/ServerPayment.php index 760a7b50..b060ae4b 100644 --- a/app/api/service/Server/ServerPayment.php +++ b/app/api/service/Server/ServerPayment.php @@ -266,6 +266,10 @@ class ServerPayment extends BaseService */ private function unifiedorder(array $extra = []): array { + // 判断支付方式是否合法 + if (!in_array($this->method, [PaymentMethodEnum::WECHAT, PaymentMethodEnum::ALIPAY])) { + return []; + } // 生成第三方交易订单号 (并非主订单号) $outTradeNo = OrderService::createOrderNo(); // 获取支付方式的配置信息 diff --git a/app/common/service/server/Order.php b/app/common/service/server/Order.php index 294dea91..9d5354af 100644 --- a/app/common/service/server/Order.php +++ b/app/common/service/server/Order.php @@ -179,6 +179,7 @@ class Order extends BaseService $order_data = [ 'server_id' => $this->serverInfo['server_id'], 'order_no' => $this->orderNo(), + 'server_name' => $this->serverInfo['server_name'], 'server_image_id' => $this->serverInfo['image_id'], 'total_price' => $this->serverInfo['server_price'], 'store_id' => $this->storeId,