From dc12e89aea6f615c2ab69b703a906c8a1ad2d090 Mon Sep 17 00:00:00 2001 From: gnomeshgh <18153063927@163.com> Date: Tue, 23 Sep 2025 22:06:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90Infra=E3=80=91perf:=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=9A=84=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=BD=BF=E7=94=A8function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/infra/autocode/gencode/index.ts | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/web-antd/src/api/infra/autocode/gencode/index.ts b/apps/web-antd/src/api/infra/autocode/gencode/index.ts index b79d1d537..0cac76727 100644 --- a/apps/web-antd/src/api/infra/autocode/gencode/index.ts +++ b/apps/web-antd/src/api/infra/autocode/gencode/index.ts @@ -1,17 +1,18 @@ import { requestClient } from '#/api/request'; -export const genCodeApi = { - /** - * 获取自动生成的编号 - * @param ruleCode 规则代码 - * @param inputCharacter 输入字符(可选) - * @returns 生成的编号字符串 - */ - getAutoCode: async (ruleCode: string, inputCharacter?: string) => { - // 根据是否有输入字符拼接不同的URL +/** + * 自动生成编码规则 API + */ +export function genCodeApi() { + async function getAutoCode( + ruleCode: string, + inputCharacter?: string, + ): Promise { const url = inputCharacter ? `/infra/auto-code/get/${ruleCode}/${inputCharacter}` : `/infra/auto-code/get/${ruleCode}`; - return await requestClient.get(url); - }, -}; + return requestClient.get(url); + } + + return { getAutoCode }; +}