diff --git a/app/data/service/RebateService.php b/app/data/service/RebateService.php index 6c69f6a3f..dbc4a0269 100644 --- a/app/data/service/RebateService.php +++ b/app/data/service/RebateService.php @@ -262,11 +262,16 @@ class RebateService extends Service $key = "{$this->user['vip_code']}"; $map = ['type' => self::PRIZE_03, 'order_no' => $this->order['order_no'], 'order_uid' => $this->order['uid']]; if ($this->config("direct_state_vip_{$key}") && $this->app->db->name($this->table)->where($map)->count() < 1) { - $rate = $this->config("direct_value_vip_{$key}"); - $name = "{$this->name(self::PRIZE_03)},订单 {$rate}%"; - $amount = floatval($rate * $this->order['rebate_amount'] / 100); + $value = $this->config("direct_value_vip_{$key}"); + if ($this->config("direct_type_vip_{$key}") == 1) { + $val = floatval($value ?: '0.00'); + $name = "{$this->name(self::PRIZE_03)},每人 {$val} 元"; + } else { + $val = floatval($value * $this->order['rebate_amount'] / 100); + $name = "{$this->name(self::PRIZE_03)},订单 {$value}%"; + } // 写入返利记录 - $this->writeRabate($this->from1['id'], $map, $name, $amount); + $this->writeRabate($this->from1['id'], $map, $name, $val); } return true; } @@ -285,11 +290,16 @@ class RebateService extends Service $key = "{$this->user['vip_code']}"; $map = ['type' => self::PRIZE_04, 'order_no' => $this->order['order_no'], 'order_uid' => $this->order['uid']]; if ($this->config("indirect_state_vip_{$key}") && $this->app->db->name($this->table)->where($map)->count() < 1) { - $rate = $this->config("indirect_value_vip_{$key}"); - $name = "{$this->name(self::PRIZE_04)},订单 {$rate}%"; - $amount = floatval($rate * $this->order['rebate_amount'] / 100); + $value = $this->config("indirect_value_vip_{$key}"); + if ($this->config("indirect_type_vip_{$key}") == 1) { + $val = floatval($value ?: '0.00'); + $name = "{$this->name(self::PRIZE_03)},每人 {$val} 元"; + } else { + $val = floatval($value * $this->order['rebate_amount'] / 100); + $name = "{$this->name(self::PRIZE_03)},订单 {$value}%"; + } // 写入返利记录 - $this->writeRabate($this->from2['id'], $map, $name, $amount); + $this->writeRabate($this->from2['id'], $map, $name, $val); } return true; } diff --git a/app/data/view/user/rebate/config.html b/app/data/view/user/rebate/config.html index c5e966abd..2c6f1278e 100644 --- a/app/data/view/user/rebate/config.html +++ b/app/data/view/user/rebate/config.html @@ -183,10 +183,17 @@ {/if}
+ {php} $key = 'direct_type_vip_'.$level['number']; {/php} + {php} $data[$key] = $data[$key] ?? 1; {/php} + {foreach [1 => '奖励固定金额 / 每单',2 => '按订单参与的返利金额比例'] as $k => $v} + {if isset($data[$key]) and $data[$key] eq $k} + + {else} + + {/if}{/foreach} {php} $key = 'direct_value_vip_'.$level['number']; {/php} -
@@ -205,10 +212,17 @@ {/if}
+ {php} $key = 'indirect_type_vip_'.$level['number']; {/php} + {php} $data[$key] = $data[$key] ?? 1; {/php} + {foreach [1 => '奖励固定金额 / 每单',2 => '按订单参与的返利金额比例'] as $k => $v} + {if isset($data[$key]) and $data[$key] eq $k} + + {else} + + {/if}{/foreach} {php} $key = 'indirect_value_vip_'.$level['number']; {/php} -