Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
46ecc98c
Commit
46ecc98c
authored
Apr 03, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
d560de0c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
xgg-saas-merchant/app/base/system.js
+11
-0
No files found.
xgg-saas-merchant/app/base/system.js
View file @
46ecc98c
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
,
//月份
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment