Commit 46ecc98c by 王昆

gsb

parent d560de0c
var fs = require("fs");
var objsettings = require("../config/objsettings");
var settings = require("../config/settings");
class System {
static declare(ns) {
var ar = ns.split('.');
......@@ -15,6 +16,7 @@ class System {
}
}
}
static register(key, ClassObj) {
if (System.objTable[key] != null) {
throw new Error("相同key的对象已经存在");
......@@ -25,6 +27,7 @@ class System {
return System.objTable[key];
}
static getResult(data, opmsg = "操作成功", req) {
return {
status: !data ? -1 : 0,
......@@ -33,6 +36,7 @@ class System {
bizmsg: req && req.session && req.session.bizmsg ? req.session.bizmsg : "empty"
};
}
/**
* 请求返回成功
* @param {*} data 操作成功返回的数据
......@@ -45,6 +49,7 @@ class System {
data: data || null,
};
}
/**
* 请求返回失败
* @param {*} status 操作失败状态,默认为-1
......@@ -58,6 +63,7 @@ class System {
data: data,
};
}
static getObject(objpath) {
var pathArray = objpath.split(".");
var packageName = pathArray[0];
......@@ -81,6 +87,7 @@ class System {
return System.register(objabspath, ClassObj);
}
}
static getUiConfig(appid) {
var configPath = settings.basepath + "/app/base/db/metadata/" + appid + "/index.js";
if (settings.env == "dev") {
......@@ -89,6 +96,7 @@ class System {
var configValue = require(configPath);
return configValue;
}
static getUiConfig2(appid) {
var configPath = settings.basepath + "/app/base/db/metadata/index.js";
// if(settings.env=="dev"){
......@@ -99,6 +107,7 @@ class System {
var configValue = require(configPath);
return configValue[appid];
}
static get_client_ip(req) {
var ip = req.headers['x-forwarded-for'] ||
req.ip ||
......@@ -144,6 +153,7 @@ class System {
}
}
}
static getUid(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
var uuid = [],
......@@ -210,6 +220,7 @@ class System {
}
}
}
Date.prototype.Format = function (fmt) { //author: meizz
var o = {
"M+": this.getMonth() + 1, //月份
......
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