zilong 4 năm trước cách đây
mục cha
commit
012c25801d
2 tập tin đã thay đổi với 4 bổ sung5 xóa
  1. 1 2
      app/Models/Order.php
  2. 3 3
      app/Models/OrderPack.php

+ 1 - 2
app/Models/Order.php

xqd
@@ -262,8 +262,7 @@ class Order extends BaseModel
             if ($order['payment_type'] == 3) {
                 //退服务包的次数
                 $map = [1 => 'phone_minutes', 2 => 'chat_num', 3 => 'appoint_num', 4 => 'vaccine_limit_amount', 5 => 'nurses_limit_amount'];
-                $addNum = $order['product_type'] == 1 ? 10 : 1;
-                OrderPack::where('id', $order['pay_order_pack_id'])->increment($map[$order['product_type']], $addNum);
+                OrderPack::where('id', $order['pay_order_pack_id'])->increment($map[$order['product_type']]);
                 $updateOrder['cancel_time'] = time();
                 $updateOrder['payment_status'] = 4;
                 if ($order['product_type'] == 3 && !$can_refund) {

+ 3 - 3
app/Models/OrderPack.php

xqd xqd
@@ -59,8 +59,8 @@ class OrderPack extends BaseModel
         }
 
         if ($product_type == 1) {
-            if ($data['phone_minutes'] < 10) {
-                exit_out(null, 10003, '服务包的电话咨询时间不足');
+            if ($data['phone_minutes'] <= 0) {
+                exit_out(null, 10003, '服务包的电话咨询次数不足');
             }
         }
         elseif ($product_type == 2) {
@@ -90,7 +90,7 @@ class OrderPack extends BaseModel
     public static function deductPackData($order_pack_id, $product_type)
     {
         if ($product_type == 1) {
-            self::where('id', $order_pack_id)->decrement('phone_minutes', 10);
+            self::where('id', $order_pack_id)->decrement('phone_minutes');
         }
         elseif ($product_type == 2) {
             self::where('id', $order_pack_id)->decrement('chat_num');