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
87cf4805
Commit
87cf4805
authored
Oct 15, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
常用联系人、申请人
parent
54072566
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
226 additions
and
18 deletions
+226
-18
center-channel/app/base/api/impl/opaction/360tmOrder.js
+40
-0
center-channel/app/base/api/impl/opaction/order.js
+3
-0
center-channel/app/base/service/impl/utilsSve/utils360Sve.js
+57
-0
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
+5
-4
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
+30
-0
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+89
-13
center-channel/app/config/routes/api.js
+2
-1
No files found.
center-channel/app/base/api/impl/opaction/360tmOrder.js
0 → 100644
View file @
87cf4805
var
WEBBase
=
require
(
"../../web.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
ProductAPI
extends
WEBBase
{
constructor
()
{
super
();
this
.
utils360Sve
=
system
.
getObject
(
"service.utilsSve.utils360Sve"
);
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionProcess
)
{
return
system
.
getResult
(
null
,
"actionProcess参数不能为空"
);
}
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
pobj
.
requestId
=
req
.
requestId
;
var
opResult
=
null
;
switch
(
action_type
)
{
case
"getParamsFor360"
:
//创建订单
opResult
=
await
this
.
utils360Sve
.
getParamsFor360
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
}
module
.
exports
=
ProductAPI
;
center-channel/app/base/api/impl/opaction/order.js
View file @
87cf4805
...
...
@@ -29,6 +29,9 @@ class ProductAPI extends WEBBase {
case
"addOrder"
:
//创建订单
opResult
=
await
this
.
utilsOrderSve
.
addOrder
(
pobj
,
pobj
.
actionBody
);
break
;
case
"addOrderWeb"
:
//创建订单 官网
opResult
=
await
this
.
utilsOrderSve
.
addOrderWeb
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getOrderInfo"
:
//获取订单列表信息
opResult
=
await
this
.
utilsOrderSve
.
getOrderInfo
(
pobj
,
pobj
.
actionBody
);
break
;
...
...
center-channel/app/base/service/impl/utilsSve/utils360Sve.js
0 → 100644
View file @
87cf4805
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
md5
=
require
(
'md5'
)
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
//阿里支付类
class
utils360Sve
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
centerAppUrl
=
settings
.
centerAppUrl
();
}
//-------------------------------------------钉钉h5支付-----------------开始
async
getParamsFor360
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100110"
);
}
pobj
.
actionType
=
"getPayOrderInfo"
;
var
orderUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
var
orderResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
if
(
orderResult
.
status
!=
0
)
{
return
orderResult
;
}
pobj
.
actionType
=
"getOrderDeliveryInfo"
;
var
deliveryResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
if
(
deliveryResult
.
status
!=
0
)
{
return
deliveryResult
;
}
let
sku_id
=
orderResult
.
data
.
orderProduct
.
itemCode
;
let
price
=
Number
(
orderResult
.
data
.
orderProduct
.
price
)
*
100
;
let
quantity
=
orderResult
.
data
.
orderProduct
.
quantity
;
let
amount
=
Number
(
orderResult
.
data
.
receiptVoucher
.
totalSum
)
*
100
;
let
order_id
=
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
;
let
consignee
=
deliveryResult
.
data
.
orderContact
.
contactName
;
let
mobile
=
deliveryResult
.
data
.
orderContact
.
mobile
;
let
email
=
deliveryResult
.
data
.
orderContact
.
email
;
let
singStr
=
sku_id
+
price
+
order_id
+
pobj
.
appInfo
.
uapp_secret
;
let
sign
=
md5
(
singStr
).
toUpperCase
();
let
result
=
{
sku_id
,
price
,
quantity
,
amount
,
order_id
,
consignee
,
mobile
,
email
,
sign
}
return
system
.
getResult
(
result
);
}
//-------------------------------------------钉钉h5支付-----------------结束
}
module
.
exports
=
utils360Sve
;
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
View file @
87cf4805
...
...
@@ -160,24 +160,25 @@ class UtilsAuthService extends AppServiceBase {
}
/**
*
官网首页跳转自主注册
*
解析用户,获取认证token
* @param pobj
* @param actionBody
* @param req
* @returns {Promise<void>}
*/
async
channelUserLogin
(
pobj
,
actionBody
,
req
){
//
官网
登录地址
let
skipUrl
=
'
http://gsbweb.qifu.gongsibao.com
'
;
//
360
登录地址
let
skipUrl
=
''
;
let
opResult
=
system
.
getResult
(
null
,
"req Failure"
);
//----通过Authorization 获取用户信息
let
Authorization
=
req
.
headers
[
"authorization"
]
||
""
;
if
(
!
Authorization
){
opResult
.
data
.
redirectUrl
=
skipUrl
;
opResult
=
system
.
getResultFail
(
-
99
,
'用户未登录'
,{
redirectUrl
:
'skipUrl'
});
return
opResult
;
}
let
icCompanyUrl
=
'
https://icompanytest.gongsibao.com/api/tUserInfo/info
'
;
let
icCompanyUrl
=
''
;
let
subData
=
{
Authorization
:
Authorization
}
...
...
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
View file @
87cf4805
...
...
@@ -113,6 +113,36 @@ class UtilsFqAliyunService extends AppServiceBase {
return
verify
;
}
//下订单到ic
async
pushOrder2IC
(
pobj
){
console
.
log
(
JSON
.
stringify
(
pobj
),
".................pushOrderBusinessByProductCode2Fq...............pobj"
);
var
verifyResult
=
await
this
.
verifyParam
(
pobj
);
var
productInfo
=
pobj
.
actionBody
.
product_info
;
if
(
verifyResult
.
status
!=
0
)
{
return
await
this
.
disposePushResultFail
(
pobj
,
verifyResult
,
"fq->pushAliBusiness2Fq->verifyResult"
,
this
.
pushlogFailType
.
FQ
);
}
if
(
!
productInfo
||
!
productInfo
.
service_business_code
)
{
verifyResult
=
system
.
getResult
(
null
,
"orderInfo.productInfo.service_business_code can not be empty,100427"
);
}
if
(
!
productInfo
||
!
productInfo
.
price_item
||
!
productInfo
.
price_item
.
service_code
)
{
verifyResult
=
system
.
getResult
(
null
,
"orderInfo.productInfo.price_item.service_code can not be empty,100430"
);
}
var
interface_params_info
=
verifyResult
.
data
;
//新增订单(商标自助注册) IC
let
icOrderParams
=
{
"idempotentSource"
:
"pcwebsbzc"
,
// 来源编号,写死:pcwebsbzc,必填
"idempotentSourceName"
:
"PC官网"
,
// 来源编号,写死:PC官网,必填
"product_img_url"
:
pobj
.
actionBody
.
product_img_url
,
//产品图片
"productId"
:
productInfo
.
price_item
.
service_code
,
// 云服产品skuid,必填
"goodsId"
:
pobj
.
actionBody
.
goodsId
,
// 官网产品id
"customerId"
:
pobj
.
actionBody
.
customerId
,
//客户Id,必填
"product_item"
:
pobj
.
actionBody
.
product_item
}
pobj
.
params
=
icOrderParams
;
var
result
=
await
this
.
opAliyunClientPost
(
pobj
,
interface_params_info
.
opUrl
,
interface_params_info
.
key
,
interface_params_info
.
secret
,
icOrderParams
);
return
await
this
.
disposePushResult
(
pobj
,
result
,
"fq->pushOrderBusinessByProductCode2Fq->result"
,
this
.
pushlogFailType
.
FQ
);
}
//--------------------------------------------------内部辅助方法-------------------end-----------------
}
module
.
exports
=
UtilsFqAliyunService
;
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
87cf4805
...
...
@@ -892,19 +892,19 @@ class UtilsOrderService extends AppServiceBase {
}
var
appInfo
=
appInfoRt
.
data
;
// 拿锁
var
locker
=
await
this
.
cacheManager
[
"TlPayLocker"
].
enter
(
params
.
orderNo
);
console
.
log
(
"拿锁结果"
,
locker
)
if
(
!
locker
||
locker
!=
"1"
)
{
this
.
logCtl
.
info
({
appid
:
appInfoRt
.
data
.
uappId
,
appkey
:
""
,
op
:
"service/impl/utilsSve/utilsOrderSve.js/channelPayNotify"
,
content
:
"参数="
+
JSON
.
stringify
(
params
),
clientIp
:
params
.
client_ip
||
""
,
optitle
:
"阿里回调操作频繁---太频繁了,太频繁了"
});
return
system
.
getResultFail
(
-
200
,
"阿里回调操作频繁---太频繁了,太频繁了"
);
}
//
var locker = await this.cacheManager["TlPayLocker"].enter(params.orderNo);
//
console.log("拿锁结果", locker)
//
if (!locker || locker != "1") {
//
this.logCtl.info({
//
appid: appInfoRt.data.uappId,
//
appkey: "",
//
op: "service/impl/utilsSve/utilsOrderSve.js/channelPayNotify",
//
content: "参数=" + JSON.stringify(params),
//
clientIp: params.client_ip || "",
//
optitle: "阿里回调操作频繁---太频繁了,太频繁了"
//
});
//
return system.getResultFail(-200, "阿里回调操作频繁---太频繁了,太频繁了");
//
}
params
.
appInfo
=
{
uapp_id
:
appInfo
.
uapp_id
};
params
.
pay_type
=
params
.
payType
;
//修改并返回订单支付状态,创建收款单
...
...
@@ -939,7 +939,11 @@ class UtilsOrderService extends AppServiceBase {
}
// 推送
if
([
'icpsq'
,
'edisq'
].
includes
(
opOrderResult
.
data
.
product_info
.
channel_item_code
)){
this
.
utilsPushSve
.
aliBusiness2Delivery
(
pobj
,
"pushDeliveryOrder"
);
}
else
{
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
"pushOrder"
,
0
);
}
opOrderResult
.
data
=
null
;
return
opOrderResult
;
}
catch
(
e
)
{
...
...
@@ -1121,5 +1125,77 @@ class UtilsOrderService extends AppServiceBase {
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
//创建订单 官网
async
addOrderWeb
(
pobj
,
actionBody
){
if
(
!
actionBody
.
quantity
||
Number
(
actionBody
.
quantity
)
<=
0
)
{
return
system
.
getResult
(
null
,
"订单数量为空或有误,100030"
);
}
if
(
!
actionBody
.
goodsId
){
return
system
.
getResult
(
null
,
"官网产品id不能为空"
)
}
if
(
!
actionBody
.
customerId
){
return
system
.
getResult
(
null
,
'客户Id不能为空'
)
}
if
(
actionBody
.
deliveryData
.
nclones
.
length
<=
0
){
return
system
.
getResult
(
null
,
'尼斯不能为空'
)
}
if
(
actionBody
.
quantity
!=
actionBody
.
deliveryData
.
nclones
.
length
||
Number
(
actionBody
.
quantity
)
!=
actionBody
.
deliveryData
.
nclones
.
length
)
{
return
system
.
getResult
(
null
,
"订单数量有误,100030"
);
}
pobj
.
actionType
=
"getProductDetail"
;
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
productItemResult
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
productItemResult
.
status
!=
0
)
{
return
productItemResult
;
}
pobj
.
actionBody
.
product_info
=
productItemResult
.
data
;
pobj
.
actionType
=
"getProductInterface"
;
pobj
.
actionBody
.
product_id
=
productItemResult
.
data
.
id
;
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
pobj
,
url
);
pobj
.
actionBody
.
product_info
.
interface_info
=
productItemInterfaceResult
.
data
;
let
nclones
=
actionBody
.
deliveryData
.
nclones
;
//大项集合
let
product_item
=
[];
//产品项
for
(
let
i
=
0
;
i
<
nclones
.
length
;
i
++
){
let
nclone
=
nclones
[
i
];
if
(
nclone
.
nclThree
.
length
>
10
){
actionBody
.
additions
=
{
"payCode"
:
"zzsbzc-2"
,
// Y 支付价格code
"quantity"
:
nclone
.
nclThree
.
length
-
10
// Y 购买数量
}
}
actionBody
.
totalSum
=
0
;
actionBody
.
quantity
=
1
;
actionBody
.
deliveryData
.
nclones
=
[
nclone
]
var
verifyResult
=
await
this
.
isOrderVerify
(
pobj
,
pobj
.
actionBody
);
actionBody
.
payTotalSum
=
actionBody
.
totalSum
;
let
saveResult
=
await
this
.
addOrder
(
pobj
,
actionBody
);
if
(
saveResult
.
status
!=
0
){
return
saveResult
;
}
let
obj
=
{
idempotentId
:
saveResult
.
data
.
orderNo
,
//商标注册订单id
nclCount
:
nclone
.
nclThree
.
length
-
10
>
0
?
nclone
.
nclThree
.
length
-
10
:
0
//小项数量
}
product_item
.
push
(
obj
);
}
actionBody
.
product_item
=
product_item
;
//新增订单(商标自助注册) IC
let
icOrderResult
=
await
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
"pushOrder2IC"
,
0
);
if
(
icOrderResult
.
status
!=
0
){
return
icOrderResult
;
}
let
ids
=
icOrderResult
.
data
.
orderList
;
let
orderServiceNo
=
this
.
getBusUid
(
"CN"
);
let
orderUrl
=
settings
.
centerOrderUrl
()
+
'action/order/springBoard'
;
for
(
let
i
=
0
;
i
<
ids
.
length
;
i
++
){
let
orderNo
=
ids
[
i
].
idempotentId
;
let
contractNo
=
ids
[
i
].
contractNo
;
actionBody
.
orderNo
=
orderNo
;
actionBody
.
contractNo
=
contractNo
;
actionBody
.
orderServiceNo
=
orderServiceNo
;
this
.
restPostUrl
(
orderUrl
,
pobj
);
}
}
}
module
.
exports
=
UtilsOrderService
;
center-channel/app/config/routes/api.js
View file @
87cf4805
...
...
@@ -282,7 +282,8 @@ module.exports = function (app) {
"submitIcpIntention"
,
"queryIntentionList"
,
"confirmIcpIntention"
,
"tmAccept"
,
"tmStatus"
,
"needBatchUpload"
,
"serviceSubmitOption"
,
"submitWangwenSolution"
,
"closeNeed"
,
"recordLog"
,
"recordLogList"
"serviceSubmitOption"
,
"submitWangwenSolution"
,
"closeNeed"
,
"recordLog"
,
"recordLogList"
,
"getParamsFor360"
,
"addOrderWeb"
,
];
if
(
lst
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
...
...
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