Commit 79c97af3 by 王昆

gsb

parent 56ea3fb2
...@@ -85,22 +85,23 @@ class ActionAPI extends APIBase { ...@@ -85,22 +85,23 @@ class ActionAPI extends APIBase {
let timestamp = Number(params.timestamp); let timestamp = Number(params.timestamp);
let nonceStr = Number(params.nonceStr); let nonceStr = Number(params.nonceStr);
let now = new Date().getTime(); let now = new Date().getTime();
if (now - timestamp > 60 * 1000) { if (now - timestamp > 60 * 60 * 60 * 1000) {
return system.getResult(1000000, "请求超时"); return system.getResultFail(1000000, "请求超时");
} }
if (!appId) { if (!appId) {
return system.getResult(1000000, "请填写appId"); return system.getResultFail(1000000, "请填写appId");
} }
if (!nonceStr) { if (!nonceStr) {
return system.getResult(1000000, "随机码为空"); return system.getResultFail(1000000, "随机码为空");
} }
// TODO redis通过sign幂等验证 // TODO redis通过sign幂等验证
// 幂等验证代码xxxx // 幂等验证代码xxxx
let app = await this.merchantSve.apiInfo({id: appId}).data || {}; let app = await this.merchantSve.apiInfo({id: appId})
if (!app.id) { if (!app.data || !app.data.id) {
return system.getResult(1000000, "appId不存在"); return system.getResultFail(1000000, "appId不存在");
} }
app = app.data;
let keys = Object.keys(params).sort(); let keys = Object.keys(params).sort();
let signArr = []; let signArr = [];
...@@ -112,9 +113,11 @@ class ActionAPI extends APIBase { ...@@ -112,9 +113,11 @@ class ActionAPI extends APIBase {
} }
let sign = md5(signArr.join("&") + "&key=" + app.secret).toUpperCase(); let sign = md5(signArr.join("&") + "&key=" + app.secret).toUpperCase();
console.log(params.sign, sign);
if (params.sign != sign) { if (params.sign != sign) {
return system.getResult(1001001, "签名验证失败"); return system.getResultFail(1001001, "签名验证失败");
} }
return system.getResultSuccess();
} }
exam() { exam() {
......
...@@ -6,7 +6,7 @@ var settings={ ...@@ -6,7 +6,7 @@ var settings={
db:10, db:10,
}, },
database:{ database:{
dbname : "esign-sve-uc", dbname : "esign-api",
user: "write", user: "write",
password: "write", password: "write",
config: { config: {
......
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