Commit 375be1da by Sxy

feat: 用户上传材料

parent adbc9698
...@@ -3,7 +3,7 @@ var objsettings = require("../config/objsettings"); ...@@ -3,7 +3,7 @@ var objsettings = require("../config/objsettings");
var settings = require("../config/settings"); var settings = require("../config/settings");
const request = require('request'); const request = require('request');
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) {
...@@ -16,7 +16,7 @@ class System { ...@@ -16,7 +16,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({
...@@ -39,7 +39,7 @@ class System { ...@@ -39,7 +39,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({
...@@ -62,7 +62,7 @@ class System { ...@@ -62,7 +62,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({
...@@ -90,7 +90,7 @@ class System { ...@@ -90,7 +90,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({
...@@ -109,7 +109,7 @@ class System { ...@@ -109,7 +109,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,
...@@ -131,7 +131,7 @@ class System { ...@@ -131,7 +131,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,
...@@ -144,7 +144,7 @@ class System { ...@@ -144,7 +144,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,
...@@ -157,7 +157,7 @@ class System { ...@@ -157,7 +157,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,
...@@ -169,14 +169,14 @@ class System { ...@@ -169,14 +169,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 {
...@@ -191,7 +191,7 @@ class System { ...@@ -191,7 +191,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];
...@@ -233,7 +233,7 @@ class System { ...@@ -233,7 +233,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");
...@@ -243,7 +243,7 @@ class System { ...@@ -243,7 +243,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 ||
...@@ -267,7 +267,7 @@ class System { ...@@ -267,7 +267,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)) {
...@@ -360,6 +360,7 @@ System.SERVERSESTATUS = { ...@@ -360,6 +360,7 @@ System.SERVERSESTATUS = {
SUCCESS: "success",//服务已完成 SUCCESS: "success",//服务已完成
CLOSED: "closed",//已关闭 CLOSED: "closed",//已关闭
USERUPLOADWAIT: "userUploadWait",//待用户上传材料
USERCONFIRMATIONWAIT: "userConfirmationWait",//递交文件待确认 USERCONFIRMATIONWAIT: "userConfirmationWait",//递交文件待确认
USERCONFIRMATIONREJECT: "userConfirmationReject",// 递交文件被驳回 USERCONFIRMATIONREJECT: "userConfirmationReject",// 递交文件被驳回
USERCONFIRMATIONRESOLVE: "userConfirmationResolve",//用户已确认递交文件 USERCONFIRMATIONRESOLVE: "userConfirmationResolve",//用户已确认递交文件
......
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