Commit a2b4f19d by Sxy

fix: 参数大小写 取错

parent ce984bf6
...@@ -4,7 +4,7 @@ var settings = require("../config/settings"); ...@@ -4,7 +4,7 @@ var settings = require("../config/settings");
const request = require('request'); const request = require('request');
const cryptoJS = require('crypto-js'); const cryptoJS = require('crypto-js');
class System { class System {
static declare (ns) { static declare(ns) {
var ar = ns.split('.'); var ar = ns.split('.');
var root = System; var root = System;
for (var i = 0, len = ar.length; i < len; ++i) { for (var i = 0, len = ar.length; i < len; ++i) {
...@@ -17,7 +17,7 @@ class System { ...@@ -17,7 +17,7 @@ class System {
} }
} }
} }
static async delReq (url, qdata) { static async delReq(url, qdata) {
let rtn = {} let rtn = {}
let promise = new Promise(function (resv, rej) { let promise = new Promise(function (resv, rej) {
request.del({ request.del({
...@@ -40,7 +40,7 @@ class System { ...@@ -40,7 +40,7 @@ class System {
}) })
return promise; return promise;
} }
static async getReq (url, qdata) { static async getReq(url, qdata) {
let rtn = {} let rtn = {}
let promise = new Promise(function (resv, rej) { let promise = new Promise(function (resv, rej) {
request.get({ request.get({
...@@ -63,7 +63,7 @@ class System { ...@@ -63,7 +63,7 @@ class System {
}) })
return promise; return promise;
} }
static async postJsonTypeReq (url, data, md = "POST") { static async postJsonTypeReq(url, data, md = "POST") {
let rtn = {} let rtn = {}
let promise = new Promise(function (resv, rej) { let promise = new Promise(function (resv, rej) {
request({ request({
...@@ -92,7 +92,7 @@ class System { ...@@ -92,7 +92,7 @@ class System {
}) })
return promise; return promise;
} }
static async post3wFormTypeReq (url, data) { static async post3wFormTypeReq(url, data) {
let rtn = {} let rtn = {}
let promise = new Promise(function (resv, rej) { let promise = new Promise(function (resv, rej) {
request.post({ request.post({
...@@ -111,7 +111,7 @@ class System { ...@@ -111,7 +111,7 @@ class System {
}) })
return promise; return promise;
} }
static async postMpFormTypeReq (url, formdata) { static async postMpFormTypeReq(url, formdata) {
let promise = new Promise(function (resv, rej) { let promise = new Promise(function (resv, rej) {
request.post({ request.post({
url: url, url: url,
...@@ -133,7 +133,7 @@ class System { ...@@ -133,7 +133,7 @@ class System {
* @param {*} okmsg 操作成功的描述 * @param {*} okmsg 操作成功的描述
* @param {*} req 请求头信息 * @param {*} req 请求头信息
*/ */
static getResult (data, opmsg = "操作成功", req) { static getResult(data, opmsg = "操作成功", req) {
return { return {
status: !data ? -1 : 0, status: !data ? -1 : 0,
msg: opmsg, msg: opmsg,
...@@ -146,7 +146,7 @@ class System { ...@@ -146,7 +146,7 @@ class System {
* @param {*} data 操作成功返回的数据 * @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述 * @param {*} okmsg 操作成功的描述
*/ */
static getResultSuccess (data, okmsg = "success") { static getResultSuccess(data, okmsg = "success") {
return { return {
status: 0, status: 0,
msg: okmsg, msg: okmsg,
...@@ -159,7 +159,7 @@ class System { ...@@ -159,7 +159,7 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail * @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据 * @param {*} data 操作失败返回的数据
*/ */
static getResultFail (status = -1, errmsg = "fail", data = null) { static getResultFail(status = -1, errmsg = "fail", data = null) {
return { return {
status: status, status: status,
msg: errmsg, msg: errmsg,
...@@ -171,14 +171,14 @@ class System { ...@@ -171,14 +171,14 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail * @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据 * @param {*} data 操作失败返回的数据
*/ */
static getResultError (errmsg = "fail", data = null) { static getResultError(errmsg = "fail", data = null) {
return { return {
status: -200, status: -200,
msg: errmsg, msg: errmsg,
data: data, data: data,
}; };
} }
static register (key, ClassObj, groupName, filename) { static register(key, ClassObj, groupName, filename) {
if (System.objTable[key] != null) { if (System.objTable[key] != null) {
throw new Error("相同key的对象已经存在"); throw new Error("相同key的对象已经存在");
} else { } else {
...@@ -193,7 +193,7 @@ class System { ...@@ -193,7 +193,7 @@ class System {
return System.objTable[key]; return System.objTable[key];
} }
static getObject (objpath) { static getObject(objpath) {
var pathArray = objpath.split("."); var pathArray = objpath.split(".");
var packageName = pathArray[0]; var packageName = pathArray[0];
var groupName = pathArray[1]; var groupName = pathArray[1];
...@@ -234,7 +234,7 @@ class System { ...@@ -234,7 +234,7 @@ class System {
} }
} }
static getSysConfig () { static getSysConfig() {
var configPath = settings.basepath + "/app/base/db/metadata/index.js"; var configPath = settings.basepath + "/app/base/db/metadata/index.js";
// if(settings.env=="dev"){ // if(settings.env=="dev"){
// console.log("delete "+configPath+"cache config"); // console.log("delete "+configPath+"cache config");
...@@ -244,7 +244,7 @@ class System { ...@@ -244,7 +244,7 @@ class System {
var configValue = require(configPath); var configValue = require(configPath);
return configValue.config; return configValue.config;
} }
static get_client_ip (req) { static get_client_ip(req) {
var ip = req.headers['x-forwarded-for'] || var ip = req.headers['x-forwarded-for'] ||
req.ip || req.ip ||
req.connection.remoteAddress || req.connection.remoteAddress ||
...@@ -266,7 +266,7 @@ class System { ...@@ -266,7 +266,7 @@ class System {
* @param {*} resultInfo 返回结果 * @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息 * @param {*} errorInfo 错误信息
*/ */
static execLogs (opTitle, params, identifyCode, resultInfo, errorInfo) { static execLogs(opTitle, params, identifyCode, resultInfo, errorInfo) {
var reqUrl = settings.logUrl(); var reqUrl = settings.logUrl();
let isLogData = true let isLogData = true
if (params.method && (params.method.indexOf("find") >= 0 || params.method.indexOf("get") >= 0)) { if (params.method && (params.method.indexOf("find") >= 0 || params.method.indexOf("get") >= 0)) {
...@@ -302,7 +302,7 @@ class System { ...@@ -302,7 +302,7 @@ class System {
* 加密信息 * 加密信息
* @param {*} opStr * @param {*} opStr
*/ */
static encryptStr (opStr) { static encryptStr(opStr) {
if (!opStr) { if (!opStr) {
return ""; return "";
} }
...@@ -315,7 +315,7 @@ class System { ...@@ -315,7 +315,7 @@ class System {
* 解密信息 * 解密信息
* @param {*} opStr * @param {*} opStr
*/ */
static decryptStr (opStr) { static decryptStr(opStr) {
if (!opStr) { if (!opStr) {
return ""; return "";
} }
...@@ -331,17 +331,17 @@ class System { ...@@ -331,17 +331,17 @@ class System {
* 登录密码解码 * 登录密码解码
* @param {*} desstr * @param {*} desstr
*/ */
static desEncript (desstr) { static desEncript(desstr) {
let deskey = '647a68c9-da01-40d3-9763-1ffa0f64cf3f' let deskey = '647a68c9-da01-40d3-9763-1ffa0f64cf3f'
var keyHex = CryptoJS.enc.Utf8.parse(deskey); var keyHex = cryptoJS.enc.Utf8.parse(deskey);
// direct decrypt ciphertext // direct decrypt ciphertext
var decrypted = CryptoJS.DES.decrypt({ var decrypted = cryptoJS.DES.decrypt({
ciphertext: CryptoJS.enc.Base64.parse(desstr) ciphertext: cryptoJS.enc.Base64.parse(desstr)
}, keyHex, { }, keyHex, {
mode: CryptoJS.mode.ECB, mode: cryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7 padding: cryptoJS.pad.Pkcs7
}); });
return decrypted.toString(CryptoJS.enc.Utf8); return decrypted.toString(cryptoJS.enc.Utf8);
} }
} }
......
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