feat(app/queue/redis): 增加订单支付超时处理逻辑
This commit is contained in:
parent
6566fcea3d
commit
c20c1cf940
@ -5,6 +5,7 @@ namespace app\queue\redis;
|
||||
use app\common\logic\PayNotifyLogic;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\user_recharge\UserRecharge;
|
||||
use app\common\service\pay\PayService;
|
||||
use app\common\service\PushService;
|
||||
use Webman\RedisQueue\Consumer;
|
||||
@ -44,17 +45,29 @@ class CodePaySend implements Consumer
|
||||
{
|
||||
// 直接更改消息队列数据结构,将最大重试次数max_attempts字段设置为0,即不再重试。
|
||||
if($package['attempts'] ==$exception['max_attempts']){
|
||||
$pay = new PayService();
|
||||
$data = [
|
||||
'order_id' => $package['data']['order_id'],
|
||||
'paid' => 0,
|
||||
];
|
||||
$find=StoreOrder::where($data)->find();
|
||||
if($find){
|
||||
$order = StoreOrder::update($data);
|
||||
if($package['data']['pay_type']=='recharge'){
|
||||
$order=UserRecharge::where($data)->find();
|
||||
if($order){
|
||||
$res=UserRecharge::where($data)->update(['status'=>-1]);
|
||||
if($res){
|
||||
PushService::push('wechat_mmp_' . $order['uid'], $order['uid'], ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>$data['id']]]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
$order=StoreOrder::where($data)->find();
|
||||
if($order){
|
||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'cash_register','msg'=>'支付超时,订单已被取消,请重新提交订单']);
|
||||
}
|
||||
}
|
||||
$pay->wechat->close(['out_trade_no'=>$order['order_id']]);
|
||||
|
||||
|
||||
}
|
||||
return $package;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user