Commit 0c988940 authored by 姜登's avatar 姜登

nodelimit

parent 0f7f0cc3
Pipeline #7110 passed with stage
in 2 seconds
...@@ -144,9 +144,6 @@ class PartnerService extends Service { ...@@ -144,9 +144,6 @@ class PartnerService extends Service {
} else { } else {
const dbRes = await ctx.model.NodeLimit.findAll({ const dbRes = await ctx.model.NodeLimit.findAll({
attributes: ['appKey', 'currentCount', 'limitCount'], attributes: ['appKey', 'currentCount', 'limitCount'],
where: {
type: 'gjj',
},
}); });
if (dbRes) { if (dbRes) {
const appKeyArray = []; const appKeyArray = [];
...@@ -156,13 +153,15 @@ class PartnerService extends Service { ...@@ -156,13 +153,15 @@ class PartnerService extends Service {
await this.app.redis.set(redisappKeyLimitPrefix + appKey, JSON.stringify({ currentCount, limitCount }), 'EX', 300); await this.app.redis.set(redisappKeyLimitPrefix + appKey, JSON.stringify({ currentCount, limitCount }), 'EX', 300);
} }
await this.app.redis.set(redisappKeyLimitPrefix, JSON.stringify(appKeyArray), 'EX', 300); await this.app.redis.set(redisappKeyLimitPrefix, JSON.stringify(appKeyArray), 'EX', 300);
} if (appKeyArray.includes(appKey)) {
await ctx.model.query('UPDATE node_limit set currentCount = currentCount + 1 where appKey = ?', { await ctx.model.query('UPDATE node_limit set currentCount = currentCount + 1 where appKey = ?', {
type: 'UPDATE', type: 'UPDATE',
replacements: [appKey], replacements: [appKey],
}); });
} }
} }
}
}
} }
......
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