| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- const QIWEI_MONTHLY_PRICE = 200;
- const SEAT_PLANS = [
- { seats: 1, label: '1 个号', note: '个人试用' },
- { seats: 3, label: '3 个号', note: '小团队' },
- { seats: 10, label: '10 个号', note: '成长团队', recommended: true },
- { seats: 20, label: '20 个号', note: '中型团队' },
- { seats: 50, label: '50 个号', note: '大型团队' }
- ];
- const DURATION_PLANS = [
- { months: 1, label: '1 个月' },
- { months: 6, label: '6 个月' },
- { months: 12, label: '12 个月' }
- ];
- const ERROR_CODES = {
- 'QW-AUTH-401': { http: 401, title: '认证失败', tip: '鉴权 token 无效或已过期,请检查 QIWEI_AUTH_TOKEN 后重试。' },
- 'QW-PAY-402': { http: 402, title: '飞马余额不足', tip: '账户余额不足以完成本次订阅扣费,请先充值飞马余额。' },
- 'QW-SUB-402': { http: 402, title: '订阅未开通或已到期', tip: '请在动态流程页选择席位并完成开通,扣费成功后即可继续登录。' },
- 'QW-SEAT-403': { http: 403, title: '席位已满', tip: '当前订阅席位已全部占用,请增购席位或停用闲置设备。' },
- 'QW-UP-502': { http: 502, title: '企业微信服务暂时不可用', tip: '网关或上游服务异常,请稍后重试。' }
- };
- function classifySubscribeError(httpStatus, message) {
- const text = String(message || '');
- if (httpStatus === 401 || /认证失败|unauthorized/i.test(text)) return 'QW-AUTH-401';
- if (/余额不足/.test(text)) return 'QW-PAY-402';
- if (httpStatus === 402) return 'QW-SUB-402';
- if (httpStatus === 403 || /席位/.test(text)) return 'QW-SEAT-403';
- return 'QW-UP-502';
- }
- module.exports = {
- QIWEI_MONTHLY_PRICE,
- SEAT_PLANS,
- DURATION_PLANS,
- ERROR_CODES,
- classifySubscribeError
- };
|