修复:部分类型订单触发支付超时自动取消订单失败的问题
This commit is contained in:
parent
239be9a568
commit
3ad0b1e9ac
|
|
@ -55,9 +55,9 @@ class StoreGroupOrderDao extends BaseDao
|
||||||
$query->where('paid',$where['paid']);
|
$query->where('paid',$where['paid']);
|
||||||
})
|
})
|
||||||
->when($isWithGoods == 1,function($query) use ($where){
|
->when($isWithGoods == 1,function($query) use ($where){
|
||||||
$query->whereNotIn('activity_type',[30,31,32,33,34,36,37,38]);
|
$query->whereNotIn('activity_type',[30,31,32,33,34,37,38]);
|
||||||
},function($query) use ($where){
|
},function($query) use ($where){
|
||||||
$query->whereNotIn('activity_type',[30,31,32,33,34,35,36,37,38]);
|
$query->whereNotIn('activity_type',[30,31,32,33,34,35,37,38]);
|
||||||
})
|
})
|
||||||
->when(isset($where['paid']) && $where['paid'] !== '',function($query) use ($where){
|
->when(isset($where['paid']) && $where['paid'] !== '',function($query) use ($where){
|
||||||
$query->where('paid',$where['paid']);
|
$query->where('paid',$where['paid']);
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,9 @@ class StoreOrderDao extends BaseDao
|
||||||
$isWithGoods = $where['is_with_goods'] ?? 0;
|
$isWithGoods = $where['is_with_goods'] ?? 0;
|
||||||
$activityType = $where['activity_type'] ?? 0;
|
$activityType = $where['activity_type'] ?? 0;
|
||||||
if($isWithGoods == 1 || $activityType == 35){
|
if($isWithGoods == 1 || $activityType == 35){
|
||||||
$query->whereNotIn('StoreOrder.activity_type',[20,30,31,32,33,34,36,37,38]);
|
$query->whereNotIn('StoreOrder.activity_type',[20,30,31,32,33,34,37,38]);
|
||||||
}else if($activityType == 0){
|
}else if($activityType == 0){
|
||||||
$query->whereNotIn('StoreOrder.activity_type',[20,30,31,32,33,34,35,36,37,38]);
|
$query->whereNotIn('StoreOrder.activity_type',[20,30,31,32,33,34,35,37,38]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->when(($sysDel !== null), function ($query) use ($sysDel) {
|
$query->when(($sysDel !== null), function ($query) use ($sysDel) {
|
||||||
|
|
|
||||||
|
|
@ -113,13 +113,13 @@ class StoreGroupOrderRepository extends BaseRepository
|
||||||
* @author xaboy
|
* @author xaboy
|
||||||
* @day 2020/6/10
|
* @day 2020/6/10
|
||||||
*/
|
*/
|
||||||
public function cancel($id, $uid = null)
|
public function cancel($id, $uid = null){
|
||||||
{
|
$groupOrder = $this->getSearch(['paid' => 0, 'uid' => $uid ?? ''])
|
||||||
$groupOrder = $this->search(['paid' => 0, 'uid' => $uid ?? ''])->where('group_order_id', $id)->with(['orderList'])->find();
|
->where('group_order_id', $id)
|
||||||
if (!$groupOrder)
|
->with(['orderList'])->find();
|
||||||
throw new ValidateException('订单不存在');
|
|
||||||
if ($groupOrder['paid'] != 0)
|
if (!$groupOrder) throw new ValidateException('订单不存在');
|
||||||
throw new ValidateException('订单状态错误,无法删除');
|
if ($groupOrder['paid'] != 0) throw new ValidateException('订单状态错误,无法删除');
|
||||||
//TODO 关闭订单
|
//TODO 关闭订单
|
||||||
Db::transaction(function () use ($groupOrder, $id, $uid) {
|
Db::transaction(function () use ($groupOrder, $id, $uid) {
|
||||||
$groupOrder->is_del = 1;
|
$groupOrder->is_del = 1;
|
||||||
|
|
|
||||||
|
|
@ -60,29 +60,29 @@ return [
|
||||||
],
|
],
|
||||||
// 订单支付成功事件触发
|
// 订单支付成功事件触发
|
||||||
'order.paySuccess' => [
|
'order.paySuccess' => [
|
||||||
// 赠送酒卡额度
|
|
||||||
'app\listener\exchangeQuota\OrderPaySuccessEvent'
|
'app\listener\exchangeQuota\OrderPaySuccessEvent'
|
||||||
],
|
],
|
||||||
|
// 订单取消成功
|
||||||
|
'order.cancel' => [
|
||||||
|
'app\listener\exchangeQuota\OrderCancelEvent'
|
||||||
|
],
|
||||||
// 订单完成事件触发(进入待评价)
|
// 订单完成事件触发(进入待评价)
|
||||||
'order.take' => [
|
'order.take' => [
|
||||||
// 酒卡额度解冻
|
|
||||||
'app\listener\exchangeQuota\OrderTakeEvent'
|
'app\listener\exchangeQuota\OrderTakeEvent'
|
||||||
],
|
],
|
||||||
// 订单核销成功事件触发
|
// 订单核销成功事件触发
|
||||||
'order.verify' => [
|
'order.verify' => [
|
||||||
// 酒卡额度解冻
|
|
||||||
'app\listener\exchangeQuota\OrderVerifyEvent'
|
'app\listener\exchangeQuota\OrderVerifyEvent'
|
||||||
],
|
],
|
||||||
// 订单退款事件
|
// 订单退款事件
|
||||||
'refund.agree' => [
|
'refund.agree' => [
|
||||||
// 酒卡额度相关处理
|
|
||||||
'app\listener\exchangeQuota\OrderAgreeRefundEvent'
|
'app\listener\exchangeQuota\OrderAgreeRefundEvent'
|
||||||
],
|
],
|
||||||
// 会员卡开通 支付成功
|
// 会员卡开通 支付成功
|
||||||
'user.vipPay' => [
|
'user.vipPay' => [
|
||||||
// 酒卡额度相关处理
|
// 酒卡额度相关处理
|
||||||
'app\listener\exchangeQuota\OrderVipPayEvent',
|
'app\listener\exchangeQuota\OrderVipPayEvent',
|
||||||
//开卡成功送优惠券
|
// 开卡成功送优惠券
|
||||||
'app\listener\giveCoupon\CardOpeningEvent',
|
'app\listener\giveCoupon\CardOpeningEvent',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
namespace app\listener\exchangeQuota;
|
||||||
|
|
||||||
|
use app\common\model\system\merchant\MerchantQuotaRecord;
|
||||||
|
use app\common\model\user\ExchangeIntegralRecord;
|
||||||
|
use app\common\model\user\ExchangeQuotaRecord;
|
||||||
|
use app\common\model\user\User;
|
||||||
|
use app\common\repositories\store\order\StoreOrderRepository;
|
||||||
|
use app\common\repositories\system\merchant\MerchantQuotaRepository;
|
||||||
|
use app\common\repositories\user\ExchangeQuotaRepository;
|
||||||
|
use think\facade\Log;
|
||||||
|
|
||||||
|
class OrderCancelEvent{
|
||||||
|
private $groupOrder;
|
||||||
|
|
||||||
|
public function handle($params){
|
||||||
|
Log::info('订单取消 - 开始: '.var_export($params,1));
|
||||||
|
// $this->groupOrder = $params['order'] ?? [];
|
||||||
|
try{
|
||||||
|
// 根据订单类型进行对应的处理
|
||||||
|
// switch((int)$this->groupOrder->activity_type){
|
||||||
|
// // 酒道馆和小酒馆兑换订单
|
||||||
|
// case 36:$this->quotaAndIntegralHandle();break;
|
||||||
|
// // 进货订单
|
||||||
|
// case 35:$this->merQuotaHandle();break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}catch(\Exception $e){
|
||||||
|
$data = [
|
||||||
|
// 'uid' => $this->groupOrder->uid,
|
||||||
|
// 'group_order_id' => $this->groupOrder->group_order_id,
|
||||||
|
'msg' => $e->getMessage()
|
||||||
|
];
|
||||||
|
Log::info('订单取消 - 错误: '.var_export($data,1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ class AutoCancelGroupOrderListen extends TimerService implements ListenerInterfa
|
||||||
try {
|
try {
|
||||||
$storeGroupOrderRepository->cancel($id);
|
$storeGroupOrderRepository->cancel($id);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// Log::info('自动关闭订单失败' . var_export($id, 1));
|
// Log::info('自动关闭订单失败'.var_export(['id' => $id,'msg' => $e->getMessage()],1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue