Ken 1 小时之前
父节点
当前提交
9873c30284
共有 1 个文件被更改,包括 19 次插入10 次删除
  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;
     }