fix: add wx-login check

This commit is contained in:
2025-04-09 01:23:08 +08:00
parent 197d6415d3
commit e5111227fd
9 changed files with 188 additions and 18 deletions

View File

@@ -24,10 +24,10 @@ export type WxToken = {
* @param code
* @returns
*/
export const fetchToken = async (code: string): Promise<WxToken> => {
export const fetchToken = async (code: string, type: 'open' | 'mp' = 'open'): Promise<WxToken> => {
let appId = config.wxOpen.appId;
let appSecret = config.wxOpen.appSecret;
if (!appId && !appSecret) {
if (type === 'mp') {
appId = config.wx.appId;
appSecret = config.wx.appSecret;
}