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
14ac5993
Commit
14ac5993
authored
Oct 29, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-channel' of gitlab.gongsibao.com:jiangyong/zhichan into center-channel
parents
55f6aa10
0d176292
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
42 deletions
+94
-42
center-channel/app/base/api/api.base.js
+1
-0
center-channel/app/base/api/impl/nmaction/name.js
+32
-35
center-channel/app/base/api/web.base.js
+14
-0
center-channel/app/base/service/app.base.js
+37
-0
center-channel/app/config/businessConfig.js
+4
-3
center-channel/app/config/routes/api.js
+5
-3
center-channel/app/config/settings.js
+1
-1
No files found.
center-channel/app/base/api/api.base.js
View file @
14ac5993
...
...
@@ -24,6 +24,7 @@ class APIBase {
//-----------------------新的模式------------------开始
async
doexecMethod
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
req
.
requestId
=
this
.
getUUID
();
try
{
var
shaStr
=
await
sha256
(
JSON
.
stringify
(
pobj
));
...
...
center-channel/app/base/api/impl/nmaction/name.js
View file @
14ac5993
var
WEBBase
=
require
(
"../../web.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
NameAPI
extends
WEBBase
{
class
NameAPI
extends
WEBBase
{
constructor
()
{
super
();
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
...
...
@@ -29,16 +29,16 @@ class NameAPI extends WEBBase{
opResult
=
await
this
.
getCache
();
break
;
case
"getPreference"
:
//偏好
opResult
=
await
this
.
getPreference
();
opResult
=
await
this
.
getPreference
();
break
;
case
"createName"
:
//起名
opResult
=
await
this
.
addOrderDelivery
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
addOrderDelivery
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getNameDetail"
:
//详情
opResult
=
await
this
.
getNameDetail
(
pobj
);
break
;
case
"getNames"
:
//详情
opResult
=
await
this
.
getNames
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
getNames
(
req
,
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
...
...
@@ -51,7 +51,7 @@ class NameAPI extends WEBBase{
* 获取行业类别数据 後期可提出為一個service文件
* @returns {Promise<{}>}
*/
async
getCache
(){
async
getCache
()
{
let
cacheResult
=
{};
cacheResult
.
cache
=
cacheJson
return
system
.
getResult
(
cacheResult
);
...
...
@@ -61,17 +61,17 @@ class NameAPI extends WEBBase{
* 获取偏好信息 後期可提出為一個service文件
* @returns {Promise<{}>}
*/
async
getPreference
(){
async
getPreference
()
{
let
preResult
=
{};
const
key
=
'qmbpreference'
;
let
result
=
await
this
.
redisClient
.
get
(
key
)
if
(
result
)
{
if
(
result
)
{
preResult
.
preference
=
JSON
.
parse
(
result
);
return
system
.
getResult
(
preResult
);
}
else
{
const
data
=
await
this
.
restPostUrl
({},
this
.
centerCacheUrl
+
"preference_select"
);
if
(
data
.
code
==
200
)
{
await
this
.
redisClient
.
set
(
key
,
JSON
.
stringify
(
data
.
data
),
2
*
3600
)
}
else
{
const
data
=
await
this
.
restPostUrl
({},
this
.
centerCacheUrl
+
"preference_select"
);
if
(
data
.
code
==
200
)
{
await
this
.
redisClient
.
set
(
key
,
JSON
.
stringify
(
data
.
data
),
2
*
3600
)
preResult
.
preference
=
data
.
data
return
system
.
getResult
(
preResult
);
}
...
...
@@ -84,7 +84,7 @@ class NameAPI extends WEBBase{
* @param actionBody
* @returns {Promise<{msg: string, data: (*|null), bizmsg: *, status: number}|{msg: *, data: *, status: *}|{msg: *, data: (*|null), status: number}>}
*/
async
addOrderDelivery
(
pobj
,
actionBody
)
{
async
addOrderDelivery
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderId
)
{
return
system
.
getResult
(
null
,
"orderId参数不能为空"
);
}
...
...
@@ -106,46 +106,43 @@ class NameAPI extends WEBBase{
if
(
!
actionBody
.
preference
)
{
return
system
.
getResult
(
null
,
"preference参数不能为空"
);
}
await
this
.
redisClient
.
set
(
"ch"
+
JSON
.
stringify
(
actionBody
.
orderId
),
JSON
.
stringify
(
actionBody
));
await
this
.
redisClient
.
set
(
"ch"
+
JSON
.
stringify
(
actionBody
.
orderId
),
JSON
.
stringify
(
actionBody
));
return
system
.
getResultSuccess
();
}
//获取取名结果,并保存到数据库
async
getNameDetail
(
pobj
){
async
getNameDetail
(
pobj
)
{
pobj
.
actionType
=
'getOrderDeliveryInfo'
;
const
opResult
=
await
this
.
utilsOrderSve
.
getOrderDeliveryInfo
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
!=
0
)
{
return
system
.
getResult
(
null
,
opResult
.
msg
);
if
(
opResult
.
status
!=
0
)
{
return
system
.
getResult
(
null
,
opResult
.
msg
);
}
if
(
opResult
.
data
.
hasOwnProperty
(
'result_name'
))
{
return
system
.
getResult
(
opResult
.
data
,
'操作成功'
);
if
(
opResult
.
data
.
hasOwnProperty
(
'result_name'
))
{
return
system
.
getResult
(
opResult
.
data
,
'操作成功'
);
}
let
actionBody
=
await
this
.
redisClient
.
get
(
'ch'
+
JSON
.
stringify
(
pobj
.
actionBody
.
orderNo
));
if
(
!
actionBody
)
{
let
actionBody
=
await
this
.
redisClient
.
get
(
'ch'
+
JSON
.
stringify
(
pobj
.
actionBody
.
orderNo
));
if
(
!
actionBody
)
{
return
system
.
getResult
(
null
)
}
let
nameResult
=
await
this
.
restPostUrl
(
JSON
.
parse
(
actionBody
),
this
.
centerCacheUrl
+
"treasure_name"
);
if
(
nameResult
.
code
==
200
)
{
let
nameResult
=
await
this
.
restPostUrl
(
JSON
.
parse
(
actionBody
),
this
.
centerCacheUrl
+
"treasure_name"
);
if
(
nameResult
.
code
==
200
)
{
pobj
.
actionType
=
'addOrderDelivery'
;
pobj
.
actionBody
=
nameResult
.
data
;
//取名结果存储
let
result
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerOrderUrl
+
"action/nameOrder/springBoard"
);
return
system
.
getResult
(
nameResult
.
data
,
"操作成功"
);
let
result
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerOrderUrl
+
"action/nameOrder/springBoard"
);
return
system
.
getResult
(
nameResult
.
data
,
"操作成功"
);
}
return
system
.
getResult
(
null
,
'try again'
);
return
system
.
getResult
(
null
,
'try again'
);
}
async
getNames
(
pobj
,
actionBody
){
let
rtn
=
await
this
.
restClient
.
execPost
(
actionBody
,
this
.
aliGetNamesjavaUrl
);
if
(
!
rtn
.
stdout
)
{
return
system
.
getResultFail
();
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
)
{
return
system
.
getResultSuccess
(
result
);
async
getNames
(
req
,
actionBody
)
{
const
result
=
await
this
.
execPostByTimeOut
(
req
,
actionBody
,
this
.
aliGetNamesjavaUrl
);
if
(
result
.
status
!=
0
)
{
return
result
;
}
return
system
.
getResultFail
(
result
);
const
tmpData
=
result
.
data
?
result
.
data
.
companyName
:
[];
return
system
.
getResultSuccess
(
tmpData
);
}
}
...
...
@@ -153,7 +150,7 @@ const cacheJson = {
"科技类"
:
[
"网络科技"
,
"电子商务"
,
"信息技术"
,
"游戏"
,
"电子"
,
"软件"
,
"新材料"
,
"生物科技"
,
"教育科技"
,
"环保科技"
,
"信息科技"
],
"许可类"
:
[
"投资管理"
,
"金融"
,
"资产"
,
"商业保理"
,
"融资租赁"
,
"医疗器械"
,
"人力资源"
,
"食品"
,
"劳务派遣"
],
"服务类"
:
[
"广告"
,
"文化传媒"
,
"建筑装潢"
,
"设计"
,
"美容美发"
,
"房地产中介"
,
"物业管理"
,
"商务咨询"
,
"企业管理"
],
"其他"
:
[
"贸易"
,
"实业"
,
"制造"
,
"服饰"
,
"化妆品"
,
"工程"
,
"农业"
,
"餐饮管理"
,
"物流"
],
"其他"
:
[
"贸易"
,
"实业"
,
"制造"
,
"服饰"
,
"化妆品"
,
"工程"
,
"农业"
,
"餐饮管理"
,
"物流"
],
}
...
...
center-channel/app/base/api/web.base.js
View file @
14ac5993
...
...
@@ -5,6 +5,7 @@ const md5 = require("MD5");
class
WEBBase
{
constructor
()
{
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
execClientNew
=
system
.
getObject
(
"util.execClientNew"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
toolSve
=
system
.
getObject
(
"service.trademark.toolSve"
);
...
...
@@ -73,5 +74,18 @@ class WEBBase {
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
/**
* 带超时时间的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
;
}
}
module
.
exports
=
WEBBase
;
center-channel/app/base/service/app.base.js
View file @
14ac5993
...
...
@@ -463,5 +463,42 @@ class AppServiceBase {
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
,
"请求参数为空"
);
}
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
();
}
}
module
.
exports
=
AppServiceBase
;
center-channel/app/config/businessConfig.js
View file @
14ac5993
...
...
@@ -15,9 +15,10 @@ module.exports = {
"getItemByNeedNo"
,
"opNeedDetailByChannelNo"
,
"getNeedListUser"
,
"manualEvaluation"
,
"diagnosisInfo"
,
"check"
,
"enterpriseInfo"
,
"diagnosisDetail"
,
"submitIcpIntention"
,
"queryIntentionList"
,
"confirmIcpIntention"
,
"tmAccept"
,
"tmStatus"
,
"needBatchUpload"
,
"serviceSubmitOption"
,
"submitWangwenSolution"
,
"closeNeed"
,
"recordLog"
,
"recordLogList"
,
"foodServiceSubmitOption"
,
"submitFoodSolution"
,
"foodCloseNeed"
,
"foodRecordLog"
,
"foodRecordLogList"
,
"getParamsFor360"
,
"addOrderWeb"
,
"getPayRecords"
,
"getLoginInfo"
,
"putUserMobileByVcode"
,
"putUserPwdByMobile"
,
"icpNotifyNew"
"foodCloseNeed"
,
"foodRecordLog"
,
"foodRecordLogList"
,
"getParamsFor360"
,
"addOrderWeb"
,
"getPayRecords"
,
"getLoginInfo"
,
"putUserMobileByVcode"
,
"putUserPwdByMobile"
,
"icpNotifyNew"
],
apiMustUserpinList
:
[
"submitNeed"
,
"paySuccess"
,
"icpNotify"
,
"getLoginInfo"
,
"icpNotifyNew"
]
apiMustUserpinList
:
[
"submitNeed"
,
"paySuccess"
,
"icpNotify"
,
"getLoginInfo"
,
"icpNotifyNew"
],
apiSecretPathList
:
[
"/baidu/icp"
]
}
}
center-channel/app/config/routes/api.js
View file @
14ac5993
...
...
@@ -203,10 +203,12 @@ module.exports = function (app) {
app
.
use
(
'/orderNotify/channelPayNotify'
,
async
function
(
req
,
res
)
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
if
(
req
.
body
.
orderNo
.
startWith
(
'CN'
)){
var
result
=
await
utilsOrderSve
.
channelOrdersPayNotify
(
req
.
body
,
client_ip
);
let
result
=
{};
const
orderNo
=
req
.
body
.
orderNo
;
if
(
orderNo
.
indexOf
(
'CN'
)
==
0
){
result
=
await
utilsOrderSve
.
channelOrdersPayNotify
(
req
.
body
,
client_ip
);
}
else
{
var
result
=
await
utilsOrderSve
.
channelPayNotify
(
req
.
body
,
client_ip
);
result
=
await
utilsOrderSve
.
channelPayNotify
(
req
.
body
,
client_ip
);
}
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"渠道支付订单通知 api层"
,
...
...
center-channel/app/config/settings.js
View file @
14ac5993
...
...
@@ -60,7 +60,7 @@ var settings = {
},
aliGetNamesjavaUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"
192.168.210.240
:80/getNames"
;
return
"
http://localhost
:80/getNames"
;
}
else
{
return
"http://aliossjava-service/getNames"
;
}
...
...
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