Commit f7a496f9 by 宋毅

tj

parent 27b265fe
...@@ -61,6 +61,12 @@ class AccessAuthAPI extends APIBase { ...@@ -61,6 +61,12 @@ class AccessAuthAPI extends APIBase {
return system.getResultSuccess({ userpin: pobj.actionBody.userpin }) return system.getResultSuccess({ userpin: pobj.actionBody.userpin })
} }
break; break;
case "logout":
opResult = await this.utilsAuthSve.userLogout(action_body);
break;
case "putUserPwdByMobile":
opResult = await this.utilsAuthSve.putUserPwdByMobile(action_body);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -5,6 +5,7 @@ const md5 = require("MD5"); ...@@ -5,6 +5,7 @@ const md5 = require("MD5");
class AppServiceBase { class AppServiceBase {
constructor() { constructor() {
this.restClient = system.getObject("util.restClient"); this.restClient = system.getObject("util.restClient");
this.execClient = system.getObject("util.execClient");
this.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
} }
/** /**
...@@ -40,10 +41,18 @@ class AppServiceBase { ...@@ -40,10 +41,18 @@ class AppServiceBase {
} }
return system.getResultSuccess(); return system.getResultSuccess();
} }
async execPostUrl(pobj, url) { async restPostUrl(pobj, url) {
var rtn = await this.restClient.execPost(pobj, url); var rtn = await this.restClient.execPost(pobj, url);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost is empty"); return system.getResult(null, "restPost data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
}
async execPostUrl(pobj, url) {
var rtn = await this.execClient.execPost(pobj, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
return result; return result;
......
...@@ -36,18 +36,6 @@ class UtilsAuthSve extends AppServiceBase { ...@@ -36,18 +36,6 @@ class UtilsAuthSve extends AppServiceBase {
var result = await this.cacheManager["AppTokenByHostsCache"].cache(tokenValue, appHosts, system.exTime); var result = await this.cacheManager["AppTokenByHostsCache"].cache(tokenValue, appHosts, system.exTime);
return result; return result;
} }
async getVerifyCodeByMoblie(pobj, actionBody) {
if (!actionBody.mobile) {
return system.getResult(null, "actionBody.mobile can not be empty !");
}
var acckapp = await this.restClient.execPost(pobj, settings.centerAppUrl() + "auth/accessAuth/getVerifyCodeByMoblie");
var result = acckapp.stdout;
if (result) {
var tmp = JSON.parse(result);
return tmp;
}
return system.getResult(null, "data is empty");
}
async getReqUserPinByLgoin(pobj, actionBody) { async getReqUserPinByLgoin(pobj, actionBody) {
if (!actionBody.userName) { if (!actionBody.userName) {
return system.getResult(null, "actionBody.userName can not be empty"); return system.getResult(null, "actionBody.userName can not be empty");
...@@ -74,5 +62,42 @@ class UtilsAuthSve extends AppServiceBase { ...@@ -74,5 +62,42 @@ class UtilsAuthSve extends AppServiceBase {
return result; return result;
} }
async getVerifyCodeByMoblie(pobj, actionBody) {
if (!actionBody.mobile) {
return system.getResult(null, "actionBody.mobile can not be empty !");
}
return await this.restPostUrl(pobj, settings.centerAppUrl() + "auth/accessAuth/getVerifyCodeByMoblie");
}
async putUserPwdByMobile(pobj, actionBody) {
if (!actionBody.mobile) {
return system.getResult(null, "pobj.mobile can not be empty !");
}
if (!actionBody.vcode) {
return system.getResult(null, "pobj.vcode can not be empty !");
}
if (!actionBody.newPwd) {
return system.getResult(null, "pobj.newPwd can not be empty !");
}
if (!actionBody.appInfo) {
return system.getResult(null, "pobj.appInfo can not be empty !");
}
var result = await this.restPostUrl(pobj, settings.centerAppUrl() + "auth/accessAuth/modiPasswordByMobile");
if (acckapp.status == 0 && actionBody.userpin) {
this.userLogout(pobj, actionBody);
}
return system.getResultSuccess();
}
async userLogout(pobj, actionBody) {
if (!actionBody.userpin) {
return system.getResult(null, "actionBody.userpin can not be empty !");
}
var cacheManager = system.getObject("db.common.cacheManager");
await cacheManager["AppUserPinByLoginVcodeCache"].invalidate(actionBody.userpin);
await cacheManager["AppUserPinByLoginPwdCache"].invalidate(actionBody.userpin);
return system.getResultSuccess();
}
} }
module.exports = UtilsAuthSve; module.exports = UtilsAuthSve;
...@@ -17,7 +17,7 @@ class UtilsProductSve extends AppServiceBase { ...@@ -17,7 +17,7 @@ class UtilsProductSve extends AppServiceBase {
return system.getResult(null, "actionBody.typeCode can not be empty"); return system.getResult(null, "actionBody.typeCode can not be empty");
} }
var url = settings.centerAppUrl() + "action/opProduct/springBoard"; var url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.execPostUrl(pobj, url); return await this.restPostUrl(pobj, url);
} }
/** /**
* 根据产品类型码获取产品列表 * 根据产品类型码获取产品列表
...@@ -28,7 +28,7 @@ class UtilsProductSve extends AppServiceBase { ...@@ -28,7 +28,7 @@ class UtilsProductSve extends AppServiceBase {
return system.getResult(null, "actionBody.typeOneCode can not be empty"); return system.getResult(null, "actionBody.typeOneCode can not be empty");
} }
var url = settings.centerAppUrl() + "action/opProduct/springBoard"; var url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.execPostUrl(pobj, url); return await this.restPostUrl(pobj, url);
} }
/** /**
* 获取产品详情 * 获取产品详情
...@@ -39,7 +39,7 @@ class UtilsProductSve extends AppServiceBase { ...@@ -39,7 +39,7 @@ class UtilsProductSve extends AppServiceBase {
return system.getResult(null, "actionBody.channelItemCode can not be empty"); return system.getResult(null, "actionBody.channelItemCode can not be empty");
} }
var url = settings.centerAppUrl() + "action/opProduct/springBoard"; var url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.execPostUrl(pobj, url); return await this.restPostUrl(pobj, url);
} }
//--------------------------------应用中心获取产品信息--end---------------------------------------------------- //--------------------------------应用中心获取产品信息--end----------------------------------------------------
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
1. [密码登录](#pwdLogin) 1. [密码登录](#pwdLogin)
1. [验证码登录](#userPinByLgoinVcode) 1. [验证码登录](#userPinByLgoinVcode)
1. [用户注册](#userPinByRegister) 1. [用户注册](#userPinByRegister)
1. [按照手机号和验证码修改密码](#putUserPwdByMobile)
1. [退出](#logout)
## **<a name="smsCode"> 短信验证码</a>** ## **<a name="smsCode"> 短信验证码</a>**
...@@ -114,3 +116,95 @@ ...@@ -114,3 +116,95 @@
} }
``` ```
## **<a name="putUserPwdByMobile"> 按照手机号和验证码修改密码</a>**
[返回到目录](#menu)
##### URL
[/web/auth/accessAuth/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:putUserPwdByMobile
``` javascript
{
"mobile":"15010929366", // Y 手机号
"vcode":"593555", // Y 验证码
"newPwd":"123456" // Y 新密码
"userpin":"79009f97cebf4866834ee9e863d5f9b8" // N 用户登录凭证key
}
```
#### 返回结果
``` javascript
{
"status": 0,// 0为成功,2030为验证码错误,否则失败
"msg": "success",
"data": null,
"requestId": "1b12b0e9c190436da000386ddf693c8f"
}
```
## **<a name="logout"> 退出</a>**
[返回到目录](#menu)
##### URL
[/web/auth/accessAuth/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:logout
``` javascript
{
"userpin":"15010929366" // Y 用户登录凭证key
}
```
#### 返回结果
``` javascript
{
"status": 0,// 0为成功,否则失败
"msg": "success",
"data": null,
"requestId": "1b12b0e9c190436da000386ddf693c8f"
}
```
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