INNER CODE UNIT · JavaScript
accountInfo
shadowsocks/shadowsocks-manager · plugins/account/index.js:242
let accountInfo = await knex('account_plugin').where({ id }).then(s => s[0]);
if(accountInfo.type < 2 || accountInfo.type > 5) { return; }
accountInfo.data = JSON.parse(accountInfo.data);
const timePeriod = {
'2': 7 * 86400 * 1000,
'3': 30 * 86400 * 1000,
'4': 1 * 86400 * 1000,
'5': 3600 * 1000,
};
accountInfo.data.create += time;
while(time > 0 && accountInfo.data.create >= Date.now()) {
accountInfo.data.limit += 1;
accountInfo.data.create -= timePeriod[accountInfo.type];
}
await knex('account_plugin').update({
data: JSON.stringify(accountInfo.data)
}).where({ id });
await accountFlow.edit(id);