防沉迷:定时任务
This commit is contained in:
@@ -46,8 +46,8 @@ export default class AccountController extends Controller {
|
||||
|
||||
public async bind() {
|
||||
const { ctx } = this;
|
||||
const { tel, code, password } = ctx.request.body;
|
||||
ctx.body = await ctx.service.auth.bind(tel, code, password);
|
||||
const { tel, code } = ctx.request.body;
|
||||
ctx.body = await ctx.service.auth.bind(tel, code);
|
||||
}
|
||||
|
||||
public async authentication() {
|
||||
|
||||
@@ -85,7 +85,7 @@ export default class Auth extends Service {
|
||||
let age = getAge(user.birthday);
|
||||
let isAdult = age >= ADULT_AGE;
|
||||
let todayPlayTime = user.todayPlayTime;
|
||||
if(shouldRefresh(user.refDaily, new Date(), 0)) {
|
||||
if(shouldRefresh(user.reportTime, new Date(), 0)) {
|
||||
todayPlayTime = 0;
|
||||
}
|
||||
return {
|
||||
@@ -322,9 +322,10 @@ export default class Auth extends Service {
|
||||
|
||||
/**
|
||||
* 绑定账号
|
||||
* @param password 密码
|
||||
* @param tel 手机号
|
||||
* @param code 验证码
|
||||
*/
|
||||
public async bind(tel: string, code: string, password: string) {
|
||||
public async bind(tel: string, code: string) {
|
||||
const ctx = this.ctx;
|
||||
// 参数检查
|
||||
const telVerify = this.checkTelNo(tel);
|
||||
@@ -332,7 +333,7 @@ export default class Auth extends Service {
|
||||
return telVerify.resResult;
|
||||
}
|
||||
|
||||
if (!isString(code) || code.length !== 6 || !password) {
|
||||
if (!isString(code) || code.length !== 6) {
|
||||
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
|
||||
@@ -354,7 +355,7 @@ export default class Auth extends Service {
|
||||
return ctx.service.utils.resResult(STATUS.TEL_HAS_USED);
|
||||
}
|
||||
|
||||
let user = await UserModel.bindTel(ctx.uid, tel, password);
|
||||
let user = await UserModel.bindTel(ctx.uid, tel);
|
||||
if(!user) return ctx.service.utils.resResult(STATUS.ACCOUNT_NOT_GUEST);
|
||||
let param = this.getReturnParam(user);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, param);
|
||||
|
||||
Reference in New Issue
Block a user