完整版V1 加入爬虫功能

This commit is contained in:
root
2026-06-09 03:36:30 +08:00
parent 34d76cce74
commit a68b83fcbd
69 changed files with 5058 additions and 56 deletions
+19 -1
View File
@@ -8,6 +8,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
add_url: 'split.number/add',
edit_url: 'split.number/edit',
del_url: 'split.number/del',
multi_url: 'split.number/multi',
table: 'split_number',
}
});
@@ -41,11 +42,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
{field: 'visit_count', title: __('Visit_count'), operate: false, sortable: true},
{field: 'inbound_count', title: __('Inbound_count'), operate: false, sortable: true},
{
field: 'platform_status',
title: __('Platform_status'),
searchList: Config.platformStatusList,
formatter: Controller.api.formatter.platformStatus
},
{
field: 'status',
title: __('Status'),
searchList: Config.statusList,
formatter: Table.api.formatter.status
formatter: Table.api.formatter.toggle,
yes: 'normal',
no: 'hidden'
},
{
field: 'createtime',
@@ -95,6 +104,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Controller.api.bindevent();
},
api: {
formatter: {
platformStatus: function (value, row) {
var text = row.platform_status_text != null && row.platform_status_text !== ''
? String(row.platform_status_text)
: (Config.platformStatusList && Config.platformStatusList[value] ? Config.platformStatusList[value] : value);
var cls = value === 'online' ? 'success' : (value === 'offline' ? 'default' : 'warning');
return '<span class="text-' + cls + '">' + Fast.api.escape(text || '') + '</span>';
}
},
bindevent: function () {
Form.api.bindevent($('form[role=form]'));
Controller.api.fixSelectPlaceholder();
+57 -2
View File
@@ -29,14 +29,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
field: 'ticket_type',
title: __('Ticket_type'),
searchList: Config.ticketTypeList,
formatter: Table.api.formatter.normal
operate: false,
formatter: Controller.api.formatter.ticketTypePlain
},
{field: 'ticket_name', title: __('Ticket_name'), operate: 'LIKE'},
{
field: 'link_code_text',
title: __('Split_link_id'),
operate: false,
formatter: Table.api.formatter.content
formatter: Controller.api.formatter.splitLinkCode
},
{
field: 'start_time_text',
@@ -116,6 +117,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
});
Table.api.bindevent(table);
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
var ids = Table.api.selectedids(table);
$('.btn-sync').toggleClass('btn-disabled disabled', ids.length === 0);
});
$('.btn-sync').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
var ids = Table.api.selectedids(table);
if (!ids.length) {
Toastr.error(__('Please select at least one record'));
return false;
}
Layer.confirm(__('Sync running'), {icon: 3, title: __('Sync_status_btn')}, function (index) {
Layer.close(index);
var loadIdx = Layer.load(1, {shade: [0.3, '#000']});
Fast.api.ajax({
url: 'split.ticket/sync',
data: {ids: ids.join(',')}
}, function (data, ret) {
Layer.close(loadIdx);
table.bootstrapTable('refresh');
return false;
}, function () {
Layer.close(loadIdx);
});
});
return false;
});
},
add: function () {
Controller.api.bindevent();
@@ -125,6 +156,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
api: {
formatter: {
/**
* 工单类型:纯文本展示,无链接/标签样式
*/
ticketTypePlain: function (value, row) {
var text = row.ticket_type_text != null && row.ticket_type_text !== ''
? String(row.ticket_type_text)
: (value != null ? String(value) : '');
if (text === '') {
return '<span class="text-muted">-</span>';
}
return '<span class="split-ticket-type-plain">' + Fast.api.escape(text) + '</span>';
},
/**
* 分流链接:纯文本 + 边框背景标记,不可点击
*/
splitLinkCode: function (value) {
value = value == null ? '' : String(value);
if ($.trim(value) === '') {
return '<span class="text-muted">-</span>';
}
var safe = Fast.api.escape(value);
return '<span class="split-ticket-link-badge" style="display:inline-block;max-width:100%;padding:2px 8px;font-size:12px;line-height:1.5;color:#555;background:#f5f5f5;border:1px solid #ddd;border-radius:3px;word-break:break-all;">'
+ safe + '</span>';
},
speedPerHour: function (value) {
var num = parseFloat(value);
if (isNaN(num)) {