Ken 2 órája
szülő
commit
9873c30284
1 módosított fájl, 19 hozzáadás és 10 törlés
  1. 19 10
      app/Models/Rebate.php

+ 19 - 10
app/Models/Rebate.php

@@ -53,24 +53,33 @@ class Rebate extends Authenticatable
 
     protected function getHuishuiRestrictionAttribute($value)
     {
-        $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
-        return $huishui_restriction;
+        if ($this->status == 0) {
+            $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
+            return $huishui_restriction;
+        }
+        return $value;
+
     }
 
     protected function getHuishuiPercentageAttribute($value)
     {
-        $huishui_percentage = Config::where('field', 'huishui_percentage')->first()->val;
-        return $huishui_percentage;
+        if ($this->status == 0) {
+            $huishui_percentage = Config::where('field', 'huishui_percentage')->first()->val;
+            return $huishui_percentage;
+        }
+        return $value;
     }
 
     protected function getHuishuiAmountAttribute($value)
     {
-        $value = 0;
-        $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
-        $huishui_percentage = Config::where('field', 'huishui_percentage')->first()->val;
-        $lose = $this->profit * -1;
-        if ($lose >= $huishui_restriction) {
-            $value = bcmul($lose, $huishui_percentage, 2); // 返利金额
+        if ($this->status == 0) {
+            $value = 0;
+            $huishui_restriction = Config::where('field', 'huishui_restriction')->first()->val;
+            $huishui_percentage = Config::where('field', 'huishui_percentage')->first()->val;
+            $lose = $this->profit * -1;
+            if ($lose >= $huishui_restriction) {
+                $value = bcmul($lose, $huishui_percentage, 2); // 返利金额
+            }
         }
         return $value;
     }