|
|
@ -15,6 +15,7 @@ use app\common\library\Lock; |
|
|
|
use app\common\library\Log; |
|
|
|
use app\common\library\Log; |
|
|
|
use app\common\service\BaseService; |
|
|
|
use app\common\service\BaseService; |
|
|
|
use cores\exception\BaseException; |
|
|
|
use cores\exception\BaseException; |
|
|
|
|
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
|
|
|
|
class PaySuccess extends BaseService |
|
|
|
class PaySuccess extends BaseService |
|
|
|
{ |
|
|
|
{ |
|
|
@ -102,10 +103,12 @@ class PaySuccess extends BaseService |
|
|
|
{ |
|
|
|
{ |
|
|
|
// 验证当前参数是否合法 |
|
|
|
// 验证当前参数是否合法 |
|
|
|
$this->verifyParameters(); |
|
|
|
$this->verifyParameters(); |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => "验证通过", 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
// 当前订单开启并发锁 |
|
|
|
// 当前订单开启并发锁 |
|
|
|
$this->lockUp(); |
|
|
|
$this->lockUp(); |
|
|
|
// 验证当前订单是否允许支付 |
|
|
|
// 验证当前订单是否允许支付 |
|
|
|
if ($this->checkOrderStatusOnPay()) { |
|
|
|
if ($this->checkOrderStatusOnPay()) { |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => "可以支付", 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
// 更新订单状态为已付款 |
|
|
|
// 更新订单状态为已付款 |
|
|
|
$this->updatePayStatus(); |
|
|
|
$this->updatePayStatus(); |
|
|
|
} |
|
|
|
} |
|
|
@ -135,6 +138,8 @@ class PaySuccess extends BaseService |
|
|
|
Log::append('PaySuccess --updatePayStatus', ['title' => '订单已付款事件']); |
|
|
|
Log::append('PaySuccess --updatePayStatus', ['title' => '订单已付款事件']); |
|
|
|
// 当前订单信息 |
|
|
|
// 当前订单信息 |
|
|
|
$orderInfo = $this->getOrderInfo(); |
|
|
|
$orderInfo = $this->getOrderInfo(); |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => "订单信息", '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->orderModel()->transaction(function () use ($orderInfo) { |
|
|
|
$this->orderModel()->transaction(function () use ($orderInfo) { |
|
|
|
// 更新订单状态 |
|
|
|
// 更新订单状态 |
|
|
|