🚧 refactoring is ongoing

This commit is contained in:
Song
2021-01-17 10:49:19 +08:00
parent aa2635afcd
commit 22975603c6
20 changed files with 327 additions and 199 deletions
+25
View File
@@ -0,0 +1,25 @@
const { User } = require('../models');
const tokenStore = new Map();
async function initializeTokenStore() {
const users = await User.findAll();
users.forEach((user) => {
if (user.wechatAppId) {
tokenStore.set(user.prefix, {
appId: user.wechatAppId,
appSecret: user.wechatAppSecret,
templateId: user.wechatTemplateId,
openId: user.wechatOpenId,
token: '',
});
}
});
console.debug(tokenStore);
console.log('Token store initialized.');
}
module.exports = {
initializeTokenStore,
tokenStore,
};