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
4e201ed1
Commit
4e201ed1
authored
Apr 22, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
331a0d8a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
11 deletions
+50
-11
center-channel/app/base/api/impl/auth/taskapi.js
+26
-1
center-channel/app/base/service/app.base.js
+12
-4
center-channel/app/base/service/impl/common/pushlogSve.js
+6
-0
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
+4
-4
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+2
-2
center-channel/app/base/service/impl/utilsSve/utilsTmAliyunSve.js
+0
-0
No files found.
center-channel/app/base/api/impl/auth/taskapi.js
View file @
4e201ed1
...
...
@@ -16,6 +16,9 @@ class AccessAuthAPI extends APIBase {
}
async
taskAgainFqPushInfo
(
pobj
,
qobj
,
req
)
{
//再次推送蜂擎业务数据
var
rtn
=
await
this
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
pobj
.
opType
);
if
(
rtn
.
status
==
0
)
{
this
.
pushlogSve
.
delDbPushfaillogById
(
Number
(
pobj
.
id
||
0
));
}
return
rtn
;
}
async
taskAgainPushOneNewBusInfo
(
pobj
,
qobj
,
req
)
{
//再次推送新rpc业务数据
...
...
@@ -27,6 +30,9 @@ class AccessAuthAPI extends APIBase {
}
async
taskAgainPushOneOldBusInfo
(
pobj
,
qobj
,
req
)
{
//再次推送老rpc业务数据
var
rtn
=
await
this
.
aliclient
.
reqbyget
(
pobj
)
if
(
rtn
.
status
==
0
)
{
this
.
pushlogSve
.
delDbPushfaillogById
(
Number
(
pobj
.
id
||
0
));
}
return
rtn
;
}
async
taskAliTmUpdate
(
pobj
,
qobj
,
req
)
{
//操作阿里商标更新
...
...
@@ -35,7 +41,26 @@ class AccessAuthAPI extends APIBase {
}
async
taskAliRpcAgainPush
(
pobj
,
qobj
,
req
)
{
var
result
=
await
this
.
pushlogSve
.
getFailLogList
();
if
(
result
.
status
!=
0
||
!
result
.
data
||
result
.
data
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"push data is empty"
);
}
for
(
let
index
=
0
;
index
<
result
.
data
.
length
;
index
++
)
{
const
element
=
result
.
data
[
index
];
if
(
element
)
{
var
contentData
=
JSON
.
parse
(
element
.
content
);
contentData
.
id
=
element
.
id
;
contentData
.
pushNumber
=
element
.
pushNumber
+
1
;
if
(
element
.
failType
==
1
)
{
this
.
taskAgainPushOneOldBusInfo
(
contentData
);
}
else
if
(
element
.
failType
==
2
)
{
this
.
taskAgainPushOneNewBusInfo
(
contentData
);
}
else
if
(
element
.
failType
==
4
)
{
this
.
taskAgainFqPushInfo
(
contentData
);
}
//FQ
}
}
return
system
.
getResultSuccess
();
}
...
...
center-channel/app/base/service/app.base.js
View file @
4e201ed1
...
...
@@ -8,6 +8,7 @@ class AppServiceBase {
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
this
.
pushlogFailType
=
{
OLDRPC
:
1
,
NEWRPC
:
2
,
FAILLOG
:
3
,
FQ
:
4
};
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
}
/**
...
...
@@ -157,7 +158,14 @@ class AppServiceBase {
return
system
.
getResult
(
null
,
errorMsg
);
}
}
async
disposePushResult
(
pobj
,
result
,
opTitleDesc
)
{
//处理结果信息--内部使用
/**
* 处理成功后的信息
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType this.pushlogFailType
*/
async
disposePushResult
(
pobj
,
result
,
opTitleDesc
,
failType
)
{
//处理结果信息--内部使用
var
opType
=
pobj
.
opType
||
""
;
if
(
result
.
status
!=
0
)
{
this
.
pushlogSve
.
createFailLogDb
({
...
...
@@ -167,7 +175,7 @@ class AppServiceBase {
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
2
,
failType
:
failType
||
3
,
opTitle
:
opType
+
"推送操作失败->"
+
opTitleDesc
,
pushNumber
:
pobj
.
pushNumber
||
1
});
...
...
@@ -192,7 +200,7 @@ class AppServiceBase {
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType
错误类型,1为old-rpc推送失败日志,2为new-rpc推送失败日志,业务处理失败日志,3为失败日志记录
* @param {*} failType
this.pushlogFailType
*/
async
disposePushResultFail
(
pobj
,
result
,
opTitleDesc
,
failType
)
{
//处理失败的结果信息--内部使用
var
opType
=
pobj
.
opType
||
""
;
...
...
@@ -203,7 +211,7 @@ class AppServiceBase {
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
failType
||
2
,
failType
:
failType
||
3
,
opTitle
:
opType
+
"推送操作失败->"
+
opTitleDesc
,
pushNumber
:
pobj
.
pushNumber
||
1
});
...
...
center-channel/app/base/service/impl/common/pushlogSve.js
View file @
4e201ed1
...
...
@@ -44,5 +44,11 @@ class PushlogService extends ServiceBase {
async
delDbPushfaillogById
(
id
)
{
this
.
pushfaillogDao
.
bulkDeleteByWhere
({
where
:
{
id
:
id
}
});
}
async
getFailLogList
()
{
var
sql
=
"SELECT id,`content`,failType,pushNumber,opTitle FROM `center_channel_pushfaillog` WHERE failType IN(1,2,4) AND pushNumber<10 LIMIT 200"
;
var
list
=
await
this
.
pushfaillogDao
.
customQuery
(
sql
);
var
result
=
system
.
getResultSuccess
(
list
);
return
result
;
}
}
module
.
exports
=
PushlogService
;
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
View file @
4e201ed1
...
...
@@ -27,7 +27,7 @@ class UtilsFqAliyunService extends AppServiceBase {
verifyResult
=
system
.
getResult
(
null
,
"orderInfo.productInfo.price_item.service_code can not be empty,100430"
);
}
if
(
verifyResult
.
status
!=
0
)
{
return
await
this
.
disposePushResultFail
(
pobj
,
verifyResult
,
"fq->pushOrderBusinessByProductCode2Fq->verifyResult"
);
return
await
this
.
disposePushResultFail
(
pobj
,
verifyResult
,
"fq->pushOrderBusinessByProductCode2Fq->verifyResult"
,
this
.
pushlogFailType
.
FQ
);
}
var
interface_params_info
=
verifyResult
.
data
;
...
...
@@ -44,7 +44,7 @@ class UtilsFqAliyunService extends AppServiceBase {
productQuantity
:
orderInfo
.
quantity
,
// 是 产品数量
};
var
result
=
await
this
.
opAliyunClientPost
(
pobj
,
"pushOrderBusiness"
,
interface_params_info
.
opUrl
,
interface_params_info
.
key
,
interface_params_info
.
secret
,
params
);
return
await
this
.
disposePushResult
(
pobj
,
result
,
"fq->pushOrderBusinessByProductCode2Fq->result"
);
return
await
this
.
disposePushResult
(
pobj
,
result
,
"fq->pushOrderBusinessByProductCode2Fq->result"
,
this
.
pushlogFailType
.
FQ
);
}
/**
...
...
@@ -55,11 +55,11 @@ class UtilsFqAliyunService extends AppServiceBase {
async
pushAliBusiness2Fq
(
pobj
)
{
//推送阿里信息操作到峰擎
var
verifyResult
=
await
this
.
verifyParam
(
pobj
);
if
(
verifyResult
.
status
!=
0
)
{
return
await
this
.
disposePushResultFail
(
pobj
,
verifyResult
,
"fq->pushAliBusiness2Fq->verifyResult"
);
return
await
this
.
disposePushResultFail
(
pobj
,
verifyResult
,
"fq->pushAliBusiness2Fq->verifyResult"
,
this
.
pushlogFailType
.
FQ
);
}
var
interface_params_info
=
verifyResult
.
data
;
var
result
=
await
this
.
opAliyunClientPost
(
pobj
,
interface_params_info
.
opUrl
,
interface_params_info
.
key
,
interface_params_info
.
secret
,
pobj
.
actionBody
);
return
await
this
.
disposePushResult
(
pobj
,
result
,
"fq->pushAliBusiness2Fq->result"
);
return
await
this
.
disposePushResult
(
pobj
,
result
,
"fq->pushAliBusiness2Fq->result"
,
this
.
pushlogFailType
.
FQ
);
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
...
...
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
4e201ed1
...
...
@@ -89,12 +89,12 @@ class UtilsPushService extends AppServiceBase {
delete
actionBody
[
"product_info"
];
}
//是否删除产品信息进行推送
refResult
=
await
this
.
restPostUrl
(
pobj
.
actionBody
,
interface_info
.
interface_url
);
this
.
disposePushResult
(
pobj
,
refResult
,
"ycUrlPush->reflexAction->refResult"
);
this
.
disposePushResult
(
pobj
,
refResult
,
"ycUrlPush->reflexAction->refResult"
,
this
.
pushlogFailType
.
NEWRPC
);
}
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
var
errorResult
=
system
.
getResult
(
null
,
"送异常-->reflexAction->"
+
e
.
stack
)
return
await
this
.
disposePushResultFail
(
pobj
,
errorResult
,
"数据推送异常-->reflexAction-->errorResult"
);
return
await
this
.
disposePushResultFail
(
pobj
,
errorResult
,
"数据推送异常-->reflexAction-->errorResult"
,
this
.
pushlogFailType
.
FAILLOG
);
}
}
}
...
...
center-channel/app/base/service/impl/utilsSve/utilsTmAliyunSve.js
View file @
4e201ed1
This diff is collapsed.
Click to expand it.
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