|
@@ -53,24 +53,33 @@ class Rebate extends Authenticatable
|
|
|
|
|
|
|
|
protected function getHuishuiRestrictionAttribute($value)
|
|
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)
|
|
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)
|
|
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;
|
|
return $value;
|
|
|
}
|
|
}
|