Commit ef9c0486 by 宋毅

tj

parent e6aca6ec
...@@ -11,23 +11,15 @@ class AccessAuthAPI extends APIBase { ...@@ -11,23 +11,15 @@ class AccessAuthAPI extends APIBase {
return result; return result;
} }
async getVerifyCodeByMoblie(pobj, qobj, req) { async getVerifyCodeByMoblie(pobj, qobj, req) {//获取默认模板的手机验证码
if (!pobj.actionBody.mobile) { if (!pobj.actionBody.mobile) {
return system.getResult(null, "actionBody.mobile can not be empty !"); return system.getResult(null, "actionBody.mobile can not be empty !");
} }
var result = await this.opPlatformUtils.fetchVCode(pobj.actionBody.mobile, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret); var result = await this.opPlatformUtils.fetchDefaultVCode(pobj.actionBody.mobile, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret);
return result; return result;
} }
async loginUserByChannelUserId(pobj, qobj, req) { async login(pobj, qobj, req) {//通过账户和密码登录
if (!pobj.actionBody.channelUserId) {
return system.getResult(null, "actionBody.channelUserId can not be empty !");
}
var result = await this.opPlatformUtils.getReqUserPinByChannelUserId(pobj);
return result;
}
async login(pobj, qobj, req) {
if (!pobj.actionBody.userName) { if (!pobj.actionBody.userName) {
return system.getResult(null, "actionBody.userName can not be empty !"); return system.getResult(null, "actionBody.userName can not be empty !");
} }
...@@ -38,7 +30,7 @@ class AccessAuthAPI extends APIBase { ...@@ -38,7 +30,7 @@ class AccessAuthAPI extends APIBase {
return result; return result;
} }
async loginByVerifyCode(pobj, qobj, req) { async loginByVerifyCode(pobj, qobj, req) {//通过短信登录或注册信息
if (!pobj.actionBody.mobile) { if (!pobj.actionBody.mobile) {
return system.getResult(null, "actionBody.mobile can not be empty !"); return system.getResult(null, "actionBody.mobile can not be empty !");
} }
...@@ -48,7 +40,7 @@ class AccessAuthAPI extends APIBase { ...@@ -48,7 +40,7 @@ class AccessAuthAPI extends APIBase {
var result = await this.opPlatformUtils.getReqUserPinByLgoinVcode(pobj); var result = await this.opPlatformUtils.getReqUserPinByLgoinVcode(pobj);
return result; return result;
} }
async modiPasswordByMobile(pobj, qobj, req) { async modiPasswordByMobile(pobj, qobj, req) {//通过手机验证码修改用户密码
var actionBody = pobj.actionBody; var actionBody = pobj.actionBody;
if (!actionBody.mobile) { if (!actionBody.mobile) {
return system.getResult(null, "actionBody.mobile can not be empty !"); return system.getResult(null, "actionBody.mobile can not be empty !");
...@@ -59,11 +51,21 @@ class AccessAuthAPI extends APIBase { ...@@ -59,11 +51,21 @@ class AccessAuthAPI extends APIBase {
if (!actionBody.newPwd) { if (!actionBody.newPwd) {
return system.getResult(null, "actionBody.newPwd can not be empty !"); return system.getResult(null, "actionBody.newPwd can not be empty !");
} }
if (!actionBody.userpin) {
return system.getResult(null, "actionBody.userpin can not be empty !");
}
var result = await this.opPlatformUtils.putUserPwdByMobile(pobj, actionBody); var result = await this.opPlatformUtils.putUserPwdByMobile(pobj, actionBody);
return result; return result;
} }
async getLoginInfo(pobj, qobj, req) {//通过手机验证码修改用户密码
async logout(pobj, qobj, req){ var actionBody = pobj.actionBody;
if (!actionBody.userpin) {
return system.getResult(null, "actionBody.userpin can not be empty !");
}
var result = await this.opPlatformUtils.getUserLoginInfo(pobj, actionBody);
return result;
}
async logout(pobj, qobj, req) {
var result = await this.opPlatformUtils.logout(pobj); var result = await this.opPlatformUtils.logout(pobj);
return result; return result;
} }
......
...@@ -30,6 +30,7 @@ class AppUserPinByLoginPwdCache extends CacheBase { ...@@ -30,6 +30,7 @@ class AppUserPinByLoginPwdCache extends CacheBase {
if (userInfo.is_enabled != 1) { if (userInfo.is_enabled != 1) {
return system.getResult(null, "user to item is Disable !"); return system.getResult(null, "user to item is Disable !");
} }
userInfo.userpin = actionBody.userpin;
return system.getResultSuccess(userInfo); return system.getResultSuccess(userInfo);
} }
} }
......
...@@ -27,6 +27,10 @@ class AppUserPinByLoginVcodeCache extends CacheBase { ...@@ -27,6 +27,10 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
if (userInfo.is_enabled != 1) { if (userInfo.is_enabled != 1) {
return system.getResult(null, "user to item is Disable !"); return system.getResult(null, "user to item is Disable !");
} }
if (actionBody.reqType == "reg") {
return system.getResultFail(system.existUserRegFail, "已经存在此用户,注册失败");
}
userInfo.userpin = actionBody.userpin;
return system.getResultSuccess(userInfo); return system.getResultSuccess(userInfo);
} }
var params = { var params = {
...@@ -42,6 +46,7 @@ class AppUserPinByLoginVcodeCache extends CacheBase { ...@@ -42,6 +46,7 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
last_login_time: new Date() last_login_time: new Date()
}; };
userInfo = await this.appuserDao.create(params); userInfo = await this.appuserDao.create(params);
userInfo.userpin = actionBody.userpin;
return system.getResultSuccess(userInfo); return system.getResultSuccess(userInfo);
} }
} }
......
...@@ -296,6 +296,12 @@ System.exTime = 4 * 3600;//缓存过期时间,4小时 ...@@ -296,6 +296,12 @@ System.exTime = 4 * 3600;//缓存过期时间,4小时
System.shortExTime = 300;//300 System.shortExTime = 300;//300
//缓存失效
System.cacheInvalidation = -88;
System.noLogin = -99;
//已经存在此用户,注册失败
System.existUserRegFail = 2000;
//重复登录 //重复登录
System.reDoLoginFail = 2060; System.reDoLoginFail = 2060;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment