zhaoyingbo b7437f47e4
All checks were successful
Egg CI/CD / build-image (push) Successful in 49s
Egg CI/CD / deploy (push) Successful in 23s
feat: 优化请求处理 & 拆分Type
2024-06-08 09:15:14 +00:00

38 lines
705 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}'`)
);
if (!config) return "";
return config.value;
};
/**
* 获取Appid
* @returns {string} Appid
*/
const getAppId = async () => get("app_id");
/**
* 获取AppSecret
* @returns {string} AppSecret
*/
const getAppSecret = async () => get("app_secret");
const appConfig = {
get,
getAppId,
getAppSecret,
};
export default appConfig;