登录:实名认证

This commit is contained in:
luying
2021-03-03 20:41:31 +08:00
parent 0e7fa64393
commit 525bfd36bc
13 changed files with 361 additions and 2 deletions

View File

@@ -17,6 +17,8 @@ module.exports = () => {
ctx.uid = user.uid;
ctx.serverType = user.serverType;
ctx.auth = user.auth;
ctx.userCode = user.userCode;
ctx.pkgName = user.pkgName;
await next();
};
};

View File

@@ -13,6 +13,7 @@ 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 { authenticate } from 'app/pubUtils/httpUtil';
/**
* Test Service
@@ -161,7 +162,7 @@ export default class Auth extends Service {
let user = await UserModel.findUserByTel(tel);
return this.ctx.service.utils.resResult(STATUS.SUCCESS, {
hasAccount: !!user
hasAccount: !!user && user.hasSetPw
});
}
@@ -367,6 +368,8 @@ export default class Auth extends Service {
const ctx = this.ctx;
// TODO 接SDK
console.log(name, idNum);
let result = await authenticate(name, idNum, ctx.userCode, ctx.pkgName);
if(!result) return ctx.service.utils.resResult(STATUS.AUTHEN_FAIL);
let birthday = this.getBirthdayByIdCard(idNum);
let user = await UserModel.authentication(ctx.uid, birthday, '');