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
617bfaeb
Commit
617bfaeb
authored
Apr 12, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
3def24ac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
347 additions
and
301 deletions
+347
-301
center-channel/app/base/api/impl/auth/taskapi.js
+15
-2
center-channel/app/base/db/impl/common/pushfaillogDao.js
+9
-0
center-channel/app/base/db/models/common/pushfaillog.js
+60
-0
center-channel/app/base/service/app.base.js
+74
-12
center-channel/app/base/service/impl/common/pushlogSve.js
+29
-54
center-channel/app/base/service/impl/utilsSve/utilsAlibankSve.js
+1
-1
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
+1
-1
center-channel/app/base/service/impl/utilsSve/utilsChannelAuthSve.js
+1
-1
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
+34
-78
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
+1
-1
center-channel/app/base/service/impl/utilsSve/utilsOpOrderSve.js
+16
-15
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+48
-47
center-channel/app/base/service/impl/utilsSve/utilsProductSve.js
+1
-1
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+4
-21
center-channel/app/base/service/impl/utilsSve/utilsTmAliyunSve.js
+0
-0
center-channel/app/base/utils/aliyunClient.js
+40
-10
center-channel/app/base/utils/businessManager/pushUtils.js
+5
-53
center-channel/app/config/settings.js
+1
-1
center-channel/提示编码使用
+7
-3
No files found.
center-channel/app/base/api/impl/auth/taskapi.js
View file @
617bfaeb
...
@@ -6,15 +6,27 @@ class AccessAuthAPI extends WEBBase {
...
@@ -6,15 +6,27 @@ class AccessAuthAPI extends WEBBase {
this
.
utilsAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsAuthSve"
);
this
.
utilsAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsAuthSve"
);
this
.
gatewaypushlogSve
=
system
.
getObject
(
"service.common.gatewaypushlogSve"
);
this
.
gatewaypushlogSve
=
system
.
getObject
(
"service.common.gatewaypushlogSve"
);
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
this
.
aliclient
=
system
.
getObject
(
"util.aliyunClient"
);
}
}
async
taskAliIcapi
()
{
async
taskAliIcapi
()
{
var
rtn
=
await
this
.
gatewaypushlogSve
.
taskAliIcapi
();
var
rtn
=
await
this
.
gatewaypushlogSve
.
taskAliIcapi
();
return
rtn
;
return
rtn
;
}
}
async
taskAgainPush
BusInfo
(
pobj
,
qobj
,
req
)
{
//再次推送
业务数据
async
taskAgainPush
OneNewBusInfo
(
pobj
,
qobj
,
req
)
{
//再次推送新rpc
业务数据
var
rtn
=
await
this
.
utilsPushSve
.
againPushBusInfo
(
pobj
);
var
rtn
=
await
this
.
utilsPushSve
.
againPushBusInfo
(
pobj
);
return
rtn
;
return
rtn
;
}
}
async
taskAgainPushOneOldBusInfo
(
pobj
,
qobj
,
req
)
{
//再次推送老rpc业务数据
var
rtn
=
await
this
.
aliclient
.
reqbyget
(
pobj
)
return
rtn
;
}
// async taskAgainPushNewBusInfo(pobj, qobj, req) {//再次推送新rpc业务数据
// var rtn = await this.utilsPushSve.againPushBusInfo(pobj);
// return rtn;
// }
// async taskAgainPushOldBusInfo(pobj, qobj, req) {//再次推送老rpc业务数据
// var rtn = await this.aliclient.reqbyget(pobj)
// return rtn;
// }
}
}
module
.
exports
=
AccessAuthAPI
;
module
.
exports
=
AccessAuthAPI
;
\ No newline at end of file
center-channel/app/base/db/impl/common/pushfaillogDao.js
0 → 100644
View file @
617bfaeb
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
PushFailLogDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
PushFailLogDao
));
}
}
module
.
exports
=
PushFailLogDao
;
\ No newline at end of file
center-channel/app/base/db/models/common/pushfaillog.js
0 → 100644
View file @
617bfaeb
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"pushfaillog"
,
{
appid
:
DataTypes
.
STRING
,
appkey
:
DataTypes
.
STRING
,
requestId
:
DataTypes
.
STRING
,
content
:
DataTypes
.
TEXT
(
'long'
),
resultInfo
:
DataTypes
.
TEXT
(
'long'
),
clientIp
:
DataTypes
.
STRING
,
opTitle
:
DataTypes
.
STRING
(
500
),
failType
:
DataTypes
.
INTEGER
,
//错误类型,1为old-rpc推送失败日志,2为new-rpc推送失败日志
pushNumber
:
DataTypes
.
INTEGER
,
//推送次数
},
{
paranoid
:
false
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
timestamps
:
true
,
updatedAt
:
false
,
//freezeTableName: true,
// define the table's name
tableName
:
'center_channel_pushfaillog'
,
validate
:
{
},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
center-channel/app/base/service/app.base.js
View file @
617bfaeb
...
@@ -85,30 +85,92 @@ class AppServiceBase {
...
@@ -85,30 +85,92 @@ class AppServiceBase {
var
rtn
=
await
aliyunClient
.
reqCustomByGet
(
params
);
var
rtn
=
await
aliyunClient
.
reqCustomByGet
(
params
);
return
rtn
;
return
rtn
;
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
pushlogSve
.
createDb
({
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
op
:
pobj
.
interface_info
?
JSON
.
stringify
(
pobj
.
interface_info
)
:
""
,
//推送的接口信息
requestId
:
pobj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
op
:
"center-channel/app/base/service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReq"
,
resultInfo
:
"error:"
+
e
.
stack
,
content
:
errorMsg
,
returnType
:
'0'
,
// clientIp: pobj.clientIp
,
op
Title
:
pobj
.
opType
+
"推送操作异常->opAliyunRpcReq"
op
title
:
pobj
.
opType
+
"推送操作异常->opAliyunRpcReq"
,
});
});
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
({
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"center-channel/app/base/service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReq"
,
op
:
"center-channel/app/base/service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReq
ByPost
"
,
content
:
"error:"
+
e
.
stack
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->opAliyunRpcReq"
,
optitle
:
pobj
.
opType
+
"推送操作异常->opAliyunRpcReq
ByPost
"
,
});
});
return
system
.
getResult
(
null
,
"推送error"
);
return
system
.
getResult
(
null
,
errorMsg
);
}
}
}
}
async
disposePushResult
(
pobj
,
result
,
opTitleDesc
)
{
//处理结果信息--内部使用
if
(
result
.
status
!=
0
)
{
this
.
pushlogSve
.
createFailLogDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
2
,
opTitle
:
pobj
.
opType
+
"推送操作失败->"
+
opTitleDesc
,
pushNumber
:
pobj
.
pushNumber
||
1
});
result
.
data
=
null
;
return
result
;
}
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
op
:
JSON
.
stringify
(
pobj
.
interface_info
),
//推送的接口信息
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
returnType
:
'1'
,
opTitle
:
pobj
.
opType
+
"数据推送成功->"
+
opTitleDesc
});
result
.
data
=
null
;
return
result
;
}
async
disposePushResultFail
(
pobj
,
result
,
opTitleDesc
)
{
//处理失败的结果信息--内部使用
this
.
pushlogSve
.
createFailLogDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
result
),
clientIp
:
pobj
.
clientIp
||
""
,
failType
:
2
,
opTitle
:
pobj
.
opType
+
"推送操作失败->"
+
opTitleDesc
,
pushNumber
:
pobj
.
pushNumber
||
1
});
result
.
data
=
null
;
return
result
;
}
/*
/*
返回20位业务订单号
返回20位业务订单号
prefix:业务前缀
prefix:业务前缀
...
...
center-channel/app/base/service/impl/common/pushlogSve.js
View file @
617bfaeb
...
@@ -4,72 +4,47 @@ var settings = require("../../../../config/settings");
...
@@ -4,72 +4,47 @@ var settings = require("../../../../config/settings");
class
PushlogService
extends
ServiceBase
{
class
PushlogService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"common"
,
ServiceBase
.
getDaoName
(
PushlogService
));
super
(
"common"
,
ServiceBase
.
getDaoName
(
PushlogService
));
//this.appDao=system.getObject("db.appDao");
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
opLogUrl
=
settings
.
apiconfig
.
opLogUrl
();
this
.
pushfaillogDao
=
system
.
getObject
(
"db.common.pushfaillogDao"
);
this
.
opLogEsIsAdd
=
settings
.
apiconfig
.
opLogEsIsAdd
();
}
}
async
create
(
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
;
}
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
)
{
qobj
.
content
=
qobj
.
content
.
replace
(
"field list"
,
"字段列表"
)
qobj
.
created_at
=
(
new
Date
()).
getTime
();
//往Es中写入日志
var
addEsData
=
JSON
.
stringify
(
qobj
);
rc
.
execPost
(
qobj
,
this
.
opLogUrl
);
}
else
{
//解决日志大于4000写入的问题
if
(
qobj
.
content
.
length
>
4980
)
{
qobj
.
content
=
qobj
.
content
.
substring
(
0
,
4980
);
}
this
.
dao
.
create
(
qobj
);
}
}
catch
(
e
)
{
console
.
log
(
e
.
stack
,
"addLog------error-----------------------*****************"
);
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
);
}
catch
(
e
)
{
//日志记录
this
.
logCtl
.
error
({
appid
:
qobj
.
appid
||
""
,
appkey
:
qobj
.
appkey
||
""
,
requestId
:
qobj
.
requestId
||
""
,
op
:
qobj
.
op
||
""
,
content
:
qobj
.
content
+
"-->error:"
+
e
.
stack
,
clientIp
:
qobj
.
clientIp
||
""
,
optitle
:
qobj
.
optitle
||
""
+
"-->添加日志失败center_channel_pushlog->createDb"
,
});
}
}
}
}
async
createDb
(
qobj
)
{
async
createFailLogDb
(
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
;
this
.
d
ao
.
create
(
qobj
);
this
.
pushfaillogD
ao
.
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_pushfaillog->createFailLogDb"
,
});
}
}
}
}
async
delDbById
(
id
)
{
async
delDbById
(
id
)
{
var
sql
=
"DELETE FROM `center_channel_pushlog` WHERE id=:id"
;
var
sql
=
"DELETE FROM `c
?
enter_channel_pushlog` WHERE id=:id"
;
var
paramWhere
=
{
id
:
id
};
// var paramWhere = { id: id ??
};
this
.
customQuery
(
sql
,
paramWhere
);
this
.
bulkDeleteByWhere
({
where
:
{
id
:
id
}
});
//
customQuery(sql, paramWhere);
}
}
}
}
module
.
exports
=
PushlogService
;
module
.
exports
=
PushlogService
;
center-channel/app/base/service/impl/utilsSve/utilsAlibankSve.js
View file @
617bfaeb
...
@@ -2,7 +2,7 @@ var system = require("../../../system");
...
@@ -2,7 +2,7 @@ var system = require("../../../system");
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
//阿里支付类
class
utilsTlBankSve
extends
AppServiceBase
{
class
utilsTlBankSve
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
...
...
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
View file @
617bfaeb
...
@@ -2,7 +2,7 @@ var system = require("../../../system");
...
@@ -2,7 +2,7 @@ var system = require("../../../system");
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
//
商标查询
操作
//
用户权限
操作
class
UtilsAuthService
extends
AppServiceBase
{
class
UtilsAuthService
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
...
...
center-channel/app/base/service/impl/utilsSve/utilsChannelAuthSve.js
View file @
617bfaeb
...
@@ -2,7 +2,7 @@ var system = require("../../../system");
...
@@ -2,7 +2,7 @@ var system = require("../../../system");
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
//
商标查询
操作
//
渠道用户权限
操作
class
UtilsChannelAuthService
extends
AppServiceBase
{
class
UtilsChannelAuthService
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
...
...
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
View file @
617bfaeb
var
system
=
require
(
"../../../system"
);
var
system
=
require
(
"../../../system"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
//此类用来db中配置来进行调用
//此类用来db中配置来进行调用
-主要功能是推送蜂擎业务
class
UtilsFqAliyunService
extends
AppServiceBase
{
class
UtilsFqAliyunService
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
}
}
async
pushOrderBusinessByProductCode2Fq
(
pobj
)
{
//推送自定义产品码的订单商机到峰擎(订单已经支付成功才推送)
async
pushOrderBusinessByProductCode2Fq
(
pobj
)
{
//推送自定义产品码的订单商机到峰擎(订单已经支付成功才推送)
var
verify
=
await
this
.
verifyParam
(
pobj
);
var
verify
Result
=
await
this
.
verifyParam
(
pobj
);
var
orderInfo
=
pobj
.
actionBody
.
order_info
;
var
orderInfo
=
pobj
.
actionBody
.
order_info
;
var
orderContact
=
pobj
.
actionBody
.
order_contact
;
var
orderContact
=
pobj
.
actionBody
.
order_contact
;
var
productInfo
=
pobj
.
actionBody
.
product_info
;
var
productInfo
=
pobj
.
actionBody
.
product_info
;
if
(
!
orderInfo
)
{
if
(
!
orderInfo
)
{
verify
=
system
.
getResult
(
null
,
"orderInfo can not be empty,100420"
);
verify
Result
=
system
.
getResult
(
null
,
"orderInfo can not be empty,100420"
);
}
}
if
(
!
orderInfo
.
orderStatus
||
orderInfo
.
orderStatus
<
2
)
{
if
(
!
orderInfo
.
orderStatus
||
orderInfo
.
orderStatus
<
2
)
{
verify
=
system
.
getResult
(
null
,
"orderInfo status must be paid,100423"
);
verify
Result
=
system
.
getResult
(
null
,
"orderInfo status must be paid,100423"
);
}
}
if
(
!
orderContact
||
!
orderContact
.
mobile
)
{
if
(
!
orderContact
||
!
orderContact
.
mobile
)
{
verify
=
system
.
getResult
(
null
,
"orderInfo.orderContact.mobile can not be empty,100425"
);
verify
Result
=
system
.
getResult
(
null
,
"orderInfo.orderContact.mobile can not be empty,100425"
);
}
}
if
(
!
productInfo
||
!
productInfo
.
service_business_code
)
{
if
(
!
productInfo
||
!
productInfo
.
service_business_code
)
{
verify
=
system
.
getResult
(
null
,
"orderInfo.productInfo.service_business_code can not be empty,100427"
);
verify
Result
=
system
.
getResult
(
null
,
"orderInfo.productInfo.service_business_code can not be empty,100427"
);
}
}
if
(
!
productInfo
||
!
productInfo
.
price_item
||
!
productInfo
.
price_item
.
service_code
)
{
if
(
!
productInfo
||
!
productInfo
.
price_item
||
!
productInfo
.
price_item
.
service_code
)
{
verify
=
system
.
getResult
(
null
,
"orderInfo.productInfo.price_item.service_code can not be empty,100430"
);
verify
Result
=
system
.
getResult
(
null
,
"orderInfo.productInfo.price_item.service_code can not be empty,100430"
);
}
}
if
(
verify
.
status
!=
0
)
{
if
(
verifyResult
.
status
!=
0
)
{
this
.
pushlogSve
.
createDb
({
return
await
this
.
disposePushResultFail
(
pobj
,
verifyResult
,
"fq->pushOrderBusinessByProductCode2Fq->verifyResult"
);
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"暂无推送的接口信息"
+
",verify-msg:"
+
verify
.
msg
,
//推送的接口信息
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
""
,
returnType
:
'0'
,
opTitle
:
pobj
.
opType
+
"推送操作失败->opAliyunClientPost"
});
return
verify
;
}
}
var
interface_params_info
=
verify
.
data
;
var
interface_params_info
=
verify
Result
.
data
;
var
params
=
{
var
params
=
{
idempotentId
:
orderInfo
.
orderNo
,
// 是 业务 ID
idempotentId
:
orderInfo
.
orderNo
,
// 是 业务 ID
idempotentSource
:
productInfo
.
service_business_code
,
// 是 业务来源(ic_jdyun、ic_ali)
idempotentSource
:
productInfo
.
service_business_code
,
// 是 业务来源(ic_jdyun、ic_ali)
...
@@ -53,7 +43,8 @@ class UtilsFqAliyunService extends AppServiceBase {
...
@@ -53,7 +43,8 @@ class UtilsFqAliyunService extends AppServiceBase {
productId
:
productInfo
.
price_item
.
service_code
,
// 是 产品 ID
productId
:
productInfo
.
price_item
.
service_code
,
// 是 产品 ID
productQuantity
:
orderInfo
.
quantity
,
// 是 产品数量
productQuantity
:
orderInfo
.
quantity
,
// 是 产品数量
};
};
var
result
=
this
.
opAliyunClientPost
(
pobj
,
"pushOrderBusiness"
,
interface_params_info
.
opUrl
,
interface_params_info
.
key
,
interface_params_info
.
secret
,
params
);
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"
);
}
}
/**
/**
...
@@ -62,75 +53,26 @@ class UtilsFqAliyunService extends AppServiceBase {
...
@@ -62,75 +53,26 @@ class UtilsFqAliyunService extends AppServiceBase {
* @param {*} pobj
* @param {*} pobj
*/
*/
async
pushAliBusiness2Fq
(
pobj
)
{
//推送阿里信息操作到峰擎
async
pushAliBusiness2Fq
(
pobj
)
{
//推送阿里信息操作到峰擎
var
verify
=
await
this
.
verifyParam
(
pobj
);
var
verifyResult
=
await
this
.
verifyParam
(
pobj
);
if
(
verify
.
status
!=
0
)
{
if
(
verifyResult
.
status
!=
0
)
{
this
.
pushlogSve
.
createDb
({
return
await
this
.
disposePushResultFail
(
pobj
,
verifyResult
,
"fq->pushAliBusiness2Fq->verifyResult"
);
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"暂无推送的接口信息"
+
",verify-msg:"
+
verify
.
msg
,
//推送的接口信息
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
""
,
returnType
:
'0'
,
opTitle
:
pobj
.
opType
+
"推送操作失败->opAliyunClientPost"
});
return
verify
;
}
}
var
interface_params_info
=
verify
.
data
;
var
interface_params_info
=
verify
.
data
;
this
.
opAliyunClientPost
(
pobj
,
interface_params_info
.
opUrl
,
interface_params_info
.
key
,
interface_params_info
.
secret
,
pobj
.
actionBody
);
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"
);
async
verifyParam
(
pobj
)
{
//参数信息验证
var
verify
=
system
.
getResultSuccess
();
if
(
!
pobj
.
interface_params
)
{
verify
=
system
.
getResult
(
null
,
"interface_params can not be empty,100400"
);
}
var
interface_params_info
=
JSON
.
parse
(
pobj
.
interface_params
);
if
(
!
interface_params_info
||
!
interface_params_info
.
opUrl
||
!
interface_params_info
.
key
||
!
interface_params_info
.
secret
)
{
verify
=
system
.
getResult
(
null
,
"interface_params(opUrl、key、secret) can not be empty,100410"
);
}
verify
.
data
=
interface_params_info
;
return
verify
;
}
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
async
opAliyunClientPost
(
pobj
,
url
,
key
,
secret
,
params
)
{
async
opAliyunClientPost
(
pobj
,
url
,
key
,
secret
,
params
)
{
try
{
try
{
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
await
rc
.
post
(
url
,
key
,
secret
,
params
);
var
rtn
=
await
rc
.
post
(
url
,
key
,
secret
,
params
);
if
(
rtn
.
code
!=
200
&&
rtn
.
success
!=
true
)
{
if
(
rtn
.
code
!=
200
&&
rtn
.
success
!=
true
)
{
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
op
:
JSON
.
stringify
(
pobj
.
interface_info
),
//推送的接口信息
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
rtn
),
returnType
:
'0'
,
opTitle
:
pobj
.
opType
+
"推送操作出错->opAliyunClientPost"
});
return
system
.
getResult
(
null
,
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
pobj
.
requestId
+
",requestId="
+
rtn
.
requestId
);
return
system
.
getResult
(
null
,
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
pobj
.
requestId
+
",requestId="
+
rtn
.
requestId
);
}
}
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
op
:
JSON
.
stringify
(
pobj
.
interface_info
),
//推送的接口信息
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
rtn
),
returnType
:
'1'
,
opTitle
:
pobj
.
opType
+
"数据推送成功->opAliyunClientPost"
});
return
system
.
getResultSuccess
(
null
,
"推送成功"
);
return
system
.
getResultSuccess
(
null
,
"推送成功"
);
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
op
:
JSON
.
stringify
(
pobj
.
interface_info
),
//推送的接口信息
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
"error:"
+
e
.
stack
,
returnType
:
'0'
,
opTitle
:
pobj
.
opType
+
"推送操作异常->opAliyunClientPost"
});
//日志记录
//日志记录
this
.
logCtl
.
error
({
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
...
@@ -141,8 +83,22 @@ class UtilsFqAliyunService extends AppServiceBase {
...
@@ -141,8 +83,22 @@ class UtilsFqAliyunService extends AppServiceBase {
// clientIp: pobj.clientIp,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->opAliyunClientPost"
,
optitle
:
pobj
.
opType
+
"推送操作异常->opAliyunClientPost"
,
});
});
return
system
.
getResult
(
null
,
"推送
error"
);
return
system
.
getResult
(
null
,
"推送
操作异常->opAliyunClientPost->error:"
+
e
.
stack
);
}
}
}
}
async
verifyParam
(
pobj
)
{
//参数信息验证
var
verify
=
system
.
getResultSuccess
();
if
(
!
pobj
.
interface_params
)
{
verify
=
system
.
getResult
(
null
,
"interface_params can not be empty,100400"
);
}
var
interface_params_info
=
JSON
.
parse
(
pobj
.
interface_params
);
if
(
!
interface_params_info
||
!
interface_params_info
.
opUrl
||
!
interface_params_info
.
key
||
!
interface_params_info
.
secret
)
{
verify
=
system
.
getResult
(
null
,
"interface_params(opUrl、key、secret) can not be empty,100410"
);
}
verify
.
data
=
interface_params_info
;
return
verify
;
}
//--------------------------------------------------内部辅助方法-------------------end-----------------
}
}
module
.
exports
=
UtilsFqAliyunService
;
module
.
exports
=
UtilsFqAliyunService
;
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
617bfaeb
var
system
=
require
(
"../../../system"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
//
商标查询操作
//
需求操作类
class
UtilsNeedService
extends
AppServiceBase
{
class
UtilsNeedService
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
...
...
center-channel/app/base/service/impl/utilsSve/utilsOpOrderSve.js
View file @
617bfaeb
...
@@ -2,6 +2,7 @@ const system = require("../../../system");
...
@@ -2,6 +2,7 @@ const system = require("../../../system");
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
querystring
=
require
(
'querystring'
);
const
querystring
=
require
(
'querystring'
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
//订单操作类
class
UtilsOpOrderService
extends
AppServiceBase
{
class
UtilsOpOrderService
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
...
@@ -51,28 +52,28 @@ class UtilsOpOrderService extends AppServiceBase {
...
@@ -51,28 +52,28 @@ class UtilsOpOrderService extends AppServiceBase {
}
}
async
tmConfirm
(
pobj
,
actionBody
)
{
//商标方案确认
async
tmConfirm
(
pobj
,
actionBody
)
{
//商标方案确认
if
(
!
actionBody
.
orderNo
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100025"
);
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100025"
);
}
}
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
&&
result
.
status
==
0
&&
result
.
data
)
{
if
(
result
&&
result
.
status
==
0
&&
result
.
data
)
{
this
.
pushTmConfirm
(
result
,
pobj
,
actionBody
);
//推送方案确认信息
this
.
pushTmConfirm
(
result
,
pobj
,
actionBody
);
//推送方案确认信息
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
return
result
;
return
result
;
}
}
//推送方案确认信息
//推送方案确认信息
async
pushTmConfirm
(
result
,
pobj
,
actionBody
)
{
async
pushTmConfirm
(
result
,
pobj
,
actionBody
)
{
var
orderdelivery
=
result
.
data
;
var
orderdelivery
=
result
.
data
;
var
deliveryContent
=
orderdelivery
.
deliveryContent
;
var
deliveryContent
=
orderdelivery
.
deliveryContent
;
if
(
deliveryContent
)
{
if
(
deliveryContent
)
{
var
pushObj
=
{
//推送参数
var
pushObj
=
{
//推送参数
serviceNo
:
deliveryContent
.
serviceNo
,
serviceNo
:
deliveryContent
.
serviceNo
,
isConfirm
:
actionBody
.
isConfirm
,
isConfirm
:
actionBody
.
isConfirm
,
channelCode
:
deliveryContent
.
channelCode
,
channelCode
:
deliveryContent
.
channelCode
,
notes
:
actionBody
.
notes
||
""
,
notes
:
actionBody
.
notes
||
""
,
appInfo
:
pobj
.
appInfo
appInfo
:
pobj
.
appInfo
};
};
var
tmpPobj
=
{
var
tmpPobj
=
{
...
@@ -82,9 +83,9 @@ class UtilsOpOrderService extends AppServiceBase {
...
@@ -82,9 +83,9 @@ class UtilsOpOrderService extends AppServiceBase {
//获取产品详情
//获取产品详情
var
getProductDetailUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
getProductDetailUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
getProductDetailObj
=
{
var
getProductDetailObj
=
{
"actionType"
:
"getProductDetail"
,
"actionType"
:
"getProductDetail"
,
"appInfo"
:
pobj
.
appInfo
,
"appInfo"
:
pobj
.
appInfo
,
"actionBody"
:
{
"channelItemCode"
:
deliveryContent
.
itemCode
}
"actionBody"
:
{
"channelItemCode"
:
deliveryContent
.
itemCode
}
};
};
var
productItemResult
=
await
this
.
restPostUrl
(
getProductDetailObj
,
getProductDetailUrl
);
var
productItemResult
=
await
this
.
restPostUrl
(
getProductDetailObj
,
getProductDetailUrl
);
if
(
productItemResult
.
status
!=
0
)
{
if
(
productItemResult
.
status
!=
0
)
{
...
@@ -95,9 +96,9 @@ class UtilsOpOrderService extends AppServiceBase {
...
@@ -95,9 +96,9 @@ class UtilsOpOrderService extends AppServiceBase {
//获取推送接口信息
//获取推送接口信息
var
getProductInterfaceUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
getProductInterfaceUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
getProductInterfaceObj
=
{
var
getProductInterfaceObj
=
{
"actionType"
:
"getProductInterface"
,
"actionType"
:
"getProductInterface"
,
"appInfo"
:
pobj
.
appInfo
,
"appInfo"
:
pobj
.
appInfo
,
"actionBody"
:
{
"product_id"
:
tmpPobj
.
actionBody
.
product_id
}
"actionBody"
:
{
"product_id"
:
tmpPobj
.
actionBody
.
product_id
}
};
};
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
getProductInterfaceObj
,
getProductInterfaceUrl
);
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
getProductInterfaceObj
,
getProductInterfaceUrl
);
tmpPobj
.
actionBody
.
product_info
.
interface_info
=
productItemInterfaceResult
.
data
;
tmpPobj
.
actionBody
.
product_info
.
interface_info
=
productItemInterfaceResult
.
data
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
617bfaeb
...
@@ -471,66 +471,67 @@ class UtilsOrderService extends AppServiceBase {
...
@@ -471,66 +471,67 @@ class UtilsOrderService extends AppServiceBase {
content
:
JSON
.
stringify
(
parmas
),
content
:
JSON
.
stringify
(
parmas
),
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
if
(
!
parmas
.
app_id
)
{
if
(
!
parmas
.
trade_status
)
{
return
system
.
getResult
(
null
,
"
app_id
参数不能为空,100470"
);
return
system
.
getResult
(
null
,
"
trade_status
参数不能为空,100470"
);
}
}
var
url
=
this
.
centerAppUrl
+
"payment/paymentApi/getAppInfo"
;
if
(
parmas
.
trade_status
!=
"TRADE_FINISHED"
&&
parmas
.
trade_status
!=
"TRADE_SUCCESS"
)
{
var
opResult
=
await
this
.
restPostUrl
({
uappId
:
parmas
.
uappid
},
url
);
return
system
.
getResult
(
null
,
"trade_status状态有误,100473"
);
}
var
url
=
this
.
centerAppUrl
+
"payment/aliPayment/verifyAliPayReturnSign"
;
var
opResult
=
await
this
.
restPostUrl
(
parmas
,
url
);
if
(
opResult
.
status
!=
0
)
{
if
(
opResult
.
status
!=
0
)
{
opResult
.
msg
=
opResult
.
msg
+
",100
27
0"
;
opResult
.
msg
=
opResult
.
msg
+
",100
48
0"
;
return
opResult
;
return
opResult
;
}
}
var
appInfo
=
opResult
.
data
;
// data:{
var
resultSign
=
await
this
.
verifySign
(
parmas
,
appInfo
.
uapp_secret
);
// orderNo: outTradeInfo[0],
if
(
!
resultSign
||
resultSign
.
status
!=
0
)
{
// uappId: outTradeInfo[1],
return
resultSign
;
// productId: outTradeInfo.length == 3 ? outTradeInfo[2] : 0
}
// }
opResult
.
data
=
{
orderNo
:
"TM36202004111014WcFs"
,
uappId
:
36
,
productId
:
42
};
//获取充值业务锁
//获取充值业务锁
// await this.cacheManager["TlPayLocker"].init(parmas.out_trade_n
o);//---测试时放开
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
opResult
.
data
.
orderN
o
);
//---测试时放开
var
locker
=
await
this
.
cacheManager
[
"TlPayLocker"
].
enter
(
parmas
.
out_trade_n
o
);
var
locker
=
await
this
.
cacheManager
[
"TlPayLocker"
].
enter
(
opResult
.
data
.
orderN
o
);
if
(
!
locker
||
locker
!=
"1"
)
{
if
(
!
locker
||
locker
!=
"1"
)
{
this
.
logCtl
.
info
({
this
.
logCtl
.
info
({
appid
:
appInfo
.
uapp_i
d
,
appid
:
opResult
.
data
.
uappI
d
,
appkey
:
appInfo
.
uapp_key
,
appkey
:
""
,
op
:
"center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js/opBackNotify"
,
op
:
"center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js/op
H5AliDingPay
BackNotify"
,
content
:
"参数="
+
JSON
.
stringify
(
parmas
),
content
:
"参数="
+
JSON
.
stringify
(
parmas
),
clientIp
:
parmas
.
client_ip
||
""
,
clientIp
:
parmas
.
client_ip
||
""
,
optitle
:
"
通联
回调操作频繁---太频繁了,太频繁了"
optitle
:
"
阿里
回调操作频繁---太频繁了,太频繁了"
});
});
return
system
.
getResultFail
(
-
200
,
"回调操作频繁---太频繁了,太频繁了"
);
return
system
.
getResultFail
(
-
200
,
"
阿里
回调操作频繁---太频繁了,太频繁了"
);
}
}
if
(
parmas
.
trxcode
==
"VSP501"
)
{
parmas
.
appInfo
=
{
appInfo
:
{
uapp_id
:
opResult
.
data
.
uappId
}
};
parmas
.
pay_type
=
"wx"
;
parmas
.
orderNo
=
opResult
.
data
.
orderNo
;
}
else
{
parmas
.
pay_type
=
"alipay"
;
parmas
.
pay_type
=
"alipay"
;
}
parmas
.
appInfo
=
appInfo
;
parmas
.
orderNo
=
parmas
.
out_trade_no
;
//修改并返回订单支付状态,创建收款单
//修改并返回订单支付状态,创建收款单
var
url
=
this
.
centerOrderUrl
+
"opaction/opPayOrder/receivePayCallBackNotify"
;
var
url
=
this
.
centerOrderUrl
+
"opaction/opPayOrder/receivePayCallBackNotifyByAliDing"
;
var
opResult
=
await
this
.
restPostUrl
(
parmas
,
url
);
var
opOrderResult
=
await
this
.
restPostUrl
(
parmas
,
url
);
if
(
opResult
.
status
==
0
)
{
if
(
opOrderResult
.
status
!=
0
)
{
opResult
.
data
.
appInfo
=
{
opOrderResult
.
data
=
null
;
uapp_id
:
appInfo
.
uapp_id
,
return
opOrderResult
;
uapp_key
:
appInfo
.
uapp_key
,
app_code
:
appInfo
.
app_code
,
app_name
:
appInfo
.
app_name
};
interface_info
opResult
.
data
.
userInfo
=
{
channel_userid
:
opResult
.
data
.
order_info
.
channelUserId
,
channel_username
:
opResult
.
data
.
order_info
.
channelUserId
,
channel_nickname
:
opResult
.
data
.
order_info
.
channelUserId
};
var
pobj
=
{
appInfo
:
opResult
.
data
.
appInfo
,
actionBody
:
opResult
.
data
}
// this.utilsPushSve.pushBusInfo(opResult.data, "pushOrderBusiness",0);
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
"pushOrder"
,
0
);
}
}
opResult
.
data
=
null
;
opOrderResult
.
data
.
appInfo
=
{
return
opResult
;
uapp_id
:
opResult
.
data
.
uappId
};
opOrderResult
.
data
.
userInfo
=
{
channel_userid
:
opOrderResult
.
data
.
order_info
.
channelUserId
,
channel_username
:
opOrderResult
.
data
.
order_info
.
channelUserId
,
channel_nickname
:
opOrderResult
.
data
.
order_info
.
channelUserId
};
var
pobj
=
{
appInfo
:
opOrderResult
.
data
.
appInfo
,
actionBody
:
opOrderResult
.
data
}
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
"createAliTmApply"
,
1
);
opOrderResult
.
data
=
null
;
return
opOrderResult
;
}
catch
(
e
)
{
}
catch
(
e
)
{
await
this
.
cacheManager
[
"TlPayLocker"
].
release
(
parmas
.
out_trade_no
);
await
this
.
cacheManager
[
"TlPayLocker"
].
release
(
parmas
.
out_trade_no
);
this
.
logCtl
.
error
({
this
.
logCtl
.
error
({
...
...
center-channel/app/base/service/impl/utilsSve/utilsProductSve.js
View file @
617bfaeb
var
system
=
require
(
"../../../system"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
//
商标查询操作
//
产品操作类
class
UtilsProductService
extends
AppServiceBase
{
class
UtilsProductService
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
...
...
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
617bfaeb
...
@@ -5,7 +5,6 @@ const AppServiceBase = require("../../app.base");
...
@@ -5,7 +5,6 @@ const AppServiceBase = require("../../app.base");
class
UtilsPushService
extends
AppServiceBase
{
class
UtilsPushService
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
};
};
async
aliBusiness2Fq
(
pobj
,
opType
)
{
//供业务调用,在代码中调用,不在db中做配置进行调用
async
aliBusiness2Fq
(
pobj
,
opType
)
{
//供业务调用,在代码中调用,不在db中做配置进行调用
...
@@ -37,7 +36,7 @@ class UtilsPushService extends AppServiceBase {
...
@@ -37,7 +36,7 @@ class UtilsPushService extends AppServiceBase {
return
system
.
getResult
(
null
,
"暂无推送配置"
);
return
system
.
getResult
(
null
,
"暂无推送配置"
);
}
}
var
result
=
await
this
.
reflexAction
(
interface_info
,
pobj
.
opType
,
pobj
,
pobj
.
isDelProductInfo
||
1
);
var
result
=
await
this
.
reflexAction
(
interface_info
,
pobj
.
opType
,
pobj
,
pobj
.
isDelProductInfo
||
1
);
if
(
result
.
data
!=
0
)
{
if
(
result
.
status
!=
0
)
{
return
result
;
return
result
;
}
}
await
this
.
pushlogSve
.
delDbById
(
Number
(
pobj
.
id
||
0
));
await
this
.
pushlogSve
.
delDbById
(
Number
(
pobj
.
id
||
0
));
...
@@ -78,28 +77,12 @@ class UtilsPushService extends AppServiceBase {
...
@@ -78,28 +77,12 @@ class UtilsPushService extends AppServiceBase {
delete
actionBody
[
"product_info"
];
delete
actionBody
[
"product_info"
];
}
//是否删除产品信息进行推送
}
//是否删除产品信息进行推送
refResult
=
await
this
.
restPostUrl
(
pobj
.
actionBody
,
interface_info
.
interface_url
);
refResult
=
await
this
.
restPostUrl
(
pobj
.
actionBody
,
interface_info
.
interface_url
);
this
.
disposePushResult
(
pobj
,
refResult
,
"ycUrlPush->reflexAction->refResult"
);
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
op
:
JSON
.
stringify
(
pobj
.
interface_info
),
//推送的接口信息
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
rtn
),
returnType
:
refResult
.
status
==
0
?
'1'
:
'0'
,
opTitle
:
opType
+
(
refResult
.
status
==
0
?
"数据推送成功->reflexAction"
:
"数据推送出错->reflexAction"
)
});
}
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
pushlogSve
.
createDb
({
var
errorResult
=
system
.
getResult
(
null
,
"送异常-->reflexAction->"
+
e
.
stack
)
appid
:
pobj
.
appInfo
.
uapp_id
,
return
await
this
.
disposePushResultFail
(
pobj
,
errorResult
,
"数据推送异常-->reflexAction-->errorResult"
);
appkey
:
pobj
.
appInfo
.
uapp_key
,
op
:
JSON
.
stringify
(
pobj
.
interface_info
),
//推送的接口信息
content
:
JSON
.
stringify
(
pobj
),
//推送的参数信息
resultInfo
:
""
,
returnType
:
'0'
,
opTitle
:
opType
+
"数据推送异常-->reflexAction"
});
}
}
}
}
}
}
...
...
center-channel/app/base/service/impl/utilsSve/utilsTmAliyunSve.js
View file @
617bfaeb
This diff is collapsed.
Click to expand it.
center-channel/app/base/utils/aliyunClient.js
View file @
617bfaeb
...
@@ -30,6 +30,9 @@ class aliyunClient {
...
@@ -30,6 +30,9 @@ class aliyunClient {
var
action
=
obj
.
action
;
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
var
reqbody
=
obj
.
reqbody
;
try
{
try
{
if
(
rpcParam
.
apiVersion
)
{
this
.
aliclient
.
apiVersion
=
obj
.
apiVersion
;
}
var
res
=
await
this
.
aliclient
.
request
(
action
,
reqbody
,
{
var
res
=
await
this
.
aliclient
.
request
(
action
,
reqbody
,
{
timeout
:
3000
,
// default 3000 ms
timeout
:
3000
,
// default 3000 ms
formatAction
:
true
,
// default true, format the action to Action
formatAction
:
true
,
// default true, format the action to Action
...
@@ -38,8 +41,8 @@ class aliyunClient {
...
@@ -38,8 +41,8 @@ class aliyunClient {
headers
:
{},
// set the http request headers
headers
:
{},
// set the http request headers
});
});
this
.
pushlogSve
.
createDb
({
this
.
pushlogSve
.
createDb
({
op
:
"
推送阿里信息返回:"
+
action
,
op
:
"
old-reqbyget"
,
content
:
JSON
.
stringify
(
obj
),
content
:
JSON
.
stringify
(
obj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
res
),
resultInfo
:
JSON
.
stringify
(
res
),
returnType
:
'1'
,
returnType
:
'1'
,
logLevel
:
'1'
,
logLevel
:
'1'
,
...
@@ -47,13 +50,16 @@ class aliyunClient {
...
@@ -47,13 +50,16 @@ class aliyunClient {
});
});
return
system
.
getResultSuccess
(
res
);
return
system
.
getResultSuccess
(
res
);
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
pushlogSve
.
createDb
({
this
.
pushlogSve
.
createFailLogDb
({
op
:
"推送阿里信息返回:"
+
action
,
appid
:
obj
.
appInfo
?
obj
.
appInfo
.
uapp_id
||
""
:
""
,
content
:
JSON
.
stringify
(
obj
),
appkey
:
obj
.
appInfo
?
obj
.
appInfo
.
uapp_key
||
""
:
""
,
resultInfo
:
JSON
.
stringify
(
e
.
stack
),
requestId
:
obj
.
requestId
||
""
,
returnType
:
'0'
,
content
:
JSON
.
stringify
(
obj
),
//推送的参数信息
logLevel
:
'3'
,
resultInfo
:
"error:"
+
JSON
.
stringify
(
e
.
stack
),
opTitle
:
"old-reqbyget推送阿里信息返回异常"
clientIp
:
obj
.
clientIp
||
""
,
failType
:
1
,
opTitle
:
"old-reqbyget推送阿里信息返回异常"
,
pushNumber
:
obj
.
pushNumber
||
1
});
});
return
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
e
.
stack
);
return
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
e
.
stack
);
}
}
...
@@ -84,6 +90,30 @@ class aliyunClient {
...
@@ -84,6 +90,30 @@ class aliyunClient {
});
});
return
system
.
getResultSuccess
(
res
);
return
system
.
getResultSuccess
(
res
);
}
}
async
reqCustomByPost
(
obj
,
cbk
)
{
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
var
rpcParam
=
obj
.
rpcParam
;
if
(
rpcParam
.
accessKeyId
)
{
this
.
aliclient
.
accessKeyId
=
rpcParam
.
accessKeyId
;
}
if
(
rpcParam
.
accessKeySecret
)
{
this
.
aliclient
.
accessKeySecret
=
rpcParam
.
accessKeySecret
;
}
if
(
rpcParam
.
endpoint
)
{
this
.
aliclient
.
endpoint
=
rpcParam
.
endpoint
;
}
if
(
rpcParam
.
apiVersion
)
{
this
.
aliclient
.
apiVersion
=
rpcParam
.
apiVersion
;
}
var
res
=
await
this
.
aliclient
.
request
(
action
,
reqbody
,
{
timeout
:
3000
,
// default 3000 ms
formatAction
:
true
,
// default true, format the action to Action
formatParams
:
true
,
// default true, format the parameter name to first letter upper case
method
:
'POST'
,
// set the http method, default is GET
headers
:
{},
// set the http request headers
});
return
system
.
getResultSuccess
(
res
);
}
}
}
module
.
exports
=
aliyunClient
;
module
.
exports
=
aliyunClient
;
center-channel/app/base/utils/businessManager/pushUtils.js
View file @
617bfaeb
...
@@ -5,9 +5,7 @@ const md5 = require("MD5");
...
@@ -5,9 +5,7 @@ const md5 = require("MD5");
class
PushUtils
{
class
PushUtils
{
constructor
()
{
constructor
()
{
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
merchantpushlogSve
=
system
.
getObject
(
"service.merchant.merchantpushlogSve"
);
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
merchantpushSve
=
system
.
getObject
(
"service.merchant.merchantpushSve"
);
}
}
getUUID
()
{
getUUID
()
{
var
uuid
=
uuidv4
();
var
uuid
=
uuidv4
();
...
@@ -19,53 +17,7 @@ class PushUtils {
...
@@ -19,53 +17,7 @@ class PushUtils {
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
return
await
cacheManager
[
"MerchantPushUrlCache"
].
cache
(
merchant_id
,
null
,
3600
);
return
await
cacheManager
[
"MerchantPushUrlCache"
].
cache
(
merchant_id
,
null
,
3600
);
}
}
/**
* 推送到第三方数据
* @param {*} reqUrl 请求推送的url
* @param {*} params 推送的参数
*/
async
push
(
merchantId
,
field
,
params
)
{
try
{
var
pushConfig
=
await
this
.
getCachePushItemUrl
(
merchantId
)
||
{};
var
reqUrl
=
pushConfig
[
field
];
if
(
!
reqUrl
)
{
this
.
logCtl
.
error
({
optitle
:
"推送到第三方数据异常error"
,
op
:
"merchantId = "
+
merchantId
+
"; reqUrl is empty, field = "
+
field
,
content
:
"reqUrl is empty"
,
clientIp
:
"pushUtils中没有ip"
});
return
;
}
// 签名
params
.
sign
=
await
this
.
createSign
(
params
,
merchantId
);
params
.
requestid
=
this
.
getUUID
();
var
rtn
=
await
this
.
execClient
.
execPost
(
params
,
reqUrl
);
var
returnValue
=
0
;
if
(
rtn
.
stdout
)
{
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
code
==
"success"
)
{
returnValue
=
1
;
}
}
//记录推送结果
this
.
merchantpushlogSve
.
create
({
merchant_id
:
merchantId
,
//商户id
api
:
reqUrl
,
//接口地址
params
:
JSON
.
stringify
(
params
),
//推送数据信息
rs
:
rtn
.
stdout
,
//推送返回结果
success
:
returnValue
//是否推送成功
});
}
catch
(
e
)
{
console
.
log
(
e
.
stack
);
this
.
logCtl
.
error
({
optitle
:
"推送到第三方数据异常error"
,
op
:
reqUrl
+
";params="
+
JSON
.
stringify
(
params
)
+
";reqid="
+
params
.
requestid
,
content
:
e
.
stack
,
clientIp
:
"pushUtils中没有ip"
});
}
}
/**
/**
* 多次推送到第三方数据
* 多次推送到第三方数据
* @param {*} reqUrl 请求推送的url
* @param {*} reqUrl 请求推送的url
...
@@ -102,10 +54,10 @@ class PushUtils {
...
@@ -102,10 +54,10 @@ class PushUtils {
var
keys
=
Object
.
keys
(
params
).
sort
();
var
keys
=
Object
.
keys
(
params
).
sort
();
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
params
[
tKey
])
{
if
(
tKey
!=
"sign"
&&
params
[
tKey
])
{
signArr
.
push
(
tKey
+
"="
+
params
[
tKey
]);
signArr
.
push
(
tKey
+
"="
+
params
[
tKey
]);
}
}
}
}
var
resultSignStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
appInfo
.
appSecret
;
var
resultSignStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
appInfo
.
appSecret
;
return
md5
(
resultSignStr
).
toUpperCase
();
return
md5
(
resultSignStr
).
toUpperCase
();
...
...
center-channel/app/config/settings.js
View file @
617bfaeb
...
@@ -22,7 +22,7 @@ var settings = {
...
@@ -22,7 +22,7 @@ var settings = {
port
:
process
.
env
.
NODE_PORT
||
4012
,
port
:
process
.
env
.
NODE_PORT
||
4012
,
aliossjavaUrl
:
function
()
{
aliossjavaUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
return
"http://192.168.0.10
2
:8080/uploadfile"
;
return
"http://192.168.0.10
4
:8080/uploadfile"
;
}
else
{
}
else
{
return
"http://aliossjava-service/uploadfile"
;
return
"http://aliossjava-service/uploadfile"
;
}
}
...
...
center-channel/提示编码使用
View file @
617bfaeb
已经使用的
编码汇总:
已经使用的
编码汇总:
...
@@ -45,4 +45,8 @@
...
@@ -45,4 +45,8 @@
100440
100440
100450
100450
100460
100460
100470
100470
\ No newline at end of file
100480
100490
100500
100510
\ No newline at end of file
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