| 12345678910111213141516 |
- function restrictionMessage(reply) {
- for (const body of [reply, reply?.error, reply?.data]) {
- const markers = [body?.code, body?.message, body?.mess, body?.error];
- if (markers.includes('ACCOUNT_BANNED')) return '此账号已被封禁,无法登录。请联系客服。';
- if (markers.includes('ACCOUNT_FROZEN')) return '此账号已被保护性冻结,暂时无法登录。请联系客服核验。';
- }
- return undefined;
- }
- function restrictionMessageForUser(user) {
- if (user?.get('isBanned') === true) return restrictionMessage({code:'ACCOUNT_BANNED'});
- if (user?.get('isDisabled') === true) return restrictionMessage({code:'ACCOUNT_FROZEN'});
- return undefined;
- }
- module.exports = {restrictionMessage,restrictionMessageForUser};
|