增加银行流水和定时任务程序
This commit is contained in:
@@ -18,12 +18,10 @@ import type { ScheduledTask } from '../types';
|
||||
const { TextArea } = Input;
|
||||
|
||||
const SCHEDULE_TYPE_OPTIONS = [
|
||||
{ value: 'external_api', label: '外部接口调用' },
|
||||
{ value: 'internal_method', label: '内部方法执行' },
|
||||
];
|
||||
|
||||
const TASK_TYPE_LABELS: Record<string, string> = {
|
||||
external_api: '外部接口',
|
||||
internal_method: '内部方法',
|
||||
};
|
||||
|
||||
@@ -78,7 +76,7 @@ const AdminScheduledTasks: React.FC = () => {
|
||||
} else {
|
||||
setEditing(null);
|
||||
form.resetFields();
|
||||
form.setFieldsValue({ is_active: true, task_type: 'external_api' });
|
||||
form.setFieldsValue({ is_active: true, task_type: 'internal_method' });
|
||||
}
|
||||
setActiveTab('basic');
|
||||
setModal(true);
|
||||
@@ -142,15 +140,13 @@ const AdminScheduledTasks: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const taskType = Form.useWatch('task_type', form);
|
||||
|
||||
const columns = [
|
||||
{ title: '任务名称', dataIndex: 'name', width: 160, ellipsis: true },
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'taskType',
|
||||
width: 100,
|
||||
render: (v: string) => <Tag color={v === 'external_api' ? 'blue' : 'purple'}>{TASK_TYPE_LABELS[v] || v}</Tag>,
|
||||
render: (v: string) => <Tag color="purple">{TASK_TYPE_LABELS[v] || v}</Tag>,
|
||||
},
|
||||
{ title: '调度表达式', dataIndex: 'schedule', width: 140, render: (v: string) => <code style={{ background: '#f1f5f9', padding: '2px 6px', borderRadius: 4 }}>{v}</code> },
|
||||
{
|
||||
@@ -194,9 +190,9 @@ const AdminScheduledTasks: React.FC = () => {
|
||||
|
||||
const scheduleHelp = (
|
||||
<div style={{ fontSize: 12, color: '#64748b', marginTop: 4 }}>
|
||||
<div>• 纯数字:间隔秒数(如 60 = 每 60 秒执行一次)</div>
|
||||
<div>• 纯数字:间隔秒数(如 3600 = 每小时执行一次)</div>
|
||||
<div>• Cron 表达式(5 字段):分 时 日 月 周</div>
|
||||
<div>• 示例:<code>* * * * *</code> = 每分钟 | <code>0 * * * *</code> = 每小时</div>
|
||||
<div>• 示例:<code>0 * * * *</code> = 每小时 | <code>0 2 * * *</code> = 每天凌晨2点</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -283,18 +279,11 @@ const AdminScheduledTasks: React.FC = () => {
|
||||
<Form.Item
|
||||
name="config"
|
||||
label="配置 JSON"
|
||||
extra={
|
||||
taskType === 'external_api'
|
||||
? '字段:url(地址)、method(GET/POST/PUT/DELETE)、headers(对象)、payload(对象/参数)、timeout(秒,默认 30)'
|
||||
: '字段:module(模块路径,如 app.services.xxx)、function(函数名)、args(参数数组)'
|
||||
}
|
||||
extra='module 和 function 指定调用的函数,其余字段作为参数传入。服务会自动翻页拉取全部流水:'
|
||||
>
|
||||
<TextArea
|
||||
rows={8}
|
||||
placeholder={taskType === 'external_api'
|
||||
? '{\n "url": "https://api.example.com/data",\n "method": "POST",\n "headers": {},\n "payload": {}\n}'
|
||||
: '{\n "module": "app.services.report",\n "function": "generate_daily_report",\n "args": []\n}'
|
||||
}
|
||||
rows={10}
|
||||
placeholder={'{\n "module": "app.services.bank.sync_service",\n "function": "sync_bank_transactions",\n "url": "http://ceshi.web.minzhong.cn/api/api/v1/internal/get-blank-transfer-acct-time",\n "api_key": "jixekCxm8piLFi0AlfA24bDtCKJ82bfu",\n "acct_no": "110972289710001",\n "start_date": "2026-08-01",\n "end_date": "2026-08-14"\n}'}
|
||||
style={{ fontFamily: 'monospace', fontSize: 13 }}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
@@ -688,7 +688,7 @@ const AdminSettings: React.FC = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<div style={{ maxWidth: 720 }}>
|
||||
<div style={{ maxWidth: 1080 }}>
|
||||
<Card variant="outlined" style={{ borderRadius: 12, border: '1px solid #f0f0f5', marginBottom: 16 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 24 }}>
|
||||
<div style={{
|
||||
|
||||
Reference in New Issue
Block a user