zhaoyingbo d9d758c6ee
All checks were successful
Egg CI/CD / build-image (push) Successful in 1m6s
Egg CI/CD / deploy (push) Successful in 1m7s
feat: 支持多租户使用
2024-06-14 04:34:37 +00:00

30 lines
575 B
TypeScript

import pbClient from "../pbClient";
import { managePb404 } from "../../utils/pbTools";
import { DB } from "../../types";
/**
* 获取配置
* @param key
* @returns
*/
const get = async (key: string) => {
const config = await managePb404<DB.AppConfig>(
async () =>
await await pbClient.collection("config").getFirstListItem(`key='${key}'`)
);
return config;
};
const getVal = async (key: string) => {
const config = await get(key);
if (!config) return "";
return config.value;
};
const appConfig = {
get,
getVal,
};
export default appConfig;