pull/1/head
wanghousheng 10 months ago
parent 227a3c23e1
commit 290b27d0e2
  1. 3
      app/api/controller/Server.php
  2. 2
      app/api/service/Server/PaySuccess.php
  3. 4
      app/api/service/Server/ServerPayment.php
  4. 1
      app/common/service/server/Order.php

@ -243,14 +243,13 @@ class Server extends Controller
/** /**
* @notes:确认订单支付事件 * @notes:确认订单支付事件
* @return array
* @throws BaseException * @throws BaseException
* @throws DataNotFoundException * @throws DataNotFoundException
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
* @author: wanghousheng * @author: wanghousheng
*/ */
public function orderPay(): array public function orderPay(): Json
{ {
$orderId = intval($this->request->post('order_id')); $orderId = intval($this->request->post('order_id'));
if (!$orderId) { if (!$orderId) {

@ -8,6 +8,7 @@ use app\api\model\User as UserModel;
use app\api\model\user\BalanceLog as BalanceLogModel; use app\api\model\user\BalanceLog as BalanceLogModel;
use app\common\enum\order\PayStatus as PayStatusEnum; use app\common\enum\order\PayStatus as PayStatusEnum;
use app\common\enum\payment\Method as PaymentMethodEnum; 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\enum\user\balanceLog\Scene as SceneEnum;
use app\common\library\Lock; use app\common\library\Lock;
use app\common\library\Log; use app\common\library\Log;
@ -210,6 +211,7 @@ class PaySuccess extends BaseService
// 更新订单状态 // 更新订单状态
$this->orderModel()->save([ $this->orderModel()->save([
'pay_method' => $this->method, 'pay_method' => $this->method,
'order_status' => ServerEnum::APPLYDISPATCH,
'pay_status' => PayStatusEnum::SUCCESS, 'pay_status' => PayStatusEnum::SUCCESS,
'pay_time' => time(), 'pay_time' => time(),
'trade_id' => $this->tradeId ?: 0, 'trade_id' => $this->tradeId ?: 0,

@ -266,6 +266,10 @@ class ServerPayment extends BaseService
*/ */
private function unifiedorder(array $extra = []): array private function unifiedorder(array $extra = []): array
{ {
// 判断支付方式是否合法
if (!in_array($this->method, [PaymentMethodEnum::WECHAT, PaymentMethodEnum::ALIPAY])) {
return [];
}
// 生成第三方交易订单号 (并非主订单号) // 生成第三方交易订单号 (并非主订单号)
$outTradeNo = OrderService::createOrderNo(); $outTradeNo = OrderService::createOrderNo();
// 获取支付方式的配置信息 // 获取支付方式的配置信息

@ -179,6 +179,7 @@ class Order extends BaseService
$order_data = [ $order_data = [
'server_id' => $this->serverInfo['server_id'], 'server_id' => $this->serverInfo['server_id'],
'order_no' => $this->orderNo(), 'order_no' => $this->orderNo(),
'server_name' => $this->serverInfo['server_name'],
'server_image_id' => $this->serverInfo['image_id'], 'server_image_id' => $this->serverInfo['image_id'],
'total_price' => $this->serverInfo['server_price'], 'total_price' => $this->serverInfo['server_price'],
'store_id' => $this->storeId, 'store_id' => $this->storeId,

Loading…
Cancel
Save