|
|
@ -190,18 +190,21 @@ class PaySuccess extends BaseService |
|
|
|
// 当前订单信息 |
|
|
|
// 当前订单信息 |
|
|
|
$orderInfo = $this->getOrderInfo(); |
|
|
|
$orderInfo = $this->getOrderInfo(); |
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($orderInfo), 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($orderInfo), 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
|
|
|
// 更新订单状态 |
|
|
|
|
|
|
|
$this->updateOrderStatus(); |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => '修改订单开始11111', 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
|
|
|
// 累积用户总消费金额 |
|
|
|
|
|
|
|
UserModel::setIncPayMoney($orderInfo['user_id'], (float)$orderInfo['pay_price']); |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => '设置消费金额', 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
|
|
|
// 记录订单支付信息 |
|
|
|
|
|
|
|
$this->updatePayInfo(); |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => '修改第三方订单信息', 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
|
|
|
//更改会员角色 |
|
|
|
|
|
|
|
$this->activate(); |
|
|
|
// 事务处理 |
|
|
|
// 事务处理 |
|
|
|
$this->orderModel()->transaction(function () use ($orderInfo) { |
|
|
|
// $this->orderModel()->transaction(function () use ($orderInfo) { |
|
|
|
// 更新订单状态 |
|
|
|
// |
|
|
|
$this->updateOrderStatus(); |
|
|
|
// }); |
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => '修改订单开始11111', 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
|
|
|
// 累积用户总消费金额 |
|
|
|
|
|
|
|
UserModel::setIncPayMoney($orderInfo['user_id'], (float)$orderInfo['pay_price']); |
|
|
|
|
|
|
|
// 记录订单支付信息 |
|
|
|
|
|
|
|
$this->updatePayInfo(); |
|
|
|
|
|
|
|
//更改会员角色 |
|
|
|
|
|
|
|
$this->activate(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -229,6 +232,7 @@ class PaySuccess extends BaseService |
|
|
|
} |
|
|
|
} |
|
|
|
// 将第三方交易记录更新为已支付状态 |
|
|
|
// 将第三方交易记录更新为已支付状态 |
|
|
|
if (in_array($this->method, [PaymentMethodEnum::WECHAT, PaymentMethodEnum::ALIPAY])) { |
|
|
|
if (in_array($this->method, [PaymentMethodEnum::WECHAT, PaymentMethodEnum::ALIPAY])) { |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => '微信支付开始', 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
$this->updateTradeRecord(); |
|
|
|
$this->updateTradeRecord(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -238,6 +242,7 @@ class PaySuccess extends BaseService |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private function updateTradeRecord() |
|
|
|
private function updateTradeRecord() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($this->paymentData), 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
if ($this->tradeId && !empty($this->paymentData)) { |
|
|
|
if ($this->tradeId && !empty($this->paymentData)) { |
|
|
|
PaymentTradeModel::updateToPaySuccess($this->tradeId, $this->paymentData['tradeNo']); |
|
|
|
PaymentTradeModel::updateToPaySuccess($this->tradeId, $this->paymentData['tradeNo']); |
|
|
|
} |
|
|
|
} |
|
|
|