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( 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;