1
This commit is contained in:
@@ -467,4 +467,78 @@ class DetectionService extends BaseService
|
||||
$result['data']['inquiry_no'] = (string)$order_detection['detection_no']; // 订单编号
|
||||
return success($result);
|
||||
}
|
||||
|
||||
// 取消未支付检测订单
|
||||
public function cancelUnpayDetectionOrder(string|int $order_no, string|int $cancel_reason, string|int $cancel_remarks){
|
||||
$result = array();
|
||||
$result['status'] = 1;
|
||||
$result['message'] = "成功";
|
||||
|
||||
// 获取检测订单数据
|
||||
$params = array();
|
||||
$params['detection_no'] = $order_no;
|
||||
$order_detection = OrderDetection::getOne($params);
|
||||
if (empty($order_detection)){
|
||||
$result['status'] = 0;
|
||||
$result['message'] = "取消未支付的检测订单失败:未查询到对应订单数据";
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
if ($order_detection['detection_status'] == 5) {
|
||||
// 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
|
||||
$result['status'] = 2;
|
||||
$result['message'] = "取消未支付的检测订单:订单已取消";
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ($order_detection['detection_status'] != 1) {
|
||||
// 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
|
||||
$result['status'] = 0;
|
||||
$result['message'] = "取消未支付的检测订单:订单状态为" . $order_detection['detection_status'] . "无法执行";
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 检测订单退款状态
|
||||
if (!in_array($order_detection['detection_refund_status'], [0, 4, 5])) {
|
||||
// 检测订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||
$result['status'] = 0;
|
||||
$result['message'] = "取消未支付的检测订单:订单正在退款中";
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 检测订单支付状态
|
||||
if ($order_detection['detection_pay_status'] == 2) {
|
||||
// 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
$result['status'] = 2;
|
||||
$result['message'] = "取消未支付的检测订单:订单已支付";
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 检测订单删除状态
|
||||
if ($order_detection['is_delete'] == 1) {
|
||||
// 删除状态(0:否 1:是)
|
||||
$result['status'] = 2;
|
||||
$result['message'] = "取消未支付的检测订单:订单已被删除";
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 取消检测订单
|
||||
$data = array();
|
||||
$data['detection_status'] = 5; // 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消)
|
||||
if ($cancel_reason == 3){
|
||||
$data['detection_pay_status'] = 5; // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
}
|
||||
|
||||
$data['cancel_time'] = date("Y-m-d H:i:s", time());
|
||||
$data['cancel_reason'] = $cancel_reason; // 取消订单原因(1:主动取消 2:客服取消 3:支付超时)
|
||||
$data['cancel_remarks'] = $cancel_remarks; // 取消订单备注
|
||||
$data['updated_at'] = date("Y-m-d H:i:s", time());
|
||||
|
||||
$params = array();
|
||||
$params['order_detection_id'] = $order_detection['order_detection_id'];
|
||||
OrderDetection::editOrderDetection($params,$data);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user