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
f738b05e
Commit
f738b05e
authored
Mar 22, 2021
by
宋毅
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-channel' of gitlab.gongsibao.com:jiangyong/zhichan into center-channel
parents
635f5f65
18dac646
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1054 additions
and
519 deletions
+1054
-519
center-channel/app/base/api/impl/opreceive/need.js
+10
-0
center-channel/app/base/api/impl/tm/consultation.js
+93
-0
center-channel/app/base/api/impl/tm/feedback.js
+68
-0
center-channel/app/base/api/impl/tm/status.js
+68
-0
center-channel/app/base/api/impl/tm/tmcase.js
+83
-0
center-channel/app/base/service/app.base.js
+527
-486
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
+5
-1
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
+120
-0
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+22
-0
center-channel/app/base/service/impl/utilsSve/utilsTmOrderCallSve.js
+2
-2
center-channel/app/base/utils/dingClient.js
+50
-29
center-channel/app/config/businessConfig.js
+6
-1
No files found.
center-channel/app/base/api/impl/opreceive/need.js
View file @
f738b05e
...
...
@@ -130,6 +130,16 @@ class Need extends APIBase {
case
"getymicpProduce"
:
//获取易名的icp产品信息
opResult
=
await
this
.
centerorderSve
.
getymicpProduce
(
pobj
);
break
;
//百度商标接入
case
"submitTmNeed"
:
//提交需求
opResult
=
await
this
.
utilsNeedSve
.
submitTmNeed
(
pobj
,
pobj
.
actionBody
);
break
;
case
"tmFeedbackSubmit"
:
//商标用户反馈
opResult
=
await
this
.
utilsNeedSve
.
tmFeedbackSubmit
(
pobj
);
break
;
case
"tmStatusNotify"
:
//商标状态通知
opResult
=
await
this
.
utilsNeedSve
.
tmStatusNotify
(
pobj
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
center-channel/app/base/api/impl/tm/consultation.js
0 → 100644
View file @
f738b05e
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
uuidv4
=
require
(
'uuid/v4'
);
/**
* 商标需求
* 庄冰 2021.03.17
*/
class
Consultation
extends
APIBase
{
constructor
()
{
super
();
this
.
gatewaypushlogSve
=
system
.
getObject
(
"service.common.gatewaypushlogSve"
);
}
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
}
getResultSuccess
(
requestId
)
{
return
{
"status"
:
0
,
"msg"
:
"success"
,
"data"
:
null
,
"requestId"
:
requestId
};
}
getResultFail
(
errmsg
)
{
var
self
=
this
;
return
{
"status"
:
-
1
,
"msg"
:
errmsg
,
"requestId"
:
self
.
getUUID
(),
"data"
:
null
,
"bizmsg"
:
"empty"
};
}
//需求提交
async
submit
(
pobj
,
obj
,
req
)
{
var
self
=
this
;
if
(
!
pobj
.
appInfo
||
!
pobj
.
appInfo
.
uapp_key
||
!
pobj
.
appInfo
.
uapp_secret
){
return
self
.
getResultFail
(
"未知应用或应用未启用"
);
}
if
(
!
pobj
.
intentionBizId
)
{
return
self
.
getResultFail
(
"intentionBizId不能为空"
);
}
if
(
!
pobj
.
phone
)
{
return
self
.
getResultFail
(
"phone不能为空"
);
}
if
(
!
pobj
.
consultType
)
{
return
self
.
getResultFail
(
"consultType不能为空"
);
}
pobj
.
type
=
pobj
.
consultType
;
pobj
.
mobile
=
pobj
.
phone
;
pobj
.
action_type
=
"submitTmNeed"
;
var
param
=
{
requestId
:
req
.
requestId
||
self
.
getUUID
(),
requestUrl
:
pobj
.
appInfo
.
app_code
+
"/tm/consultation/submit"
,
requestjson
:
JSON
.
stringify
(
pobj
),
//请求地址
pushUrl
:
"/action/intentionapi/springBoard"
,
//调用地址
pushActionType
:
"submitTmNeed"
,
//调用参数
pushtimes
:
0
,
//推送次数
pushStatus
:
"wts"
,
//推送状态
}
await
self
.
gatewaypushlogSve
.
create
(
param
);
return
self
.
getResultSuccess
(
param
.
requestId
);
}
/**
* 需求关闭CloseTradeMarkProduct
* @param {*} pobj
* @param {*} obj
* @param {*} req
*/
async
close
(
pobj
,
obj
,
req
){
if
(
!
pobj
.
IntentionBizId
)
{
return
self
.
getResultFail
(
"IntentionBizId不能为空"
);
}
var
reqUrl
=
settings
.
centerOrderUrl
()
+
"action/opNeed/springBoard"
;
var
reqObj
=
{
actionType
:
"opNeedClose"
,
actionBody
:{
needNo
:
pobj
.
IntentionBizId
},
appInfo
:
pobj
.
appInfo
}
var
result
=
await
this
.
utilsNeedSve
.
restPostUrl
(
reqObj
,
reqUrl
);
return
result
;
}
}
module
.
exports
=
Consultation
;
\ No newline at end of file
center-channel/app/base/api/impl/tm/feedback.js
0 → 100644
View file @
f738b05e
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
uuidv4
=
require
(
'uuid/v4'
);
/**
* 商标通知接口
* 庄冰 2021.03.17
*/
class
Feedback
extends
APIBase
{
constructor
()
{
super
();
this
.
gatewaypushlogSve
=
system
.
getObject
(
"service.common.gatewaypushlogSve"
);
}
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
}
getResultSuccess
(
requestId
)
{
return
{
"status"
:
0
,
"msg"
:
"success"
,
"data"
:
null
,
"requestId"
:
requestId
};
}
getResultFail
(
errmsg
)
{
var
self
=
this
;
return
{
"status"
:
-
1
,
"msg"
:
errmsg
,
"requestId"
:
self
.
getUUID
(),
"data"
:
null
,
"bizmsg"
:
"empty"
};
}
//需求反馈
async
submit
(
pobj
,
obj
,
req
)
{
var
self
=
this
;
if
(
!
pobj
.
appInfo
||
!
pobj
.
appInfo
.
uapp_key
||
!
pobj
.
appInfo
.
uapp_secret
){
return
self
.
getResultFail
(
"未知应用或应用未启用"
);
}
if
(
!
pobj
.
intentionBizId
)
{
return
self
.
getResultFail
(
"intentionBizId不能为空"
);
}
if
(
!
pobj
.
description
)
{
return
self
.
getResultFail
(
"description不能为空"
);
}
pobj
.
action_type
=
"tmFeedbackSubmit"
;
var
param
=
{
requestId
:
req
.
requestId
||
self
.
getUUID
(),
requestUrl
:
pobj
.
appInfo
.
app_code
+
"/tm/feedback/submit"
,
requestjson
:
JSON
.
stringify
(
pobj
),
//请求地址
pushUrl
:
"/action/intentionapi/springBoard"
,
//调用地址
pushActionType
:
"tmFeedbackSubmit"
,
//调用参数
pushtimes
:
0
,
//推送次数
pushStatus
:
"wts"
,
//推送状态
}
await
self
.
gatewaypushlogSve
.
create
(
param
);
return
self
.
getResultSuccess
(
param
.
requestId
);
}
}
module
.
exports
=
Feedback
;
\ No newline at end of file
center-channel/app/base/api/impl/tm/status.js
0 → 100644
View file @
f738b05e
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
uuidv4
=
require
(
'uuid/v4'
);
/**
* tm通知接口
* 庄冰 2021.03.18
*/
class
Order
extends
APIBase
{
constructor
()
{
super
();
this
.
gatewaypushlogSve
=
system
.
getObject
(
"service.common.gatewaypushlogSve"
);
}
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
}
getResultSuccess
(
requestId
)
{
return
{
"status"
:
0
,
"msg"
:
"success"
,
"data"
:
null
,
"requestId"
:
requestId
};
}
getResultFail
(
errmsg
)
{
var
self
=
this
;
return
{
"status"
:
-
1
,
"msg"
:
errmsg
,
"requestId"
:
self
.
getUUID
(),
"data"
:
null
,
"bizmsg"
:
"empty"
};
}
//状态变更
async
notify
(
pobj
,
obj
,
req
)
{
var
self
=
this
;
if
(
!
pobj
.
appInfo
||
!
pobj
.
appInfo
.
uapp_key
||
!
pobj
.
appInfo
.
uapp_secret
){
return
self
.
getResultFail
(
"未知应用或应用未启用"
);
}
if
(
!
pobj
.
bizId
)
{
return
self
.
getResultFail
(
"bizId不能为空"
);
}
if
(
!
pobj
.
status
)
{
return
self
.
getResultFail
(
"status不能为空"
);
}
pobj
.
action_type
=
"tmStatusNotify"
;
var
param
=
{
requestId
:
req
.
requestId
||
self
.
getUUID
(),
requestUrl
:
pobj
.
appInfo
.
app_code
+
"/tm/status/notify"
,
requestjson
:
JSON
.
stringify
(
pobj
),
//请求地址
pushUrl
:
"/action/intentionapi/springBoard"
,
//调用地址
pushActionType
:
"tmStatusNotify"
,
//调用参数
pushtimes
:
0
,
//推送次数
pushStatus
:
"wts"
,
//推送状态
}
await
self
.
gatewaypushlogSve
.
create
(
param
);
return
self
.
getResultSuccess
(
param
.
requestId
);
}
}
module
.
exports
=
Order
;
\ No newline at end of file
center-channel/app/base/api/impl/tm/tmcase.js
0 → 100644
View file @
f738b05e
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
uuidv4
=
require
(
'uuid/v4'
);
/**
* 商标方案信息(接收fqboss推送的商标方案信息,并推送至渠道)
* 庄冰 2021.03.18
*/
class
Tmcase
extends
APIBase
{
constructor
()
{
super
();
this
.
utilsNeedSve
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve"
);
this
.
baseUrl
=
settings
.
centerOrderUrl
()
+
"notifyaction/opNeedSolution/"
}
async
updateTmStatus
(
pobj
,
qobj
,
req
)
{
var
reqUrl
=
this
.
baseUrl
+
"updateTmStatus"
;
var
result
=
await
this
.
utilsNeedSve
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
//接收辅助、担保商标注册信息
async
nbtzreceiveAssistTmData
(
pobj
,
qobj
,
req
)
{
var
reqUrl
=
this
.
baseUrl
+
"nbtzreceiveAssistTmData"
;
var
result
=
await
this
.
utilsNeedSve
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
&&
result
.
status
==
0
){
await
this
.
pushData2Platform
()
}
return
result
;
}
//接收辅助、担保商标注册修改信息
async
nbtzreceiveEditAssistTmData
(
pobj
,
qobj
,
req
)
{
var
reqUrl
=
this
.
baseUrl
+
"nbtzreceiveEditAssistTmData"
;
var
result
=
await
this
.
utilsNeedSve
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
//提交方案确认
async
submitTmConfirm
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
IntentionBizId
)
{
return
self
.
getResultFail
(
"IntentionBizId不能为空"
);
}
var
reqUrl
=
this
.
baseUrl
+
"nbtzreceiveEditAssistTmData"
;
var
result
=
await
this
.
utilsNeedSve
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
/**
* 关闭注册⽅案
* @param {*} pobj
* @param {*} obj
* @param {*} req
*/
async
closeSolution
(
pobj
,
obj
,
req
){
if
(
!
pobj
.
BizId
)
{
return
self
.
getResultFail
(
"BizId不能为空"
);
}
if
(
!
pobj
.
IntentionBizId
)
{
return
self
.
getResultFail
(
"IntentionBizId不能为空"
);
}
var
reqUrl
=
this
.
baseUrl
+
"closeSolution"
;
var
result
=
await
this
.
utilsNeedSve
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
/**
* 推送数据至平台方(百度、阿里)
* needSolution 需求方案
* appInfo app
* opflag 操作标志:QueryTradeIntentionUserList:查询需求列表,SaveTradeMarkProductSolution:提交注册⽅案-商标信息
* SaveTradeMarkMaterialDetail:补全注册⽅案-申请⼈信息 ConfirmTradeIntention:确认注册⽅案
*
*/
async
pushData2Platform
(
needSolution
,
appInfo
,
opflag
){
if
(
appInfo
.
uapp_id
==
18
){
//阿里云商机
}
if
(
appInfo
.
uapp_id
==
44
){
//百度云商机
}
}
}
module
.
exports
=
Tmcase
;
\ No newline at end of file
center-channel/app/base/service/app.base.js
View file @
f738b05e
...
...
@@ -6,517 +6,558 @@ const uuidv4 = require('uuid/v4');
const
cryptoJS
=
require
(
'crypto-js'
);
class
AppServiceBase
{
constructor
()
{
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
execClientNew
=
system
.
getObject
(
"util.execClientNew"
);
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"
);
}
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
*/
async
verifySign
(
params
,
app_key
)
{
if
(
!
params
)
{
return
system
.
getResult
(
null
,
"请求参数为空"
);
constructor
()
{
this
.
dingClient
=
system
.
getObject
(
"util.dingClient"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
execClientNew
=
system
.
getObject
(
"util.execClientNew"
);
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"
);
}
if
(
!
params
.
sign
)
{
return
system
.
getResult
(
null
,
"请求参数sign为空"
);
}
var
signArr
=
[];
var
keys
=
Object
.
keys
(
params
).
sort
();
if
(
keys
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数信息为空"
);
}
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
params
[
tKey
]
&&
!
(
typeof
(
params
[
tKey
])
===
"object"
))
{
signArr
.
push
(
tKey
+
"="
+
params
[
tKey
]);
}
}
if
(
signArr
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数组装签名参数信息为空"
);
}
var
resultSignStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
app_key
;
var
resultTmpSign
=
md5
(
resultSignStr
).
toUpperCase
();
if
(
params
.
sign
!=
resultTmpSign
)
{
return
system
.
getResult
(
null
,
"返回值签名验证失败"
);
}
return
system
.
getResultSuccess
();
}
async
restPostUrl
(
pobj
,
url
)
{
try
{
var
rtn
=
await
this
.
restClient
.
execPost
(
pobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"restPost data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/restPostUrl"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->restPostUrl"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
async
restPostWithHValueUrl
(
pobj
,
url
,
hValue
)
{
//curl请求带请求头信息
try
{
if
(
!
hValue
)
{
hValue
=
"YLc6GsgLtuRGaVA5Om848x18NxLtHlyA"
;
}
var
rtn
=
await
this
.
restClient
.
execPostWithHValue
(
pobj
,
url
,
hValue
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPostWithHValue data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/restPostWithHValueUrl"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->restPostWithHValueUrl"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
async
restPostWithHAuthorizationUrl
(
pobj
,
userToken
,
url
)
{
//curl请求带请求头信息
try
{
var
rtn
=
await
this
.
restClient
.
restPostWithHAuthorizationUrl
(
userToken
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"restPostWithHAuthorizationUrl data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/restPostWithHAuthorizationUrl"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->restPostWithHAuthorizationUrl"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
async
execPostUrl
(
pobj
,
url
)
{
try
{
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/execPostUrl"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"基类操作异常->execPostUrl"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
*/
async
verifySign
(
params
,
app_key
)
{
if
(
!
params
)
{
return
system
.
getResult
(
null
,
"请求参数为空"
);
}
if
(
!
params
.
sign
)
{
return
system
.
getResult
(
null
,
"请求参数sign为空"
);
}
var
signArr
=
[];
var
keys
=
Object
.
keys
(
params
).
sort
();
if
(
keys
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数信息为空"
);
}
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
params
[
tKey
]
&&
!
(
typeof
(
params
[
tKey
])
===
"object"
))
{
signArr
.
push
(
tKey
+
"="
+
params
[
tKey
]);
}
}
if
(
signArr
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数组装签名参数信息为空"
);
}
var
resultSignStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
app_key
;
var
resultTmpSign
=
md5
(
resultSignStr
).
toUpperCase
();
if
(
params
.
sign
!=
resultTmpSign
)
{
return
system
.
getResult
(
null
,
"返回值签名验证失败"
);
}
return
system
.
getResultSuccess
();
}
}
async
opAliyunRpcVerifyParam
(
pobj
)
{
//参数信息验证
var
verify
=
system
.
getResultSuccess
();
if
(
!
pobj
.
interface_params
)
{
verify
=
system
.
getResult
(
null
,
"interface_params can not be empty,100440"
);
async
restPostUrl
(
pobj
,
url
)
{
try
{
var
rtn
=
await
this
.
restClient
.
execPost
(
pobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"restPost data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/restPostUrl"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->restPostUrl"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
var
interface_params_info
=
JSON
.
parse
(
pobj
.
interface_params
);
if
(
!
interface_params_info
||
!
interface_params_info
.
action
)
{
verify
=
system
.
getResult
(
null
,
"interface_params.action can not be empty,100443"
);
async
restPostWithHValueUrl
(
pobj
,
url
,
hValue
)
{
//curl请求带请求头信息
try
{
if
(
!
hValue
)
{
hValue
=
"YLc6GsgLtuRGaVA5Om848x18NxLtHlyA"
;
}
var
rtn
=
await
this
.
restClient
.
execPostWithHValue
(
pobj
,
url
,
hValue
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPostWithHValue data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/restPostWithHValueUrl"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->restPostWithHValueUrl"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
verify
.
data
=
interface_params_info
;
return
verify
;
}
/**
* 阿里RPC调用
* @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
* @param {*} params {为阿里的接口参数}
*/
async
opAliyunRpcReq
(
pobj
,
params
)
{
try
{
// var action = obj.action;
// var reqbody = obj.reqbody;
// var rpcParam = obj.rpcParam;
var
aliyunClient
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
await
aliyunClient
.
reqCustomByGet
(
params
);
return
rtn
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReq"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->opAliyunRpcReq"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
async
restPostWithHAuthorizationUrl
(
pobj
,
userToken
,
url
)
{
//curl请求带请求头信息
try
{
var
rtn
=
await
this
.
restClient
.
restPostWithHAuthorizationUrl
(
userToken
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"restPostWithHAuthorizationUrl data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/restPostWithHAuthorizationUrl"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->restPostWithHAuthorizationUrl"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
}
// /**
// * 阿里RPC调用-post请求
// * @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
// * @param {*} params {为阿里的接口参数}
// */
// async opAliyunRpcReqByPost(pobj, params) {
// try {
// // var action = obj.action;
// // var reqbody = obj.reqbody;
// // var rpcParam = obj.rpcParam;
// var aliyunClient = system.getObject("util.aliyunClient");
// var rtn = await aliyunClient.reqCustomByPost(params);
// return rtn;
// } catch (e) {
// var errorMsg = "error:" + e.stack;
// //日志记录
// this.logCtl.error({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
// requestId: pobj.requestId || "",
// op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReqByPost",
// content: errorMsg,
// // clientIp: pobj.clientIp,
// optitle: pobj.opType + "推送操作异常->opAliyunRpcReqByPost",
// });
// return system.getResult(null, errorMsg);
// }
// }
/**
* 处理成功后的信息
* @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
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
failType
||
3
,
opTitle
:
opType
+
"推送操作失败->"
+
opTitleDesc
,
pushNumber
:
pobj
.
pushNumber
||
1
});
result
.
data
=
null
;
return
result
;
async
execPostUrl
(
pobj
,
url
)
{
try
{
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/execPostUrl"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"基类操作异常->execPostUrl"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"推送业务类型:"
+
opType
,
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
returnType
:
'1'
,
opTitle
:
opType
+
"数据推送成功->"
+
opTitleDesc
});
// TODO 更改需求推送状态
if
(
opType
.
indexOf
(
'Need'
)
>=
0
&&
opType
.
indexOf
(
'Business'
)
>=
0
){
pobj
.
actionType
=
'updateNeedPushStatus'
;
let
url
=
settings
.
centerOrderUrl
()
+
'action/opNeed/springBoard'
;
let
result
=
await
this
.
execPostByTimeOut
(
null
,
pobj
,
url
,
null
,
null
,
60
);
async
opAliyunRpcVerifyParam
(
pobj
)
{
//参数信息验证
var
verify
=
system
.
getResultSuccess
();
if
(
!
pobj
.
interface_params
)
{
verify
=
system
.
getResult
(
null
,
"interface_params can not be empty,100440"
);
}
var
interface_params_info
=
JSON
.
parse
(
pobj
.
interface_params
);
if
(
!
interface_params_info
||
!
interface_params_info
.
action
)
{
verify
=
system
.
getResult
(
null
,
"interface_params.action can not be empty,100443"
);
}
verify
.
data
=
interface_params_info
;
return
verify
;
}
// result.data = null;
return
result
;
}
/**
* 处理失败的结果信息--内部使用
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType this.pushlogFailType
*/
async
disposePushResultFail
(
pobj
,
result
,
opTitleDesc
,
failType
)
{
//处理失败的结果信息--内部使用
var
opType
=
pobj
.
opType
||
""
;
this
.
pushlogSve
.
createFailLogDb
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
failType
||
3
,
opTitle
:
opType
+
"推送操作失败->"
+
opTitleDesc
,
pushNumber
:
pobj
.
pushNumber
||
1
});
result
.
data
=
null
;
return
result
;
}
async
getAliossjavaFileUrl
(
pobj
,
params
)
{
//上传ali oss 文件调用
var
opType
=
pobj
.
opType
||
""
;
try
{
var
aliOssFileInfo
=
await
this
.
execPostUrl
(
params
,
settings
.
aliossjavaUrl
());
if
(
aliOssFileInfo
==
true
)
{
var
fileUrl
=
params
.
filedir
+
"/"
+
params
.
objectName
;
return
system
.
getResultSuccess
(
fileUrl
);
}
this
.
pushlogSve
.
createFailLogDb
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
params
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
aliOssFileInfo
),
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
3
,
opTitle
:
opType
+
"aliossjava-upload阿里上传文件操作失败->getAliossjavaFileUrl"
,
pushNumber
:
1
});
return
system
.
getResult
(
null
,
"java ali oss upload fail"
);
}
catch
(
e
)
{
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/getAliossjavaFileUrl"
,
content
:
"error:"
+
e
.
stack
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
||
""
+
"aliossjava-upload阿里上传文件操作异常->getAliossjavaFileUrl"
,
});
return
system
.
getResult
(
-
200
,
"java ali oss upload error"
);
/**
* 阿里RPC调用
* @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
* @param {*} params {为阿里的接口参数}
*/
async
opAliyunRpcReq
(
pobj
,
params
)
{
try
{
// var action = obj.action;
// var reqbody = obj.reqbody;
// var rpcParam = obj.rpcParam;
var
aliyunClient
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
await
aliyunClient
.
reqCustomByGet
(
params
);
return
rtn
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReq"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->opAliyunRpcReq"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
}
async
opDownFileInfo
(
docUrl
,
result
)
{
//从oss下载到本地并上传到自己oss,之后删除本地文件
/*docUrl下载链接,全路径,如:https://XXXXXX.pdf?XXXXX */
try
{
var
tmpFileName
=
docUrl
.
substring
(
0
,
docUrl
.
lastIndexOf
(
"?"
));
var
fileName
=
tmpFileName
.
substr
(
tmpFileName
.
lastIndexOf
(
"/"
)
+
1
,
tmpFileName
.
lenght
);
var
fileType
=
tmpFileName
.
substr
(
tmpFileName
.
lastIndexOf
(
"."
)
+
1
,
tmpFileName
.
lenght
);
//解码后的文件全名:xxx.pdf
var
fileAllName
=
decodeURIComponent
(
fileName
);
//为xxx.pdf
var
saveFilePath
=
'/tmp/'
+
fileAllName
;
// 下载文件到指定的路径
var
tmpp
=
await
this
.
restClient
.
execDownload
(
"'"
+
docUrl
+
"'"
,
saveFilePath
);
//上传 saveFilePath的文件 到ossClient
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
var
upFileName
=
"alifile_"
+
u
+
"."
+
fileType
;
var
rtn
=
await
this
.
ossClient
.
upfile
(
upFileName
,
saveFilePath
);
result
.
data
=
rtn
;
//删除本地文件
fs
.
unlink
(
saveFilePath
,
function
(
err
)
{
});
}
catch
(
e
)
{
result
.
code
=
-
200
;
result
.
message
=
"通过flowId获取到的文件url下载操作异常异常error"
;
console
.
log
(
e
.
stack
);
//日志记录
logCtl
.
error
({
optitle
:
"e签宝通过flowId获取到的文件url下载操作异常异常error"
,
op
:
"base/service/impl/utilesignbaoSve/opDownFileInfo"
,
content
:
"请求参数:docUrl="
+
docUrl
+
",异常信息error:"
+
e
.
stack
,
clientIp
:
""
});
// /**
// * 阿里RPC调用-post请求
// * @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
// * @param {*} params {为阿里的接口参数}
// */
// async opAliyunRpcReqByPost(pobj, params) {
// try {
// // var action = obj.action;
// // var reqbody = obj.reqbody;
// // var rpcParam = obj.rpcParam;
// var aliyunClient = system.getObject("util.aliyunClient");
// var rtn = await aliyunClient.reqCustomByPost(params);
// return rtn;
// } catch (e) {
// var errorMsg = "error:" + e.stack;
// //日志记录
// this.logCtl.error({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
// requestId: pobj.requestId || "",
// op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReqByPost",
// content: errorMsg,
// // clientIp: pobj.clientIp,
// optitle: pobj.opType + "推送操作异常->opAliyunRpcReqByPost",
// });
// return system.getResult(null, errorMsg);
// }
// }
/**
* 处理成功后的信息
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType this.pushlogFailType
*/
async
disposePushResult
(
pobj
,
result
,
opTitleDesc
,
failType
)
{
//处理结果信息--内部使用
let
opType
=
pobj
.
opType
||
""
;
let
content
=
JSON
.
stringify
(
pobj
);
if
(
result
.
status
!=
0
)
{
return
this
.
disposePushResultFail
(
pobj
,
result
,
opTitleDesc
,
failType
);
}
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"推送业务类型:"
+
opType
,
content
:
content
,
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
returnType
:
'1'
,
opTitle
:
opType
+
"数据推送成功->"
+
opTitleDesc
});
// 更改需求推送状态
if
(
opType
.
indexOf
(
'Need'
)
>=
0
&&
opType
.
indexOf
(
'Business'
)
>=
0
)
{
pobj
.
actionType
=
'updateNeedPushStatus'
;
let
url
=
settings
.
centerOrderUrl
()
+
'action/opNeed/springBoard'
;
this
.
execPostByTimeOut
(
null
,
pobj
,
url
,
null
,
null
,
60
);
}
if
([
"pushOrder"
,
"pushOrderBusiness"
,
"pushOrderICPBusiness"
].
includes
(
opType
)
&&
pobj
.
actionBody
&&
pobj
.
actionBody
.
orderNo
)
{
pobj
.
actionBody
.
pushNumber
=
pobj
.
pushNumber
||
1
;
pobj
.
actionBody
.
pushStatus
=
3
;
//推送状态0待推送2推送失败3已成功推送
this
.
disposeOrderPush
(
pobj
);
}
return
result
;
}
return
result
;
}
async
getOpInterfaceByProductId
(
appInfo
,
product_id
)
{
//获取产品调用接口
var
getProductInterfaceUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
getProductInterfaceObj
=
{
"actionType"
:
"getProductInterface"
,
"appInfo"
:
appInfo
,
"actionBody"
:
{
"product_id"
:
product_id
}
};
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
getProductInterfaceObj
,
getProductInterfaceUrl
);
return
productItemInterfaceResult
;
}
/**
* 处理失败的结果信息--内部使用
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType this.pushlogFailType
*/
async
disposePushResultFail
(
pobj
,
result
,
opTitleDesc
,
failType
)
{
//处理失败的结果信息--内部使用
var
opType
=
pobj
.
opType
||
""
;
let
pushNumber
=
pobj
.
pushNumber
||
1
;
let
resultInfo
=
JSON
.
stringify
(
result
);
this
.
pushlogSve
.
createFailLogDb
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
resultInfo
,
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
failType
||
3
,
opTitle
:
opType
+
"推送操作失败->"
+
opTitleDesc
,
pushNumber
:
pushNumber
});
result
.
data
=
null
;
if
(
pushNumber
==
10
&&
resultInfo
.
indexOf
(
"订单产品查询出来产品与传递得产品数量不一致,请重新选择"
)
>=
0
)
{
pobj
.
actionBody
.
pushNumber
=
pushNumber
;
pobj
.
actionBody
.
pushStatus
=
2
;
//推送状态0待推送2推送失败3已成功推送
this
.
disposeOrderPushFailSendDing
(
pobj
);
this
.
disposeOrderPush
(
pobj
);
}
return
result
;
}
async
getConvertSemiangleStr
(
str
)
{
//去除空格及全角转半角
var
result
=
""
;
str
=
str
.
replace
(
/
\s
+/g
,
""
);
var
len
=
str
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
var
cCode
=
str
.
charCodeAt
(
i
);
//全角与半角相差(除空格外):65248(十进制)
cCode
=
(
cCode
>=
0xFF01
&&
cCode
<=
0xFF5E
)
?
(
cCode
-
65248
)
:
cCode
;
//处理空格
cCode
=
(
cCode
==
0x03000
)
?
0x0020
:
cCode
;
result
+=
String
.
fromCharCode
(
cCode
);
async
disposeOrderPushFailSendDing
(
pobj
)
{
let
params
=
{
orderNo
:
pobj
.
actionBody
.
orderNo
,
city
:
pobj
.
actionBody
.
city
,
area
:
pobj
.
actionBody
.
area
,
companyCategory
:
pobj
.
actionBody
.
companyCategory
,
appName
:
pobj
.
actionBody
.
appName
,
sku
:
pobj
.
actionBody
.
sku
,
error
:
"订单产品查询出来产品与传递得产品数量不一致,请重新选择!"
}
this
.
dingClient
.
businessPushFqByChannel
(
params
);
}
return
result
;
}
/*
返回20位业务订单号
prefix:业务前缀
*/
async
getBusUid
(
prefix
)
{
prefix
=
(
prefix
||
""
);
if
(
prefix
)
{
prefix
=
prefix
.
toUpperCase
();
async
disposeOrderPush
(
pobj
)
{
pobj
.
actionType
=
'updateOrderPushStatus'
;
let
url
=
settings
.
centerOrderUrl
()
+
'action/order/springBoard'
;
this
.
execPostByTimeOut
(
null
,
pobj
,
url
,
null
,
null
,
60
);
}
var
prefixlength
=
prefix
.
length
;
var
subLen
=
8
-
prefixlength
;
var
uidStr
=
""
;
if
(
subLen
>
0
)
{
uidStr
=
await
this
.
getUidInfo
(
subLen
,
60
);
async
getAliossjavaFileUrl
(
pobj
,
params
)
{
//上传ali oss 文件调用
var
opType
=
pobj
.
opType
||
""
;
try
{
var
aliOssFileInfo
=
await
this
.
execPostUrl
(
params
,
settings
.
aliossjavaUrl
());
if
(
aliOssFileInfo
==
true
)
{
var
fileUrl
=
params
.
filedir
+
"/"
+
params
.
objectName
;
return
system
.
getResultSuccess
(
fileUrl
);
}
this
.
pushlogSve
.
createFailLogDb
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
params
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
aliOssFileInfo
),
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
3
,
opTitle
:
opType
+
"aliossjava-upload阿里上传文件操作失败->getAliossjavaFileUrl"
,
pushNumber
:
1
});
return
system
.
getResult
(
null
,
"java ali oss upload fail"
);
}
catch
(
e
)
{
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/app.base.js/getAliossjavaFileUrl"
,
content
:
"error:"
+
e
.
stack
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
||
""
+
"aliossjava-upload阿里上传文件操作异常->getAliossjavaFileUrl"
,
});
return
system
.
getResult
(
-
200
,
"java ali oss upload error"
);
}
}
var
timStr
=
moment
().
format
(
"YYYYMMDDHHmm"
);
return
prefix
+
timStr
+
uidStr
;
}
/*
len:返回长度
radix:参与计算的长度,最大为62
*/
async
getUidInfo
(
len
,
radix
)
{
var
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
//长度62,到yz长度为长36
var
uuid
=
[],
i
;
radix
=
radix
||
chars
.
length
;
if
(
len
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
var
r
;
uuid
[
8
]
=
uuid
[
13
]
=
uuid
[
18
]
=
uuid
[
23
]
=
'-'
;
uuid
[
14
]
=
'4'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
r
=
0
|
Math
.
random
()
*
16
;
uuid
[
i
]
=
chars
[(
i
==
19
)
?
(
r
&
0x3
)
|
0x8
:
r
];
}
}
async
opDownFileInfo
(
docUrl
,
result
)
{
//从oss下载到本地并上传到自己oss,之后删除本地文件
/*docUrl下载链接,全路径,如:https://XXXXXX.pdf?XXXXX */
try
{
var
tmpFileName
=
docUrl
.
substring
(
0
,
docUrl
.
lastIndexOf
(
"?"
));
var
fileName
=
tmpFileName
.
substr
(
tmpFileName
.
lastIndexOf
(
"/"
)
+
1
,
tmpFileName
.
lenght
);
var
fileType
=
tmpFileName
.
substr
(
tmpFileName
.
lastIndexOf
(
"."
)
+
1
,
tmpFileName
.
lenght
);
//解码后的文件全名:xxx.pdf
var
fileAllName
=
decodeURIComponent
(
fileName
);
//为xxx.pdf
var
saveFilePath
=
'/tmp/'
+
fileAllName
;
// 下载文件到指定的路径
var
tmpp
=
await
this
.
restClient
.
execDownload
(
"'"
+
docUrl
+
"'"
,
saveFilePath
);
//上传 saveFilePath的文件 到ossClient
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
var
upFileName
=
"alifile_"
+
u
+
"."
+
fileType
;
var
rtn
=
await
this
.
ossClient
.
upfile
(
upFileName
,
saveFilePath
);
result
.
data
=
rtn
;
//删除本地文件
fs
.
unlink
(
saveFilePath
,
function
(
err
)
{
});
}
catch
(
e
)
{
result
.
code
=
-
200
;
result
.
message
=
"通过flowId获取到的文件url下载操作异常异常error"
;
console
.
log
(
e
.
stack
);
//日志记录
logCtl
.
error
({
optitle
:
"e签宝通过flowId获取到的文件url下载操作异常异常error"
,
op
:
"base/service/impl/utilesignbaoSve/opDownFileInfo"
,
content
:
"请求参数:docUrl="
+
docUrl
+
",异常信息error:"
+
e
.
stack
,
clientIp
:
""
});
}
return
result
;
}
return
uuid
.
join
(
''
);
}
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
}
/**
* 加密信息
* @param {*} encrypt_key
* @param {*} encrypt_secret
* @param {*} opStr
*/
async
encryptStr
(
encrypt_key
,
encrypt_secret
,
opStr
)
{
if
(
!
opStr
)
{
return
system
.
getResult
(
null
,
"opStr is empty"
);
async
getOpInterfaceByProductId
(
appInfo
,
product_id
)
{
//获取产品调用接口
var
getProductInterfaceUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
getProductInterfaceObj
=
{
"actionType"
:
"getProductInterface"
,
"appInfo"
:
appInfo
,
"actionBody"
:
{
"product_id"
:
product_id
}
};
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
getProductInterfaceObj
,
getProductInterfaceUrl
);
return
productItemInterfaceResult
;
}
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
encrypt_secret
.
substring
(
0
,
8
));
var
cipherStr
=
cryptoJS
.
TripleDES
.
encrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
}).
toString
()
;
return
cipherStr
;
}
/**
* 解密信息
* @param {*} encrypt_key
* @param {*} encrypt_secret
* @param {*} opStr
*/
async
decryptStr
(
encrypt_key
,
encrypt_secret
,
opStr
)
{
if
(
!
opStr
)
{
return
system
.
getResult
(
null
,
"opStr is empty"
)
;
async
getConvertSemiangleStr
(
str
)
{
//去除空格及全角转半角
var
result
=
""
;
str
=
str
.
replace
(
/
\s
+/g
,
""
)
;
var
len
=
str
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
var
cCode
=
str
.
charCodeAt
(
i
);
//全角与半角相差(除空格外):65248(十进制)
cCode
=
(
cCode
>=
0xFF01
&&
cCode
<=
0xFF5E
)
?
(
cCode
-
65248
)
:
cCode
;
//处理空格
cCode
=
(
cCode
==
0x03000
)
?
0x0020
:
cCode
;
result
+=
String
.
fromCharCode
(
cCode
);
}
return
result
;
}
try
{
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
encrypt_secret
.
substring
(
0
,
8
));
var
bytes
=
cryptoJS
.
TripleDES
.
decrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
});
var
plaintext
=
bytes
.
toString
(
cryptoJS
.
enc
.
Utf8
);
if
(
!
plaintext
)
{
return
system
.
getResult
(
null
,
"解密失败"
+
opStr
);
}
return
system
.
getResultSuccess
(
plaintext
);
}
catch
(
error
)
{
return
system
.
getResultFail
(
-
200
,
"解密异常:"
+
opStr
);
/*
返回20位业务订单号
prefix:业务前缀
*/
async
getBusUid
(
prefix
)
{
prefix
=
(
prefix
||
""
);
if
(
prefix
)
{
prefix
=
prefix
.
toUpperCase
();
}
var
prefixlength
=
prefix
.
length
;
var
subLen
=
8
-
prefixlength
;
var
uidStr
=
""
;
if
(
subLen
>
0
)
{
uidStr
=
await
this
.
getUidInfo
(
subLen
,
60
);
}
var
timStr
=
moment
().
format
(
"YYYYMMDDHHmm"
);
return
prefix
+
timStr
+
uidStr
;
}
}
/**
* 带超时时间的post请求
* @param {*} req 请求信息
* @param {*} params 请求数据-json格式
* @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间
*/
async
execPostByTimeOut
(
req
,
params
,
url
,
ContentType
,
headData
,
timeOut
=
60
)
{
const
result
=
await
this
.
execClientNew
.
execPostTimeOutByBusiness
(
'sve.base'
,
params
,
url
,
ContentType
,
headData
,
timeOut
,
req
);
return
result
;
}
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_secret 应用的校验key
*/
async
verifySign
(
params
,
app_secret
)
{
if
(
!
params
)
{
return
system
.
getResult
(
null
,
"请求参数为空"
);
/*
len:返回长度
radix:参与计算的长度,最大为62
*/
async
getUidInfo
(
len
,
radix
)
{
var
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
//长度62,到yz长度为长36
var
uuid
=
[],
i
;
radix
=
radix
||
chars
.
length
;
if
(
len
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
var
r
;
uuid
[
8
]
=
uuid
[
13
]
=
uuid
[
18
]
=
uuid
[
23
]
=
'-'
;
uuid
[
14
]
=
'4'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
r
=
0
|
Math
.
random
()
*
16
;
uuid
[
i
]
=
chars
[(
i
==
19
)
?
(
r
&
0x3
)
|
0x8
:
r
];
}
}
}
return
uuid
.
join
(
''
);
}
if
(
!
params
.
sign
)
{
return
system
.
getResult
(
null
,
"请求参数sign为空"
);
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
}
var
signArr
=
[];
var
keys
=
Object
.
keys
(
params
).
sort
();
if
(
keys
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数信息为空"
);
/**
* 加密信息
* @param {*} encrypt_key
* @param {*} encrypt_secret
* @param {*} opStr
*/
async
encryptStr
(
encrypt_key
,
encrypt_secret
,
opStr
)
{
if
(
!
opStr
)
{
return
system
.
getResult
(
null
,
"opStr is empty"
);
}
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
encrypt_secret
.
substring
(
0
,
8
));
var
cipherStr
=
cryptoJS
.
TripleDES
.
encrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
}).
toString
();
return
cipherStr
;
}
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
params
[
tKey
])
{
let
tmpKeyValue
=
params
[
tKey
];
if
(
tmpKeyValue
instanceof
Array
||
tmpKeyValue
instanceof
Object
)
{
tmpKeyValue
=
JSON
.
stringify
(
tmpKeyValue
);
}
signArr
.
push
(
tKey
+
"="
+
tmpKeyValue
);
}
/**
* 解密信息
* @param {*} encrypt_key
* @param {*} encrypt_secret
* @param {*} opStr
*/
async
decryptStr
(
encrypt_key
,
encrypt_secret
,
opStr
)
{
if
(
!
opStr
)
{
return
system
.
getResult
(
null
,
"opStr is empty"
);
}
try
{
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
encrypt_secret
.
substring
(
0
,
8
));
var
bytes
=
cryptoJS
.
TripleDES
.
decrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
});
var
plaintext
=
bytes
.
toString
(
cryptoJS
.
enc
.
Utf8
);
if
(
!
plaintext
)
{
return
system
.
getResult
(
null
,
"解密失败"
+
opStr
);
}
return
system
.
getResultSuccess
(
plaintext
);
}
catch
(
error
)
{
return
system
.
getResultFail
(
-
200
,
"解密异常:"
+
opStr
);
}
}
if
(
signArr
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数组装签名参数信息为空"
);
/**
* 带超时时间的post请求
* @param {*} req 请求信息
* @param {*} params 请求数据-json格式
* @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间
*/
async
execPostByTimeOut
(
req
,
params
,
url
,
ContentType
,
headData
,
timeOut
=
60
)
{
const
result
=
await
this
.
execClientNew
.
execPostTimeOutByBusiness
(
'sve.base'
,
params
,
url
,
ContentType
,
headData
,
timeOut
,
req
);
return
result
;
}
var
resultSignStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
app_secret
;
var
resultTmpSign
=
md5
(
resultSignStr
).
toUpperCase
();
if
(
params
.
sign
!=
resultTmpSign
)
{
return
system
.
getResult
(
null
,
"返回值签名验证失败"
);
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_secret 应用的校验key
*/
async
verifySign
(
params
,
app_secret
)
{
if
(
!
params
)
{
return
system
.
getResult
(
null
,
"请求参数为空"
);
}
if
(
!
params
.
sign
)
{
return
system
.
getResult
(
null
,
"请求参数sign为空"
);
}
var
signArr
=
[];
var
keys
=
Object
.
keys
(
params
).
sort
();
if
(
keys
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数信息为空"
);
}
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
params
[
tKey
])
{
let
tmpKeyValue
=
params
[
tKey
];
if
(
tmpKeyValue
instanceof
Array
||
tmpKeyValue
instanceof
Object
)
{
tmpKeyValue
=
JSON
.
stringify
(
tmpKeyValue
);
}
signArr
.
push
(
tKey
+
"="
+
tmpKeyValue
);
}
}
if
(
signArr
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数组装签名参数信息为空"
);
}
var
resultSignStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
app_secret
;
var
resultTmpSign
=
md5
(
resultSignStr
).
toUpperCase
();
if
(
params
.
sign
!=
resultTmpSign
)
{
return
system
.
getResult
(
null
,
"返回值签名验证失败"
);
}
return
system
.
getResultSuccess
();
}
return
system
.
getResultSuccess
();
}
async
getFQbossSign
(
pobj
){
var
signArr
=
[];
var
keys
=
Object
.
keys
(
pobj
).
sort
();
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
pobj
[
tKey
])
{
signArr
.
push
(
tKey
+
"="
+
pobj
[
tKey
]);
}
async
getFQbossSign
(
pobj
)
{
var
signArr
=
[];
var
keys
=
Object
.
keys
(
pobj
).
sort
();
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
pobj
[
tKey
])
{
signArr
.
push
(
tKey
+
"="
+
pobj
[
tKey
]);
}
}
var
resultSignStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
"9c83f5f5c41347fc9bb47951fef3199b"
;
return
md5
(
resultSignStr
).
toUpperCase
();
}
var
resultSignStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
"9c83f5f5c41347fc9bb47951fef3199b"
;
return
md5
(
resultSignStr
).
toUpperCase
();
}
}
module
.
exports
=
AppServiceBase
;
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
View file @
f738b05e
...
...
@@ -801,7 +801,11 @@ class BaseCenterOrderService extends AppServiceBase {
var
pushObj
=
{
BizId
:
res
.
data
.
BizId
,
OfficialFileURL
:
res
.
data
.
OfficialFileURL
,
ApplicationStatus
:
res
.
data
.
ApplicationStatus
ApplicationStatus
:
res
.
data
.
ApplicationStatus
,
//2021-3-18 addNew
CertificateNumber
:
res
.
data
.
CertificateNumber
||
""
,
//证书编号
CertificateStartTime
:
res
.
data
.
CertificateStartTime
||
""
,
//证书有效期 开始时间
CertificateEndTime
:
res
.
data
.
CertificateEndTime
||
""
//证书有效期 结束时间
};
//推送状态变更
var
ali
=
await
this
.
aliclient
.
reqbyget
({
action
:
"AcceptPartnerNotification"
,
reqbody
:
pushObj
,
apiVersion
:
"2019-05-08"
});
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
f738b05e
...
...
@@ -123,6 +123,85 @@ class UtilsNeedService extends AppServiceBase {
return
result
;
}
/**
* 提交商标需求,对接百度云商标
* @param {*} pobj
* @param {*} actionBody
*/
async
submitTmNeed
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
type
&&
actionBody
.
consultType
)
actionBody
.
type
=
actionBody
.
consultType
if
(
!
actionBody
.
intentionBizId
)
{
return
system
.
getResult
(
null
,
"actionBody.intentionBizId can not be empty,100380"
);
}
var
sobj
=
pobj
;
sobj
.
actionType
=
"getProductTypeInfo"
;
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
rtn
=
await
this
.
execClient
.
execPost
(
sobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5015
,
"需求类型查询失败"
);
}
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
data
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5015
,
"需求类型查询失败"
);
}
pobj
.
actionBody
.
type_code
=
data
.
data
.
type_code
;
pobj
.
actionBody
.
type_name
=
data
.
data
.
type_name
;
pobj
.
actionBody
.
channel_type_code
=
data
.
data
.
channel_type_code
;
pobj
.
actionBody
.
channel_type_name
=
data
.
data
.
channel_type_name
;
pobj
.
actionBody
.
type
=
pobj
.
actionBody
.
channel_type_code
;
pobj
.
actionBody
.
phone
=
pobj
.
actionBody
.
phone
||
pobj
.
actionBody
.
mobile
;
pobj
.
actionBody
.
appName
=
pobj
.
appInfo
.
app_name
;
pobj
.
actionBody
.
idempotentId
=
pobj
.
actionBody
.
intentionBizId
;
pobj
.
actionBody
.
idempotentSourceName
=
pobj
.
appInfo
.
app_name
;
if
(
pobj
.
actionBody
.
channel_type_code
==
5
)
{
pobj
.
actionBody
.
type
=
"ali.icp"
;
pobj
.
actionBody
.
idempotentSource
=
"icp_ali"
;
}
else
if
(
pobj
.
actionBody
.
channel_type_code
==
7
)
{
pobj
.
actionBody
.
type
=
"ali.edi"
;
pobj
.
actionBody
.
idempotentSource
=
"edi_ali"
;
}
else
if
(
pobj
.
actionBody
.
channel_type_code
==
"tmjy"
)
{
pobj
.
actionBody
.
type
=
"ali.tmd"
;
pobj
.
actionBody
.
idempotentSource
=
"tmd_ali"
;
}
else
if
(
pobj
.
actionBody
.
channel_type_code
==
1
)
{
pobj
.
actionBody
.
type
=
"ali.tmd"
;
pobj
.
actionBody
.
idempotentSource
=
"tmd_ali"
;
}
else
if
(
pobj
.
actionBody
.
channel_type_code
==
2
)
{
pobj
.
actionBody
.
type
=
"ali.tm"
;
pobj
.
actionBody
.
idempotentSource
=
"tm_ali"
;
}
else
if
(
pobj
.
actionBody
.
channel_type_code
==
'esp.companyreg'
){
pobj
.
actionBody
.
type
=
"ali.ic"
;
pobj
.
actionBody
.
idempotentSource
=
"ic_ali"
;
}
else
if
(
pobj
.
actionBody
.
channel_type_code
==
'esp.companyreg_cloud'
){
pobj
.
actionBody
.
type
=
"ali.ic"
;
pobj
.
actionBody
.
idempotentSource
=
"ic_ali"
;
}
if
(
pobj
.
appInfo
.
uapp_id
==
'44'
){
//百度云
if
(
pobj
.
actionBody
.
channel_type_code
==
1
)
{
pobj
.
actionBody
.
type
=
"baidu.tmd"
;
pobj
.
actionBody
.
idempotentSource
=
"tmd_baidu"
;
}
else
if
(
pobj
.
actionBody
.
channel_type_code
==
2
)
{
pobj
.
actionBody
.
type
=
"baidu.tm"
;
pobj
.
actionBody
.
idempotentSource
=
"tm_baidu"
;
}
}
if
(
pobj
.
actionBody
.
description
&&
pobj
.
actionBody
.
description
.
indexOf
(
"备#"
)
<
0
)
{
pobj
.
actionBody
.
level
=
"A"
;
}
else
{
pobj
.
actionBody
.
level
=
"C"
}
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
pobj
.
actionBody
.
level
=
"F"
;
}
pobj
.
actionType
=
"submitNeed"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
.
status
==
0
)
{
this
.
utilsPushSve
.
business2Fq
(
pobj
,
"pushNeedTMBusiness"
);
}
return
result
;
}
//调用center-order icp需求反馈
async
reqCenterOrderQcApi
(
pobj
,
reqUrl
)
{
...
...
@@ -157,6 +236,47 @@ class UtilsNeedService extends AppServiceBase {
return
data
;
}
//商标需求反馈
async
tmFeedbackSubmit
(
pobj
)
{
var
url
=
this
.
centerOrderUrl
+
"action/qcapi/springBoard"
;
var
self
=
this
;
pobj
.
actionType
=
"receiveIcpFeedback"
;
if
(
pobj
.
actionBody
&&
pobj
.
actionBody
.
intentionStatus
)
{
pobj
.
intentionStatus
=
pobj
.
actionBody
.
intentionStatus
;
}
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
data
.
data
&&
(
data
.
data
.
channelTypeCode
==
1
||
data
.
data
.
channelTypeCode
==
2
))
{
//商标
pobj
.
actionBody
.
status
=
"888"
this
.
execPostUrl
({
"actionProcess"
:
"AliTm"
,
"appCode"
:
"100099"
,
"sign"
:
await
this
.
getFQbossSign
(
pobj
.
actionBody
),
actionBody
:
pobj
.
actionBody
},
settings
.
fqbossTmUrl
())
self
.
utilsPushSve
.
business2Fq
(
pobj
,
"pushTMFeedback"
);
}
return
data
;
}
//商标状态通知
async
tmStatusNotify
(
pobj
)
{
var
self
=
this
;
// 引用属性,channel依赖bizId order依赖intentionBizId
pobj
.
intentionBizId
=
pobj
.
bizId
var
sobj
=
{
"actionType"
:
"getItemByChannelSolutionNo"
,
"actionBody"
:
pobj
}
var
result
=
this
.
getItemByChannelSolutionNo
(
sobj
,
sobj
.
actionBody
);
if
(
result
.
status
==
0
)
{
let
pushres
=
await
this
.
execPostUrl
({
"actionProcess"
:
"AliTm"
,
"appCode"
:
"100099"
,
"sign"
:
await
this
.
getFQbossSign
(
pobj
),
actionBody
:
pobj
},
settings
.
fqbossTmUrl
())
console
.
log
(
"推送fqboos----->"
,
pushres
)
return
this
.
getResult
(
result
.
requestId
,
pushres
.
message
);
}
return
this
.
getResult
(
result
.
requestId
)
}
/**
* 提交需求-----del
* @param {*} pobj
...
...
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
f738b05e
...
...
@@ -76,6 +76,28 @@ class UtilsPushService extends AppServiceBase {
return
system
.
getResult
(
null
,
"push Fail,interface_info data is empty"
);
}
async
business2Fq
(
pobj
,
opType
)
{
//供业务调用,在代码中调用,不在db中做配置进行调用
pobj
.
actionType
=
"getAppInterface"
;
var
reqUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
pobj
.
interface_info
=
productItemInterfaceResult
.
data
;
//日志记录
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/utilsSve/utilsPushSve.js/service/app.base.js/business2Fq"
,
content
:
JSON
.
stringify
(
pobj
),
resultInfo
:
productItemInterfaceResult
.
data
?
JSON
.
stringify
(
productItemInterfaceResult
.
data
)
:
"接口数据为空"
,
optitle
:
pobj
.
opType
+
"推送蜂擎获取的接口信息->business2Fq"
,
});
if
(
pobj
.
interface_info
)
{
await
this
.
pushBusInfo
(
pobj
,
opType
,
1
);
return
system
.
getResultSuccess
();
}
return
system
.
getResult
(
null
,
"push Fail,interface_info data is empty"
);
}
async
pushBusInfo
(
pobj
,
opType
,
isDelProductInfo
)
{
//推送业务总入口,不在db中做配置进行调用
console
.
log
(
JSON
.
stringify
(
pobj
),
".......pushBusInfo........................."
+
opType
);
var
interface_list
=
pobj
.
interface_info
?
pobj
.
interface_info
:
pobj
.
actionBody
.
product_info
.
interface_info
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsTmOrderCallSve.js
View file @
f738b05e
...
...
@@ -140,8 +140,8 @@ class UtilsTmOrderCallService extends AppServiceBase {
}
var
getjsonurl
=
settings
.
tmtransactionUrl
()
+
"/tmtransaction/action/trademarktransaction/springBoard"
var
jsonurl
=
await
this
.
restPostUrl
(
obj
,
getjsonurl
);
if
(
!
jsonurl
){
console
.
log
(
jsonurl
);
if
(
!
jsonurl
||
!
jsonurl
.
data
){
console
.
log
(
`createjsonfile返回错误,返回值:
${
jsonurl
}
`
);
return
system
.
getResultSuccess
();
}
var
upobj
=
{
...
...
center-channel/app/base/utils/dingClient.js
View file @
f738b05e
const
system
=
require
(
"../system"
);
class
dingClient
{
constructor
()
{
this
.
execClient
=
system
.
getObject
(
'util.execClient'
);
this
.
gatewayurl
=
"https://oapi.dingtalk.com/robot/send?access_token=2f1ada261ea84f6c621db487ac18d11eba8984202bd82adda8810770a8240572"
}
//推送峰擎异常提醒
async
gatewayPushError
(
err
)
{
if
(
process
.
env
.
APP_ENV
===
"prod"
)
{
let
c
=
`注意提醒:阿里->推送峰擎异常,老板们加油,加油,加油 !!!
${
JSON
.
stringify
(
err
)}
`
let
t
=
new
Date
().
toLocaleString
()
this
.
execClient
.
execPost
({
"msgtype"
:
"text"
,
"text"
:
{
"content"
:
t
+
c
}
},
this
.
gatewayurl
).
catch
(
alierr
=>
{
console
.
log
(
alierr
)
});
constructor
()
{
this
.
execClient
=
system
.
getObject
(
'util.execClient'
);
this
.
gatewayurl
=
"https://oapi.dingtalk.com/robot/send?access_token=2f1ada261ea84f6c621db487ac18d11eba8984202bd82adda8810770a8240572"
this
.
businessToFqUrl
=
"https://oapi.dingtalk.com/robot/send?access_token=9e215f0f1d77980ee6b39e88a82a7c6e5d290775f76d9a8346e97697f8df9788"
}
//推送峰擎异常提醒
async
gatewayPushError
(
err
)
{
if
(
process
.
env
.
APP_ENV
===
"prod"
)
{
let
c
=
`注意提醒:阿里->推送峰擎异常,老板们加油,加油,加油 !!!
${
JSON
.
stringify
(
err
)}
`
let
t
=
new
Date
().
toLocaleString
()
this
.
execClient
.
execPost
({
"msgtype"
:
"text"
,
"text"
:
{
"content"
:
t
+
c
}
},
this
.
gatewayurl
).
catch
(
alierr
=>
{
console
.
log
(
alierr
)
});
}
}
}
//渠道钉钉提醒
async
gatewayPushByChannel
(
orderNo
,
appInfo
){
let
gatewayUrl
=
setttings
.
dingRobotUrl
(
appInfo
.
uapp_id
);
if
(
settings
.
env
!=
"dev"
&&
gatewayUrl
)
{
let
c
=
`注意提醒:
${
appInfo
.
app_name
}
->有订单待处理,订单号
${
orderNo
}
,老板们加油,加油,加油 !!!`
let
t
=
new
Date
().
toLocaleString
()
this
.
execClient
.
execPost
({
"msgtype"
:
"text"
,
"text"
:
{
"content"
:
t
+
c
}
},
gatewayUrl
).
catch
(
err
=>
{
console
.
log
(
err
)
});
//渠道钉钉提醒
async
gatewayPushByChannel
(
orderNo
,
appInfo
)
{
let
gatewayUrl
=
setttings
.
dingRobotUrl
(
appInfo
.
uapp_id
);
if
(
settings
.
env
!=
"dev"
&&
gatewayUrl
)
{
let
c
=
`注意提醒:
${
appInfo
.
app_name
}
->有订单待处理,订单号
${
orderNo
}
,老板们加油,加油,加油 !!!`
let
t
=
new
Date
().
toLocaleString
()
this
.
execClient
.
execPost
({
"msgtype"
:
"text"
,
"text"
:
{
"content"
:
t
+
c
}
},
gatewayUrl
).
catch
(
err
=>
{
console
.
log
(
err
)
});
}
}
//渠道订单到峰擎--sku没有查询到
async
businessPushFqByChannel
(
params
)
{
if
(
process
.
env
.
APP_ENV
!=
"dev"
)
{
let
c
=
`注意提醒:
${
appInfo
.
app_name
}
->有订单待处理,渠道下sku查询不到,参数:
${
JSON
.
stringify
(
params
)}
,老板们加油,加油,加油 !!!`
let
t
=
new
Date
().
toLocaleString
()
this
.
execClient
.
execPost
({
"msgtype"
:
"text"
,
"text"
:
{
"content"
:
t
+
c
},
at
:
{
atMobiles
:
[
"13051727697"
,
"13453222948"
,
"18201231253"
]
//孟令强、王斌、郭峰
},
},
this
.
businessToFqUrl
).
catch
(
err
=>
{
console
.
log
(
err
)
});
}
}
}
}
module
.
exports
=
dingClient
;
center-channel/app/config/businessConfig.js
View file @
f738b05e
...
...
@@ -48,7 +48,12 @@ module.exports = {
"/api/ic/feedback/submit"
,
"/api/ic/order/notify"
,
"/api/ic/order/close"
,
"/api/ic/tool/icname"
"/api/ic/tool/icname"
,
"/api/tm/consultation/submit"
,
"/api/tm/feedback/submit"
,
"/api/tm/status/notify"
,
"/api/tm/tmcase/nbtzreceiveAssistTmData"
,
"/api/tm/tmcase/nbtzreceiveEditAssistTmData"
]
}
}
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