修复多渠道切换渠道异常问题
This commit is contained in:
parent
3f874513ad
commit
4e5dce1d25
@ -298,23 +298,13 @@ class Core extends Controller
|
|||||||
$order = $orderService->get($order_id);
|
$order = $orderService->get($order_id);
|
||||||
|
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
$oldOrder = OrderLastHistoryService::instance()->get($order_id);
|
$oldorder = OrderHistoryService::instance()->get($order_id);
|
||||||
if(!$oldOrder){
|
if ($oldorder) {
|
||||||
$oldOrder = OrderTwoHistoryService::instance()->get($order_id);
|
|
||||||
}
|
|
||||||
if(!$oldOrder){
|
|
||||||
$oldOrder = OrderHistoryService::instance()->get($order_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($oldOrder) {
|
|
||||||
$channelService = ChannelService::instance();
|
$channelService = ChannelService::instance();
|
||||||
$oldupdate = $channelService->call('notify', $oldOrder['cid'], $request, false, $oldOrder);
|
$oldupdate = $channelService->call('notify', $oldorder['cid'], $request, false, $oldorder);
|
||||||
$merchant = MerchantService::instance()->get($oldOrder['mid']);
|
$merchant = MerchantService::instance()->get($oldorder['mid']);
|
||||||
if ($oldupdate['status'] == 3 && $oldOrder['status'] == 2 && isset($merchant['callback_repeat']) && $merchant['callback_repeat'] > 2) {
|
if ($oldupdate['status'] == 3 && $oldorder['status'] == 2 && isset($merchant['callback_repeat']) && $merchant['callback_repeat'] > 2) {
|
||||||
// # TODO 暂时写死渠道,后续需修改为可以自主选择
|
if ($oldorder['cid'] == '2') {
|
||||||
|
|
||||||
if ($oldOrder['cid'] == '2') {
|
|
||||||
OrderHistoryService::instance()->db()->where(array('order_id' => $order_id))->update(['status' => '3', 'buy_back' => '1']);
|
OrderHistoryService::instance()->db()->where(array('order_id' => $order_id))->update(['status' => '3', 'buy_back' => '1']);
|
||||||
if (isset($oldupdate['yes']) && $oldupdate['yes']) {
|
if (isset($oldupdate['yes']) && $oldupdate['yes']) {
|
||||||
echo $oldupdate['yes'];
|
echo $oldupdate['yes'];
|
||||||
@ -324,9 +314,7 @@ class Core extends Controller
|
|||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -340,11 +328,14 @@ class Core extends Controller
|
|||||||
$this->no(-104);
|
$this->no(-104);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// var_dump($order);die;
|
||||||
|
|
||||||
#识别是否重复回调
|
#识别是否重复回调
|
||||||
// $repeated
|
// $repeated
|
||||||
// if ($order[''])
|
// if ($order[''])
|
||||||
|
|
||||||
if (!$status && $request) {
|
if (!$status && $request) {
|
||||||
|
|
||||||
$channelService = ChannelService::instance();
|
$channelService = ChannelService::instance();
|
||||||
$update = $channelService->call('notify', $order['cid'], $request, false, $order);
|
$update = $channelService->call('notify', $order['cid'], $request, false, $order);
|
||||||
$merchant = MerchantService::instance()->get($order['mid']);
|
$merchant = MerchantService::instance()->get($order['mid']);
|
||||||
@ -359,8 +350,6 @@ class Core extends Controller
|
|||||||
// # TODO 暂时写死渠道,后续需修改为可以自主选择
|
// # TODO 暂时写死渠道,后续需修改为可以自主选择
|
||||||
|
|
||||||
if ($order['cid'] == '2') {
|
if ($order['cid'] == '2') {
|
||||||
|
|
||||||
|
|
||||||
$order->db()->where(array('order_id' => $order_id))->update(['status' => '3', 'buy_back' => '1']);
|
$order->db()->where(array('order_id' => $order_id))->update(['status' => '3', 'buy_back' => '1']);
|
||||||
if (isset($update['yes']) && $update['yes']) {
|
if (isset($update['yes']) && $update['yes']) {
|
||||||
echo $update['yes'];
|
echo $update['yes'];
|
||||||
@ -370,20 +359,23 @@ class Core extends Controller
|
|||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// echo '123';die;
|
||||||
|
|
||||||
|
|
||||||
if (isset($order['merchant_callback_at']) && $order['merchant_callback_at']) {
|
if (isset($order['merchant_callback_at']) && $order['merchant_callback_at']) {
|
||||||
|
echo 'fail';
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
$where[] = [
|
$where[] = [
|
||||||
'order_id', 'like', $order_id
|
'order_id', 'like', $order_id
|
||||||
];
|
];
|
||||||
|
|
||||||
$is_lj_order = Db::name('merchant_order_lj')->where($where)->find();
|
// $is_lj_order = Db::name('merchant_order_lj')->where($where)->find();
|
||||||
if ($is_lj_order) {
|
// if ($is_lj_order) {
|
||||||
$is_lj_status = false;
|
// $is_lj_status = false;
|
||||||
} else {
|
// } else {
|
||||||
$is_lj_status = true;
|
// $is_lj_status = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
if ($update['status'] == 3 && isset($merchant['stop']) && $merchant['stop'] > 2) {
|
if ($update['status'] == 3 && isset($merchant['stop']) && $merchant['stop'] > 2) {
|
||||||
@ -432,8 +424,11 @@ class Core extends Controller
|
|||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} elseif ($update['status'] == 3 && $merchant['callback_auto'] == 2 && $is_lj_status) {
|
} elseif ($update['status'] == 3 && $merchant['callback_auto'] == 2 && !$order['apply_refund']) {
|
||||||
# 该渠道下单失败,重新开始找另外一个渠道
|
# 该渠道下单失败,重新开始找另外一个渠道
|
||||||
|
$num = $order['num'] + 1;
|
||||||
|
$new_order_id = $order['order_id'] . '_' . $num;
|
||||||
|
//
|
||||||
$orderAutoService = OrderAutoService::instance();
|
$orderAutoService = OrderAutoService::instance();
|
||||||
$use = $orderAutoService->get($order['order_id']);
|
$use = $orderAutoService->get($order['order_id']);
|
||||||
$this->use_product[] = $order['pid'];
|
$this->use_product[] = $order['pid'];
|
||||||
@ -449,8 +444,8 @@ class Core extends Controller
|
|||||||
if ($new_product && $order['param']) {
|
if ($new_product && $order['param']) {
|
||||||
# 记录失败的订单信息
|
# 记录失败的订单信息
|
||||||
$orderAutoService->up($order);
|
$orderAutoService->up($order);
|
||||||
$orderAutoService->upChannelMsg($order_id, $update['status'], $update['data']);
|
$orderAutoService->upChannelMsg($order_id, $update['status'], $update['data'], $order['num']);
|
||||||
$channelService->use($order['mid'], $new_product, $order['param'], false, $order_id, $this->use_product);
|
$channelService->use($order['mid'], $new_product, $order['param'], false, $new_order_id, $this->use_product);
|
||||||
if ($die) {
|
if ($die) {
|
||||||
if (isset($update['yes']) && $update['yes']) {
|
if (isset($update['yes']) && $update['yes']) {
|
||||||
echo $update['yes'];die;
|
echo $update['yes'];die;
|
||||||
@ -470,6 +465,7 @@ class Core extends Controller
|
|||||||
$update['data'] = $request;
|
$update['data'] = $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($update && $order['merchant_callback_error'] != 1) {
|
if ($update && $order['merchant_callback_error'] != 1) {
|
||||||
//$update['order'] = $order;
|
//$update['order'] = $order;
|
||||||
$update['project_id'] = false;
|
$update['project_id'] = false;
|
||||||
|
@ -385,12 +385,12 @@ class Core extends Controller
|
|||||||
'order_id', 'like', $order_id
|
'order_id', 'like', $order_id
|
||||||
];
|
];
|
||||||
|
|
||||||
$is_lj_order = Db::name('merchant_order_lj')->where($where)->find();
|
// $is_lj_order = Db::name('merchant_order_lj')->where($where)->find();
|
||||||
if ($is_lj_order) {
|
// if ($is_lj_order) {
|
||||||
$is_lj_status = false;
|
// $is_lj_status = false;
|
||||||
} else {
|
// } else {
|
||||||
$is_lj_status = true;
|
// $is_lj_status = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
if ($update['status'] == 3 && isset($merchant['stop']) && $merchant['stop'] > 2) {
|
if ($update['status'] == 3 && isset($merchant['stop']) && $merchant['stop'] > 2) {
|
||||||
@ -439,8 +439,11 @@ class Core extends Controller
|
|||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} elseif ($update['status'] == 3 && $merchant['callback_auto'] == 2 && $is_lj_status) {
|
} elseif ($update['status'] == 3 && $merchant['callback_auto'] == 2 && !$order['apply_refund']) {
|
||||||
# 该渠道下单失败,重新开始找另外一个渠道
|
# 该渠道下单失败,重新开始找另外一个渠道
|
||||||
|
$num = $order['num'] + 1;
|
||||||
|
$new_order_id = $order['order_id'] . '_' . $num;
|
||||||
|
//
|
||||||
$orderAutoService = OrderAutoService::instance();
|
$orderAutoService = OrderAutoService::instance();
|
||||||
$use = $orderAutoService->get($order['order_id']);
|
$use = $orderAutoService->get($order['order_id']);
|
||||||
$this->use_product[] = $order['pid'];
|
$this->use_product[] = $order['pid'];
|
||||||
@ -456,8 +459,8 @@ class Core extends Controller
|
|||||||
if ($new_product && $order['param']) {
|
if ($new_product && $order['param']) {
|
||||||
# 记录失败的订单信息
|
# 记录失败的订单信息
|
||||||
$orderAutoService->up($order);
|
$orderAutoService->up($order);
|
||||||
$orderAutoService->upChannelMsg($order_id, $update['status'], $update['data']);
|
$orderAutoService->upChannelMsg($order_id, $update['status'], $update['data'], $order['num']);
|
||||||
$channelService->use($order['mid'], $new_product, $order['param'], false, $order_id, $this->use_product);
|
$channelService->use($order['mid'], $new_product, $order['param'], false, $new_order_id, $this->use_product);
|
||||||
if ($die) {
|
if ($die) {
|
||||||
if (isset($update['yes']) && $update['yes']) {
|
if (isset($update['yes']) && $update['yes']) {
|
||||||
echo $update['yes'];die;
|
echo $update['yes'];die;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user