From bb47d67d0b325caab75e9b9739d7a507559a7fbd Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 15 May 2022 15:35:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/subscription.ts | 4 ++-- src/pages/subscription/index.tsx | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/back/services/subscription.ts b/back/services/subscription.ts index 889fabe6..7ec9a3c3 100644 --- a/back/services/subscription.ts +++ b/back/services/subscription.ts @@ -307,7 +307,7 @@ export default class SubscriptionService { for (const doc of docs) { this.handleTask(doc, false); } - await SubscriptionModel.update({ isDisabled: 1 }, { where: { id: ids } }); + await SubscriptionModel.update({ is_disabled: 1 }, { where: { id: ids } }); } public async enabled(ids: number[]) { @@ -315,7 +315,7 @@ export default class SubscriptionService { for (const doc of docs) { this.handleTask(doc); } - await SubscriptionModel.update({ isDisabled: 0 }, { where: { id: ids } }); + await SubscriptionModel.update({ is_disabled: 0 }, { where: { id: ids } }); } public async log(id: number) { diff --git a/src/pages/subscription/index.tsx b/src/pages/subscription/index.tsx index 4bbbf087..dada00e4 100644 --- a/src/pages/subscription/index.tsx +++ b/src/pages/subscription/index.tsx @@ -117,7 +117,7 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => { }, ], onFilter: (value: number, record: any) => { - if (record.isDisabled && record.status !== 0) { + if (record.is_disabled && record.status !== 0) { return value === 2; } else { return record.status === value; @@ -125,7 +125,7 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => { }, render: (text: string, record: any) => ( <> - {(!record.isDisabled || + {(!record.is_disabled || record.status !== SubscriptionStatus.idle) && ( <> {record.status === SubscriptionStatus.idle && ( @@ -143,7 +143,7 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => { )} )} - {record.isDisabled === 1 && + {record.is_disabled === 1 && record.status === SubscriptionStatus.idle && ( } color="error"> 已禁用 @@ -341,10 +341,10 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => { const enabledOrDisabledSubscription = (record: any, index: number) => { Modal.confirm({ - title: `确认${record.isDisabled === 1 ? '启用' : '禁用'}`, + title: `确认${record.is_disabled === 1 ? '启用' : '禁用'}`, content: ( <> - 确认{record.isDisabled === 1 ? '启用' : '禁用'} + 确认{record.is_disabled === 1 ? '启用' : '禁用'} 定时订阅{' '} {record.name} @@ -356,7 +356,7 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => { request .put( `${config.apiPrefix}subscriptions/${ - record.isDisabled === 1 ? 'enable' : 'disable' + record.is_disabled === 1 ? 'enable' : 'disable' }`, { data: [record.id], @@ -364,12 +364,12 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => { ) .then((data: any) => { if (data.code === 200) { - const newStatus = record.isDisabled === 1 ? 0 : 1; + const newStatus = record.is_disabled === 1 ? 0 : 1; const result = [...value]; const i = result.findIndex((x) => x.id === record.id); result.splice(i, 1, { ...record, - isDisabled: newStatus, + is_disabled: newStatus, }); setValue(result); } else { @@ -404,14 +404,14 @@ const Subscription = ({ headerStyle, isPhone, theme }: any) => { ) : ( ) } > - {record.isDisabled === 1 ? '启用' : '禁用'} + {record.is_disabled === 1 ? '启用' : '禁用'} }> 删除