登录: fix checkTelNo返回错误
This commit is contained in:
@@ -22,6 +22,7 @@ export const STATUS = {
|
||||
TEL_HAS_USED: { code: 10011, simStr: '该手机号已被使用' },
|
||||
ACCOUNT_NOT_GUEST: { code: 10012, simStr: '该账号已绑定过' },
|
||||
AUTHEN_FAIL: { code: 10013, simStr: '实名失败' },
|
||||
TEL_LEN_ERR: { code: 10014, simStr: '手机长度错误' },
|
||||
// 战斗相关状态 20000 - 29999
|
||||
// 战斗通用 20000 - 20099
|
||||
BATTLE_MISS_INFO: { code: 20001, simStr: '缺少关卡信息' },
|
||||
|
||||
@@ -12,7 +12,7 @@ import { calPlayerCeAndSave, reCalAllHeroCe } from 'app/pubUtils/playerCe';
|
||||
import { getExpByLv, getHeroExpByLv, gameData } from 'app/pubUtils/data';
|
||||
import { isString } from 'underscore';
|
||||
import { getAge } from 'app/pubUtils/timeUtil';
|
||||
import { shouldRefresh } from 'app/pubUtils/util';
|
||||
import { shouldRefresh, resResult } from 'app/pubUtils/util';
|
||||
import { authenticate } from 'app/pubUtils/httpUtil';
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ export default class Auth extends Service {
|
||||
loginType = 2;
|
||||
}
|
||||
return this.ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
canLogin: true,
|
||||
canLogin: user.hasSetPw, // 未设置密码等于未创建账号
|
||||
loginType,
|
||||
...param
|
||||
});
|
||||
@@ -104,12 +104,12 @@ export default class Auth extends Service {
|
||||
|
||||
public checkTelNo(telNo) {
|
||||
if (!isString(telNo)) {
|
||||
return { status: 1, data: '参数类型错误' };
|
||||
return { status: 1, resResult: resResult(STATUS.WRONG_PARMS) };
|
||||
}
|
||||
if (telNo.length !== 11) {
|
||||
return { status: 1, data: '手机号长度错误' };
|
||||
return { status: 1, resResult: resResult(STATUS.TEL_LEN_ERR) };
|
||||
}
|
||||
return { status: 0, data: '手机号合法' };
|
||||
return { status: 0 };
|
||||
}
|
||||
|
||||
async sendSmsCodeByGuodu(tel, code) {
|
||||
@@ -137,7 +137,7 @@ export default class Auth extends Service {
|
||||
|
||||
const telVerify = this.checkTelNo(tel);
|
||||
if (telVerify.status !== 0) {
|
||||
return telVerify;
|
||||
return telVerify.resResult;
|
||||
}
|
||||
const sms = await smsModel.findByTel(tel, false);
|
||||
if (sms) {
|
||||
@@ -179,7 +179,7 @@ export default class Auth extends Service {
|
||||
// 参数检查
|
||||
const telVerify = this.checkTelNo(tel);
|
||||
if (telVerify.status !== 0) {
|
||||
return telVerify;
|
||||
return telVerify.resResult;
|
||||
}
|
||||
|
||||
// ! 测试阶段允许客户端不传验证码,此时不做验证码验证,直接注册或登录账号
|
||||
@@ -241,7 +241,7 @@ export default class Auth extends Service {
|
||||
// 参数检查
|
||||
const telVerify = this.checkTelNo(tel);
|
||||
if (telVerify.status !== 0) {
|
||||
return telVerify;
|
||||
return telVerify.resResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ export default class Auth extends Service {
|
||||
// 参数检查
|
||||
const telVerify = this.checkTelNo(tel);
|
||||
if (telVerify.status !== 0) {
|
||||
return telVerify;
|
||||
return telVerify.resResult;
|
||||
}
|
||||
|
||||
if (!isString(code) || code.length !== 6 || !password) {
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
"autod": "autod",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"clean": "ets clean",
|
||||
"local": "cross-env EGG_SERVER_ENV=local npm run dev"
|
||||
"local": "cross-env EGG_SERVER_ENV=local npm run dev",
|
||||
"isbn": "cross-env EGG_SERVER_ENV=isbn npm run dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
|
||||
Reference in New Issue
Block a user