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
7e4f8f24
Commit
7e4f8f24
authored
Jul 04, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
02a38778
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
8 deletions
+14
-8
brg-queue-center/app/base/api/api.base.js
+4
-2
brg-queue-center/app/base/api/impl/test/testData.js
+0
-0
brg-queue-center/app/base/db/consumer.base.js
+2
-2
brg-queue-center/app/base/service/impl/utilsSve/utilsProduceSve.js
+3
-0
brg-queue-center/app/base/utils/esUtils.js
+1
-1
brg-queue-center/app/base/utils/execClient.js
+1
-1
brg-queue-center/app/config/settings.js
+2
-2
brg-queue-center/readme.txt
+1
-0
No files found.
brg-queue-center/app/base/api/api.base.js
View file @
7e4f8f24
...
@@ -22,7 +22,9 @@ class APIBase {
...
@@ -22,7 +22,9 @@ class APIBase {
if
(
!
result
)
{
if
(
!
result
)
{
result
=
system
.
getResult
(
null
,
"请求的方法返回值为空"
);
result
=
system
.
getResult
(
null
,
"请求的方法返回值为空"
);
}
}
result
.
requestId
=
await
this
.
getBusUid
(
"scz"
);
if
(
!
result
.
requestId
)
{
result
.
requestId
=
pobj
.
actionBody
.
requestId
||
await
this
.
getBusUid
(
"scz"
);
}
if
(
"LOGS-SYTXPUBLIC-MSGQ"
!=
settings
.
queuedName
)
{
if
(
"LOGS-SYTXPUBLIC-MSGQ"
!=
settings
.
queuedName
)
{
pobj
.
actionBody
.
resultInfo
=
result
;
pobj
.
actionBody
.
resultInfo
=
result
;
pobj
.
actionBody
.
requestId
=
result
.
requestId
;
pobj
.
actionBody
.
requestId
=
result
.
requestId
;
...
@@ -34,7 +36,7 @@ class APIBase {
...
@@ -34,7 +36,7 @@ class APIBase {
var
stackStr
=
error
.
stack
?
error
.
stack
:
JSON
.
stringify
(
error
);
var
stackStr
=
error
.
stack
?
error
.
stack
:
JSON
.
stringify
(
error
);
// console.log(stackStr, "api.base调用出现异常,请联系管理员..........");
// console.log(stackStr, "api.base调用出现异常,请联系管理员..........");
var
rtnerror
=
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
stackStr
);
var
rtnerror
=
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
stackStr
);
pobj
.
actionBody
.
requestId
=
await
this
.
getBusUid
(
"err"
);
pobj
.
actionBody
.
requestId
=
pobj
.
actionBody
.
requestId
||
await
this
.
getBusUid
(
"err"
);
pobj
.
actionBody
.
errorInfo
=
stackStr
;
pobj
.
actionBody
.
errorInfo
=
stackStr
;
pobj
.
actionBody
.
opTitle
=
",reqPath:"
+
req
.
path
;
pobj
.
actionBody
.
opTitle
=
",reqPath:"
+
req
.
path
;
this
.
esUtils
.
addEsLogs
(
settings
.
queuedName
+
"apidoexec-error"
,
pobj
);
this
.
esUtils
.
addEsLogs
(
settings
.
queuedName
+
"apidoexec-error"
,
pobj
);
...
...
brg-queue-center/app/base/api/impl/test/testData.js
View file @
7e4f8f24
This diff is collapsed.
Click to expand it.
brg-queue-center/app/base/db/consumer.base.js
View file @
7e4f8f24
...
@@ -46,7 +46,7 @@ class ConsumerBase {
...
@@ -46,7 +46,7 @@ class ConsumerBase {
try
{
try
{
const
notifyQueuedName
=
"NOTIFY-SYTXPUBLIC-MSGQ"
;
const
notifyQueuedName
=
"NOTIFY-SYTXPUBLIC-MSGQ"
;
this
.
subBeforeConsumer
(
queuedName
,
actionBody
);
this
.
subBeforeConsumer
(
queuedName
,
actionBody
);
actionBody
.
requestId
=
await
this
.
getBusUid
(
"PUB-"
);
actionBody
.
requestId
=
a
ctionBody
.
requestId
||
a
wait
this
.
getBusUid
(
"PUB-"
);
if
(
"SYTXFAIL-SYTXPUBLIC-MSGQ"
!=
queuedName
)
{
if
(
"SYTXFAIL-SYTXPUBLIC-MSGQ"
!=
queuedName
)
{
execResult
=
await
this
.
subDoConsumer
(
queuedName
,
actionBody
);
execResult
=
await
this
.
subDoConsumer
(
queuedName
,
actionBody
);
if
(
notifyQueuedName
!=
queuedName
)
{
if
(
notifyQueuedName
!=
queuedName
)
{
...
@@ -91,7 +91,7 @@ class ConsumerBase {
...
@@ -91,7 +91,7 @@ class ConsumerBase {
async
subBeforeConsumer
(
queuedName
,
actionBody
)
{
async
subBeforeConsumer
(
queuedName
,
actionBody
)
{
console
.
log
(
"请在子类中重写此方法进行前置操作......"
,
this
.
serviceName
);
//
console.log("请在子类中重写此方法进行前置操作......", this.serviceName);
}
}
async
subDoConsumer
(
queuedName
,
actionBody
)
{
async
subDoConsumer
(
queuedName
,
actionBody
)
{
throw
new
Error
(
"请在子类中重写此方法进行操作业务逻辑............................!"
);
throw
new
Error
(
"请在子类中重写此方法进行操作业务逻辑............................!"
);
...
...
brg-queue-center/app/base/service/impl/utilsSve/utilsProduceSve.js
View file @
7e4f8f24
...
@@ -48,6 +48,9 @@ class UtilsProduceService extends AppServiceBase {
...
@@ -48,6 +48,9 @@ class UtilsProduceService extends AppServiceBase {
if
(
keyCount
===
0
)
{
if
(
keyCount
===
0
)
{
return
system
.
getResult
(
null
,
"actionBody参数不能为空"
);
return
system
.
getResult
(
null
,
"actionBody参数不能为空"
);
}
}
if
(
!
pobj
.
actionBody
.
indexName
)
{
return
system
.
getResult
(
null
,
"actionBody.indexName参数不能为空"
);
}
if
(
!
pobj
.
actionBody
.
identifyCode
)
{
if
(
!
pobj
.
actionBody
.
identifyCode
)
{
return
system
.
getResult
(
null
,
"actionBody.identifyCode参数不能为空"
);
return
system
.
getResult
(
null
,
"actionBody.identifyCode参数不能为空"
);
}
}
...
...
brg-queue-center/app/base/utils/esUtils.js
View file @
7e4f8f24
...
@@ -15,7 +15,7 @@ class EsUtils {
...
@@ -15,7 +15,7 @@ class EsUtils {
* @param {*} actionBody 日志信息
* @param {*} actionBody 日志信息
*/
*/
async
addEsLogs
(
queuedName
,
actionBody
)
{
async
addEsLogs
(
queuedName
,
actionBody
)
{
var
esIndexName
=
queuedName
+
(
actionBody
.
i
dentifyCode
?
"-"
+
actionBody
.
identifyCod
e
:
""
);
var
esIndexName
=
queuedName
+
(
actionBody
.
i
ndexName
?
"-"
+
actionBody
.
indexNam
e
:
""
);
esIndexName
=
esIndexName
.
toLocaleLowerCase
()
+
"/_doc?pretty"
;
esIndexName
=
esIndexName
.
toLocaleLowerCase
()
+
"/_doc?pretty"
;
actionBody
.
resultInfo
=
typeof
actionBody
.
resultInfo
===
'object'
?
JSON
.
stringify
(
actionBody
.
resultInfo
)
:
actionBody
.
resultInfo
||
""
;
actionBody
.
resultInfo
=
typeof
actionBody
.
resultInfo
===
'object'
?
JSON
.
stringify
(
actionBody
.
resultInfo
)
:
actionBody
.
resultInfo
||
""
;
actionBody
.
errorInfo
=
typeof
actionBody
.
errorInfo
===
'object'
?
JSON
.
stringify
(
actionBody
.
errorInfo
)
:
actionBody
.
errorInfo
||
""
;
actionBody
.
errorInfo
=
typeof
actionBody
.
errorInfo
===
'object'
?
JSON
.
stringify
(
actionBody
.
errorInfo
)
:
actionBody
.
errorInfo
||
""
;
...
...
brg-queue-center/app/base/utils/execClient.js
View file @
7e4f8f24
...
@@ -9,7 +9,7 @@ class ExecClient {
...
@@ -9,7 +9,7 @@ class ExecClient {
constructor
()
{
constructor
()
{
this
.
cmdGetPattern
=
"curl -G -X GET '{url}'"
;
this
.
cmdGetPattern
=
"curl -G -X GET '{url}'"
;
this
.
cmdPostPattern
=
"curl -k -H 'Content-type: application/json' -d '{data}' {url}"
;
this
.
cmdPostPattern
=
"curl -k -H 'Content-type: application/json' -d '{data}' {url}"
;
// this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H '
request-id:{requestId
}' -d '{data}' {url}"; //--已废弃
// this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H '
appkey:{appkey
}' -d '{data}' {url}"; //--已废弃
this
.
errorLogDao
=
system
.
getObject
(
"db.opLogs.errorLogDao"
);
this
.
errorLogDao
=
system
.
getObject
(
"db.opLogs.errorLogDao"
);
}
}
/**
/**
...
...
brg-queue-center/app/config/settings.js
View file @
7e4f8f24
...
@@ -10,8 +10,8 @@ var ENVINPUT = {
...
@@ -10,8 +10,8 @@ var ENVINPUT = {
REDIS_DB
:
process
.
env
.
QUEUE_REDIS_DB
,
REDIS_DB
:
process
.
env
.
QUEUE_REDIS_DB
,
DB_NAME
:
process
.
env
.
QUEUE_DB_NAME
,
DB_NAME
:
process
.
env
.
QUEUE_DB_NAME
,
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"test"
,
//运行环境
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"test"
,
//运行环境
CONSUMER_NAME
:
process
.
env
.
CONSUMER_NAME
||
"public
ServiceAllocation.public
Consumer"
,
//消费者名称
CONSUMER_NAME
:
process
.
env
.
CONSUMER_NAME
||
"public
Logs.publicLogs
Consumer"
,
//消费者名称
QUEUED_NAME
:
process
.
env
.
QUEUED_NAME
||
"SYTXPUBLIC-MSGQ"
,
//队列名称,FAIL-失败队列(队列和失败队列一对存在进行部署)
QUEUED_NAME
:
process
.
env
.
QUEUED_NAME
||
"
LOGS-
SYTXPUBLIC-MSGQ"
,
//队列名称,FAIL-失败队列(队列和失败队列一对存在进行部署)
};
};
var
settings
=
{
var
settings
=
{
env
:
ENVINPUT
.
APP_ENV
,
env
:
ENVINPUT
.
APP_ENV
,
...
...
brg-queue-center/readme.txt
View file @
7e4f8f24
...
@@ -84,6 +84,7 @@
...
@@ -84,6 +84,7 @@
"actionBody": {
"actionBody": {
"opTitle": "",// N 操作的业务标题
"opTitle": "",// N 操作的业务标题
"identifyCode": "logs001",// Y 操作的业务标识
"identifyCode": "logs001",// Y 操作的业务标识
"indexName": "brg-user-center",// Y es索引值,同一个项目用一个值
"messageBody": {//日志的描述信息
"messageBody": {//日志的描述信息
"opUrl": "http://192.168.1.189:4012/api/test/testApi/springBoard",// N 操作的业务Url
"opUrl": "http://192.168.1.189:4012/api/test/testApi/springBoard",// N 操作的业务Url
"message": ""// Y 日志消息描述
"message": ""// Y 日志消息描述
...
...
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