【Infra】perf: 接口的代码格式调整使用function

pull/215/head
gnomeshgh 2025-09-23 22:06:00 +08:00
parent a7a33530e6
commit dc12e89aea
1 changed files with 13 additions and 12 deletions

View File

@ -1,17 +1,18 @@
import { requestClient } from '#/api/request'; import { requestClient } from '#/api/request';
export const genCodeApi = {
/** /**
* 获取自动生成的编号 * 自动生成编码规则 API
* @param ruleCode 规则代码
* @param inputCharacter 输入字符(可选)
* @returns 生成的编号字符串
*/ */
getAutoCode: async (ruleCode: string, inputCharacter?: string) => { export function genCodeApi() {
// 根据是否有输入字符拼接不同的URL async function getAutoCode(
ruleCode: string,
inputCharacter?: string,
): Promise<string> {
const url = inputCharacter const url = inputCharacter
? `/infra/auto-code/get/${ruleCode}/${inputCharacter}` ? `/infra/auto-code/get/${ruleCode}/${inputCharacter}`
: `/infra/auto-code/get/${ruleCode}`; : `/infra/auto-code/get/${ruleCode}`;
return await requestClient.get<string>(url); return requestClient.get<string>(url);
}, }
};
return { getAutoCode };
}