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
82e44cab
Commit
82e44cab
authored
Apr 16, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
c008b5c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
39 deletions
+11
-39
center-channel/app/base/service/impl/common/oplogSve.js
+11
-39
No files found.
center-channel/app/base/service/impl/common/oplogSve.js
View file @
82e44cab
...
@@ -4,9 +4,9 @@ var settings = require("../../../../config/settings");
...
@@ -4,9 +4,9 @@ var settings = require("../../../../config/settings");
class
OplogService
extends
ServiceBase
{
class
OplogService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"common"
,
ServiceBase
.
getDaoName
(
OplogService
));
super
(
"common"
,
ServiceBase
.
getDaoName
(
OplogService
));
//this.appDao=system.getObject("db.appDao");
this
.
opLogUrl
=
settings
.
apiconfig
.
opLogUrl
();
this
.
opLogUrl
=
settings
.
apiconfig
.
opLogUrl
();
this
.
opLogEsIsAdd
=
settings
.
apiconfig
.
opLogEsIsAdd
();
this
.
opLogEsIsAdd
=
settings
.
apiconfig
.
opLogEsIsAdd
();
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
}
}
async
error
(
qobj
)
{
async
error
(
qobj
)
{
this
.
create
(
qobj
);
this
.
create
(
qobj
);
...
@@ -15,65 +15,37 @@ class OplogService extends ServiceBase {
...
@@ -15,65 +15,37 @@ class OplogService extends ServiceBase {
this
.
create
(
qobj
);
this
.
create
(
qobj
);
}
}
async
create
(
qobj
)
{
async
create
(
qobj
)
{
if
(
!
qobj
||
!
qobj
.
op
||
qobj
.
op
.
indexOf
(
"metaCtl/getUiConfig"
)
>=
0
||
qobj
.
op
.
indexOf
(
"userCtl/checkLogin"
)
>=
0
||
qobj
.
op
.
indexOf
(
"getDicConfig"
)
>=
0
||
qobj
.
op
.
indexOf
(
"getRouteConfig"
)
>=
0
||
qobj
.
op
.
indexOf
(
"getRsConfig"
)
>=
0
)
{
return
null
;
}
var
rc
=
system
.
getObject
(
"util.execClient"
);
var
rc
=
system
.
getObject
(
"util.execClient"
);
var
rtn
=
null
;
try
{
try
{
// var myDate = new Date();
// var tmpTitle=myDate.toLocaleString()+":"+qobj.optitle;
qobj
.
optitle
=
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
":"
+
qobj
.
optitle
;
qobj
.
optitle
=
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
":"
+
qobj
.
optitle
;
if
(
this
.
opLogEsIsAdd
==
1
)
{
if
(
this
.
opLogEsIsAdd
==
1
)
{
qobj
.
content
=
qobj
.
content
.
replace
(
"field list"
,
"字段列表"
)
qobj
.
content
=
qobj
.
content
.
replace
(
"field list"
,
"字段列表"
)
qobj
.
created_at
=
(
new
Date
()).
getTime
();
qobj
.
created_at
=
(
new
Date
()).
getTime
();
//往Es中写入日志
//往Es中写入日志
var
addEsData
=
JSON
.
stringify
(
qobj
);
rc
.
execPost
(
qobj
,
this
.
opLogUrl
);
rc
.
execPost
(
qobj
,
this
.
opLogUrl
);
}
else
{
}
else
{
//解决日志大于4000写入的问题
if
(
qobj
.
content
.
length
>
4980
)
{
qobj
.
content
=
qobj
.
content
.
substring
(
0
,
4980
);
}
this
.
dao
.
create
(
qobj
);
this
.
dao
.
create
(
qobj
);
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
stack
,
"addLog------error-----------------------*****************"
);
qobj
.
content
=
e
.
stack
;
qobj
.
content
=
e
.
stack
;
//解决日志大于4000写入的问题
if
(
qobj
.
content
.
length
>
4980
)
{
qobj
.
content
=
qobj
.
content
.
substring
(
0
,
4980
);
}
this
.
dao
.
create
(
qobj
);
this
.
dao
.
create
(
qobj
);
}
}
}
}
async
createDb
(
qobj
)
{
async
createDb
(
qobj
)
{
if
(
!
qobj
||
!
qobj
.
op
||
qobj
.
op
.
indexOf
(
"metaCtl/getUiConfig"
)
>=
0
||
qobj
.
op
.
indexOf
(
"userCtl/checkLogin"
)
>=
0
||
qobj
.
op
.
indexOf
(
"getDicConfig"
)
>=
0
||
qobj
.
op
.
indexOf
(
"getRouteConfig"
)
>=
0
||
qobj
.
op
.
indexOf
(
"getRsConfig"
)
>=
0
)
{
return
null
;
}
try
{
try
{
qobj
.
optitle
=
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
":"
+
qobj
.
optitle
;
qobj
.
optitle
=
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
":"
+
qobj
.
optitle
;
//解决日志大于4000写入的问题
if
(
qobj
.
content
.
length
>
4980
)
{
qobj
.
content
=
qobj
.
content
.
substring
(
0
,
4980
);
}
this
.
dao
.
create
(
qobj
);
this
.
dao
.
create
(
qobj
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
.
stack
,
"addLog------error-----------------------*****************"
);
//日志记录
qobj
.
content
=
e
.
stack
;
this
.
logCtl
.
error
({
//解决日志大于4000写入的问题
appid
:
qobj
.
appid
||
""
,
if
(
qobj
.
content
.
length
>
4980
)
{
appkey
:
qobj
.
appkey
||
""
,
qobj
.
content
=
qobj
.
content
.
substring
(
0
,
4980
);
requestId
:
qobj
.
requestId
||
""
,
}
op
:
qobj
.
op
||
""
,
this
.
dao
.
create
(
qobj
);
content
:
qobj
.
content
+
"-->error:"
+
e
.
stack
,
clientIp
:
qobj
.
clientIp
||
""
,
optitle
:
qobj
.
optitle
||
""
+
"-->添加日志失败center_channel_log->createDb"
,
});
}
}
}
}
}
}
...
...
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