1.新增获取充值/提现配置接口/api/finance/depositWithdrawConfig
2.优化充值和提现方式
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace app\admin\controller\config;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use app\common\library\game\FinanceCashierConfig as FinanceCashierConfigLib;
|
||||
use app\common\library\game\DepositTier as DepositTierLib;
|
||||
use app\common\service\GameHotDataCoordinator;
|
||||
use app\common\service\GameHotDataLock;
|
||||
@@ -21,6 +22,45 @@ class DepositTier extends Backend
|
||||
|
||||
protected array $noNeedPermission = ['index', 'save'];
|
||||
|
||||
/**
|
||||
* 读取支付货币下拉(来源:game_config.finance_cashier.currencies)。
|
||||
* 用于充值档位表单的“支付货币”选项,避免前端硬编码。
|
||||
*/
|
||||
public function currencyOptions(WebmanRequest $request): Response
|
||||
{
|
||||
$response = $this->initializeBackend($request);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
if (!$this->hasNodePermission($request, 'index')) {
|
||||
return $this->error(__('You have no permission'), [], 401);
|
||||
}
|
||||
if ($request->method() !== 'GET') {
|
||||
return $this->error(__('Parameter error'));
|
||||
}
|
||||
$row = Db::name('game_config')->where('config_key', FinanceCashierConfigLib::CONFIG_KEY)->find();
|
||||
$cfg = FinanceCashierConfigLib::parseFromConfigValue($row['config_value'] ?? null);
|
||||
$currencies = [];
|
||||
if (isset($cfg['currencies']) && is_array($cfg['currencies'])) {
|
||||
foreach ($cfg['currencies'] as $item) {
|
||||
if (!is_array($item)) {
|
||||
continue;
|
||||
}
|
||||
$code = isset($item['code']) && is_string($item['code']) ? strtoupper(trim($item['code'])) : '';
|
||||
if ($code === '') {
|
||||
continue;
|
||||
}
|
||||
$currencies[] = $code;
|
||||
}
|
||||
}
|
||||
$currencies = array_values(array_unique($currencies));
|
||||
if ($currencies === []) {
|
||||
$currencies = ['MYR', 'CNY', 'USD', 'USDT', 'VND', 'THB', 'SGD', 'IDR'];
|
||||
}
|
||||
|
||||
return $this->success('', ['list' => $currencies]);
|
||||
}
|
||||
|
||||
private function hasNodePermission(WebmanRequest $request, string $action): bool
|
||||
{
|
||||
if (!$this->auth) {
|
||||
|
||||
Reference in New Issue
Block a user