feat: alchemy
This commit is contained in:
@@ -202,20 +202,26 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
var versionBlock = (isAdmin && creating)
|
||||
? '<div class="layui-form-item"><label class="layui-form-label">版本</label><div class="layui-input-block">' +
|
||||
'<select name="builder_type" id="LAY-ch-builder-type" lay-filter="LAY-ch-builder-type">' +
|
||||
'<option value="new"' + (!isApp ? ' selected' : '') + '>新版(生成静态资源)</option>' +
|
||||
'<option value="new"' + (!isApp && values.builder_type !== 'old' ? ' selected' : '') + '>新版(生成静态资源)</option>' +
|
||||
'<option value="old"' + (values.builder_type === 'old' ? ' selected' : '') + '>旧版(生成静态资源 / web 目录)</option>' +
|
||||
'<option value="app"' + (isApp ? ' selected' : '') + '>App(仅记录,UUID 渠道 ID)</option>' +
|
||||
'</select></div></div>'
|
||||
: '';
|
||||
|
||||
// Channel ID block: App uses auto-generated UUID (read-only); new uses X.Y.ZZ input
|
||||
// Channel ID block: App=auto UUID (readonly); old=auto 32-hex (readonly); new=X.Y.ZZ input
|
||||
var isOld = values.builder_type === 'old';
|
||||
var channelBlock = creating
|
||||
? (isApp
|
||||
? '<div class="layui-form-item"><label class="layui-form-label">渠道 ID</label><div class="layui-input-block">' +
|
||||
'<input name="channel_id" class="layui-input" readonly id="LAY-ch-id-input" value="' + (values.channel_id || '') + '" placeholder="自动生成 UUID">' +
|
||||
'<button type="button" class="layui-btn layui-btn-primary" id="LAY-ch-rand" style="margin-left:6px;">随机</button></div></div>'
|
||||
: '<div class="layui-form-item"><label class="layui-form-label">渠道 ID</label><div class="layui-input-block">' +
|
||||
'<input name="channel_id" class="layui-input" maxlength="6" id="LAY-ch-id-input" style="width:70%;display:inline-block;" value="' + (values.channel_id || '') + '" placeholder="例如 A.B.C1 或 3.1.07">' +
|
||||
'<button type="button" class="layui-btn layui-btn-primary" id="LAY-ch-rand" style="margin-left:6px;">随机</button></div></div>')
|
||||
: (isOld
|
||||
? '<div class="layui-form-item"><label class="layui-form-label">渠道 ID</label><div class="layui-input-block">' +
|
||||
'<input name="channel_id" class="layui-input" readonly id="LAY-ch-id-input" style="width:70%;display:inline-block;" value="' + (values.channel_id || '') + '" placeholder="自动生成 32 位 hex">' +
|
||||
'<button type="button" class="layui-btn layui-btn-primary" id="LAY-ch-rand" style="margin-left:6px;">随机</button></div></div>'
|
||||
: '<div class="layui-form-item"><label class="layui-form-label">渠道 ID</label><div class="layui-input-block">' +
|
||||
'<input name="channel_id" class="layui-input" maxlength="6" id="LAY-ch-id-input" style="width:70%;display:inline-block;" value="' + (values.channel_id || '') + '" placeholder="例如 A.B.C1 或 3.1.07">' +
|
||||
'<button type="button" class="layui-btn layui-btn-primary" id="LAY-ch-rand" style="margin-left:6px;">随机</button></div></div>'))
|
||||
: '<div class="layui-form-item"><label class="layui-form-label">渠道 ID</label><div class="layui-input-block"><input class="layui-input" readonly value="' + (values.channel_id || '') + '"></div></div>';
|
||||
|
||||
// App-specific fields: app_name + bundle_id
|
||||
@@ -246,7 +252,7 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
'<div class="layui-form-item"><label class="layui-form-label">状态</label><div class="layui-input-block">' +
|
||||
'<input type="checkbox" name="status_switch" lay-skin="switch" lay-text="启用|禁用" ' + ((values.status == null || values.status == 1) ? 'checked' : '') + '>' +
|
||||
'</div></div>' +
|
||||
(creating && isAdmin ? '<div class="layui-form-item"><div class="layui-input-block" style="color:#888;font-size:12px;">新版将调用 builder 生成静态资源;App 仅创建数据库记录。代理最多 ' + maxPerAgent + ' 条。</div></div>' : '') +
|
||||
(creating && isAdmin ? '<div class="layui-form-item"><div class="layui-input-block" style="color:#888;font-size:12px;">新版/旧版均调用 builder 生成静态资源(新版→channel/ 目录,旧版→web/ 目录);App 仅创建数据库记录。代理最多 ' + maxPerAgent + ' 条。</div></div>' : '') +
|
||||
'</form>',
|
||||
success: function () {
|
||||
form.render();
|
||||
@@ -256,11 +262,13 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
if (res.code === 0) $('#LAY-ch-form input[name=channel_id]').val(res.data.channel_id);
|
||||
});
|
||||
});
|
||||
// Auto-generate UUID when switching to App
|
||||
// Auto-generate UUID when switching to App; 32-hex when switching to Old
|
||||
form.on('select(LAY-ch-builder-type)', function (data) {
|
||||
var isAppNow = data.value === 'app';
|
||||
var v = data.value;
|
||||
var isAppNow = v === 'app';
|
||||
var isOldNow = v === 'old';
|
||||
$('.LAY-ch-app-only').toggle(isAppNow);
|
||||
$('.LAY-ch-new-only').toggle(!isAppNow);
|
||||
$('.LAY-ch-new-only').toggle(!isAppNow); // template shown for new + old
|
||||
var idInput = $('#LAY-ch-id-input');
|
||||
if (isAppNow) {
|
||||
idInput.attr('readonly', true).attr('maxlength', '').attr('placeholder', '自动生成 UUID');
|
||||
@@ -269,6 +277,13 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
if (res.code === 0) idInput.val(res.data.channel_id);
|
||||
});
|
||||
}
|
||||
} else if (isOldNow) {
|
||||
idInput.attr('readonly', true).attr('maxlength', '').attr('placeholder', '自动生成 32 位 hex');
|
||||
if (!idInput.val()) {
|
||||
$.getJSON(@json(route('admin.channels.randomId')) + '?builder_type=old', function (res) {
|
||||
if (res.code === 0) idInput.val(res.data.channel_id);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
idInput.removeAttr('readonly').attr('maxlength', '6').attr('placeholder', '例如 A.B.C1 或 3.1.07').val('');
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
html += '<div class="mn-wallet-body"><table class="mn-wallet-table"><thead><tr>' +
|
||||
'<th>ID</th><th>Chain</th><th>地址</th><th>Index</th>' +
|
||||
'<th>USDT</th><th>TRX</th><th>ETH</th><th>BTC</th><th>BNB</th><th>SOL</th>' +
|
||||
'<th>操作</th>' +
|
||||
'</tr></thead><tbody>';
|
||||
rows.forEach(function (r) {
|
||||
var inactive = r.active === false;
|
||||
@@ -193,6 +194,7 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
'<td class="coin-cell">' + coinVal(r.btc) + '</td>' +
|
||||
'<td class="coin-cell">' + coinVal(r.bnb) + '</td>' +
|
||||
'<td class="coin-cell">' + coinVal(r.sol) + '</td>' +
|
||||
'<td>—</td>' +
|
||||
'</tr>';
|
||||
});
|
||||
html += '</tbody></table></div></div>';
|
||||
|
||||
Reference in New Issue
Block a user