Commit 5c06e9c5 by 宋毅

tj

parent bb87b063
...@@ -15,11 +15,17 @@ class AppTokenByHostsCache extends CacheBase { ...@@ -15,11 +15,17 @@ class AppTokenByHostsCache extends CacheBase {
return settings.cacheprefix + "_accesskey:"; return settings.cacheprefix + "_accesskey:";
} }
async buildCacheVal(cachekey, inputkey, val, ex, ...items) { async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var app_hosts = inputkey; var actionBody = val;
if (!app_hosts) { if (!actionBody) {
return system.getResult(null, "app_hosts can not be empty !"); return system.getResult(null, "actionBody can not be empty !");
}
var item = null;
if (actionBody.reqType == "hosts") {
item = await this.appDao.getItemByHosts(actionBody.appHosts);
}
if (actionBody.reqType == "appkey") {
item = await this.appDao.getItemByAppKey(actionBody.appkey, actionBody.secret);
} }
var item = await this.appDao.getItemByHosts(app_hosts);
if (!item) { if (!item) {
return system.getResult(null, "app_hosts to data is empty !"); return system.getResult(null, "app_hosts to data is empty !");
} }
......
...@@ -24,5 +24,26 @@ class AppDao extends Dao { ...@@ -24,5 +24,26 @@ class AppDao extends Dao {
raw: true raw: true
}); });
} }
async getItemByAppKey(uapp_key, uapp_secret) {
return this.model.findOne({
where: {
uapp_key: uapp_key,
uapp_secret: uapp_secret
},
attributes: ["id",
"app_hosts",
"app_code",
"app_name",
"uapp_id",
"uapp_key",
"uapp_secret",
"contact_name",
"contact_mobile",
"contact_email",
"is_enabled",
"is_sign"],
raw: true
});
}
} }
module.exports = AppDao; module.exports = AppDao;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment