egg_server/schedule/accessToken.ts
zhaoyingbo 6e65581bbf
All checks were successful
Egg CI/CD / build-image (push) Successful in 32s
Egg CI/CD / deploy (push) Successful in 37s
feat: 接入lint 和 husky
2024-07-25 01:48:22 +00:00

21 lines
603 B
TypeScript

import db from "../db"
import netTool from "../services/netTool"
const URL =
"https://open.f.mioffice.cn/open-apis/auth/v3/tenant_access_token/internal"
export const resetAccessToken = async () => {
try {
const appList = await db.appInfo.getFullList()
for (const app of appList) {
const { tenant_access_token } = await netTool.post(URL, {
app_id: app.app_id,
app_secret: app.app_secret,
})
await db.tenantAccessToken.update(app.id, app.name, tenant_access_token)
}
} catch (error) {
console.error("🚀 ~ resetAccessToken ~ error", error)
}
}