| 1234567891011121314151617181920212223242526 |
- <?php
- namespace App\Services\Agent;
- use Illuminate\Support\Facades\DB;
- /** 代理充值、提现沿用会员 USDT 的汇率口径:充值用 exchange_rate_rmb,提现再加 exchange_rate_difference。 */
- final class AgentExchangeRate
- {
- public static function recharge(): string
- {
- return self::value('exchange_rate_rmb', '1');
- }
- public static function withdraw(): string
- {
- return bcadd(self::recharge(), self::value('exchange_rate_difference', '0'), 4);
- }
- private static function value(string $field, string $default): string
- {
- $value = DB::table('config')->where('field', $field)->value('val');
- $value = is_numeric($value) ? (string) $value : $default;
- return bcadd($value, '0', 4);
- }
- }
|