xieruidong 2 years ago
parent
commit
098af7ec42
1 changed files with 15 additions and 5 deletions
  1. 15 5
      application/common/model/Refund.php

+ 15 - 5
application/common/model/Refund.php

@@ -59,10 +59,12 @@ class Refund Extends Model
     const TH_TYPE_NONE=0;
     const TH_TYPE_SELF_SEND=1;
     const TH_TYPE_SELF_FEE=2;
+    const TH_TYPE_FREE=3;
     public static $goodsTypes=[
         self::TH_TYPE_NONE=>'无需退货',
         self::TH_TYPE_SELF_SEND=>'自行邮寄',
         self::TH_TYPE_SELF_FEE=>'拍维修费',
+        self::TH_TYPE_FREE=>'一年以内免费保修',
     ];
 
     /**
@@ -160,7 +162,7 @@ class Refund Extends Model
                     self::REFUND_TYPE_ALL=>'退款退货',
                 ];
                 $refundConfig['type']=[
-                    self::TH_TYPE_SELF_SEND=>'自行邮寄',
+                    self::TH_TYPE_FREE=>'自行邮寄',
                 ];
                 $refundConfig['reason']=array_values(Refund::getReasons());
                 $refundConfig['req_amount']=1;
@@ -169,12 +171,20 @@ class Refund Extends Model
                 $refundConfig['refund_type']=[
                     self::REFUND_TYPE_HHBX=>'换货保修',
                 ];
-                $refundConfig['type']=[
-                    self::TH_TYPE_SELF_FEE=>'拍维修费',
-                ];
+                $refundConfig['req_order']=0;
+                #一年内
+                if(time()<strtotime('+1year',$order['send_time'])){
+                    $refundConfig['type']=[
+                        self::TH_TYPE_FREE=>'一年以内免费保修',
+                    ];
+                }else{
+                    $refundConfig['type']=[
+                        self::TH_TYPE_SELF_FEE=>'拍维修费',
+                    ];
+                    $refundConfig['req_order']=1;
+                }
                 $refundConfig['reason']=array_values(Refund::getReasons());
                 $refundConfig['req_amount']=0;
-                $refundConfig['req_order']=1;
             }
         }