修改提现配置

This commit is contained in:
邹景立 2021-03-17 11:30:33 +08:00
parent 382917a96d
commit 333b600613
2 changed files with 68 additions and 14 deletions

View File

@ -0,0 +1,50 @@
<?php
namespace app\data\controller\api\auth;
use app\data\controller\api\Auth;
use app\data\controller\UserTransfer;
use app\data\service\UserTransferService;
use think\admin\extend\CodeExtend;
/**
* 用户提现接口
* Class Transfer
* @package app\data\controller\api\auth
*/
class Transfer extends Auth
{
/**
* 绑定数据表
* @var string
*/
private $table = 'DataUserTransfer';
public function add()
{
$data = $this->_vali([
'code.value' => CodeExtend::uniqidDate(20, 'T'),
'type.require' => '提现方式不能为空!',
'amount.require' => '提现金额不能为空!',
]);
$chargeRate = floatval(UserTransferService::instance()->config('transfer_charge'));
$chargeAmount = $chargeRate * $data['amount'];
}
public function get()
{
}
/**
* 获取用户提现配置
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function config()
{
$data = UserTransferService::instance()->config();
$this->success('获取用户提现配置', $data);
}
}

View File

@ -14,14 +14,14 @@
<div class="layui-form-item relative block">
<span class="color-green font-w7 label-required-prev">用户提现状态</span>
<span class="color-desc margin-left-5">Transfer State</span>
<span class="color-desc margin-left-5">Transfer Status</span>
<div class="layui-textarea" style="min-height:auto;padding:10px 0 13px 18px">
{php} $data['transfer_state'] = $data['transfer_state'] ?? 0; {/php}
{php} $data['status'] = $data['status'] ?? 0; {/php}
{foreach ['关闭用户提现', '开启用户提现'] as $k => $v}
{if $data.transfer_state eq $k}
<input checked class="layui-input layui-bg-gray" type="radio" title="{$v}" name="transfer_state" value="{$k}">
{if $data.status eq $k}
<input checked class="layui-input layui-bg-gray" type="radio" title="{$v}" name="status" value="{$k}">
{else}
<input class="layui-input layui-bg-gray" type="radio" title="{$v}" name="transfer_state" value="{$k}">
<input class="layui-input layui-bg-gray" type="radio" title="{$v}" name="status" value="{$k}">
{/if}{/foreach}
</div>
</div>
@ -29,7 +29,7 @@
<label class="layui-form-item relative block">
<span class="color-green font-w7 label-required-prev">提现手续费配置</span>
<span class="color-desc margin-left-5">Transfer Charge</span>
<input name="transfer_charge" class='layui-input' data-value-min="0.0000" data-value-max="50.0000" data-blur-number="4" value='{$data.transfer_charge|default="0.0000"}'>
<input name="charge" class='layui-input' data-value-min="0.0000" data-value-max="50.0000" data-blur-number="4" value='{$data.charge|default="0.0000"}'>
<span class='help-block'>请输入提现金额的百分比,费率的取值范围为 0.0000% - 50.0000%</span>
</label>
@ -50,32 +50,36 @@
{foreach $types as $k => $t}
<tr class="think-bg-white">
<td class="nowrap">
{php} $key = 'transfer_'.$k.'_state'; {/php}
{if isset($data[$key]) and $data[$key] eq 1}
{php} $key = 'items['.$k.']["state"]'; {/php}
<input type="hidden" name="{$key}" value="0">
{if isset($data['items'][$k]['state']) and $data['items'][$k]['state'] eq 1}
<input checked type="checkbox" name="{$key}" value="1" lay-skin="primary" title="{$t}">
{else}
<input type="checkbox" name="{$key}" value="1" lay-skin="primary" title="{$t}">
{/if}
</td>
<td class="text-center" style="width:80px">
{php} $key = 'transfer_'.$k.'_audit'; {/php}
{if isset($data[$key]) and $data[$key] eq 1}
{php} $key = 'items['.$k.']["audit"]'; {/php}
<input type="hidden" name="{$key}" value="0">
{if isset($data['items'][$k]['audit']) and $data['items'][$k]['audit'] eq 1}
<input checked type="checkbox" name="{$key}" value="1" lay-skin="switch" lay-text="需审核|免审核">
{else}
<input type="checkbox" name="{$key}" value="1" lay-skin="switch" lay-text="需审核|免审核">
{/if}
{php} $key = 'items['.$k.'][title]'; {/php}
<input type="hidden" class="layui-input" name="{$key}" value="{$t}">
</td>
<td class="text-center">
<label>
{php} $key = 'transfer_'.$k.'_min'; {/php}
<input placeholder="" class="layui-input" data-blur-number="2" name="{$key}" value="{$data[$key] ?? '1.00'}">
{php} $key = 'items['.$k.'][minAmount]'; {/php}
<input placeholder="" class="layui-input" data-blur-number="2" name="{$key}" value="{$data['items'][$k]['minAmount'] ?? '1.00'}">
</label>
</td>
<td class="text-center">-</td>
<td class="text-center">
<label>
{php} $key = 'transfer_'.$k.'_max'; {/php}
<input placeholder="" class="layui-input" data-blur-number="2" name="{$key}" value="{$data[$key] ?? '2000.00'}">
{php} $key = 'items['.$k.'][maxAmount]'; {/php}
<input placeholder="" class="layui-input" data-blur-number="2" name="{$key}" value="{$data['items'][$k]['maxAmount'] ?? '2000.00'}">
</label>
</td>
</tr>