|
|
@@ -273,7 +273,23 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
{
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
- $order = \app\common\model\recharge\RechargeOrder::where('id',$params['order_id'])->findOrEmpty();
|
|
|
+ $order = \app\common\model\recharge\RechargeOrder::where('sn',$params['sn'])->findOrEmpty();
|
|
|
+ if ($order->isEmpty()) {
|
|
|
+ throw new Exception('订单不存在');
|
|
|
+ }
|
|
|
+ //判断订单类型.服务订单尾款处理
|
|
|
+ if($order['order_type'] == 0 and $order['pay_status'] == PayEnum::ISPAID)//服务工单
|
|
|
+ {
|
|
|
+ $order = RechargeOrder::where(['work_id'=>$order['work_id'],'pay_status'=>0])->findOrEmpty();
|
|
|
+ if($order->isEmpty()){
|
|
|
+ throw new Exception('订单已支付');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($order['pay_status'] == PayEnum::ISPAID) {
|
|
|
+ throw new Exception('订单已支付');
|
|
|
+ }
|
|
|
+
|
|
|
if(!empty($order['coupon_id'])){
|
|
|
$user_coupon_ed = UserCoupon::findOrEmpty($order['coupon_id']);
|
|
|
$user_coupon_ed->voucher_count = $user_coupon_ed->voucher_count+1;
|