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
54723c5e
Commit
54723c5e
authored
Nov 14, 2019
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
e46a7cce
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
218 additions
and
31 deletions
+218
-31
igirl-channel/app/base/api/impl/action/tmOrder.js
+2
-1
igirl-channel/app/base/api/impl/test/testApi.js
+71
-25
igirl-channel/app/base/db/impl/dborder/orderDao.js
+2
-4
igirl-channel/app/base/service/impl/dborder/orderSve.js
+142
-0
igirl-channel/app/base/utils/execClient.js
+1
-1
No files found.
igirl-channel/app/base/api/impl/action/tmOrder.js
View file @
54723c5e
...
@@ -5,6 +5,7 @@ class TmOrderAPI extends APIBase {
...
@@ -5,6 +5,7 @@ class TmOrderAPI extends APIBase {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
opPlatformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
orderSve
=
system
.
getObject
(
"service.dborder.orderSve"
);
this
.
ordertmproductSve
=
system
.
getObject
(
"service.dborder.ordertmproductSve"
);
this
.
ordertmproductSve
=
system
.
getObject
(
"service.dborder.ordertmproductSve"
);
this
.
customerinfoSve
=
system
.
getObject
(
"service.dborder.customerinfoSve"
);
this
.
customerinfoSve
=
system
.
getObject
(
"service.dborder.customerinfoSve"
);
this
.
customercontactsSve
=
system
.
getObject
(
"service.dborder.customercontactsSve"
);
this
.
customercontactsSve
=
system
.
getObject
(
"service.dborder.customercontactsSve"
);
...
@@ -61,7 +62,7 @@ class TmOrderAPI extends APIBase {
...
@@ -61,7 +62,7 @@ class TmOrderAPI extends APIBase {
opResult
=
await
this
.
toolSve
.
decryptStr
(
req
.
app
,
action_body
.
opStr
);
opResult
=
await
this
.
toolSve
.
decryptStr
(
req
.
app
,
action_body
.
opStr
);
break
;
break
;
case
"op1688ChannelPushOrder"
:
//处理渠道订单信息
case
"op1688ChannelPushOrder"
:
//处理渠道订单信息
opResult
=
await
this
.
order
tmproductSve
.
op1688ChannelPushOrder
(
action_body
);
opResult
=
await
this
.
order
Sve
.
op1688ChannelPushOrderTest
(
action_body
,
req
);
if
(
opResult
.
status
==
0
)
{
if
(
opResult
.
status
==
0
)
{
opResult
.
data
=
null
;
opResult
.
data
=
null
;
var
encryptResult
=
await
this
.
toolSve
.
encryptStr
(
req
.
app
,
action_body
.
channelUserId
);
var
encryptResult
=
await
this
.
toolSve
.
encryptStr
(
req
.
app
,
action_body
.
channelUserId
);
...
...
igirl-channel/app/base/api/impl/test/testApi.js
View file @
54723c5e
var
APIBase
=
require
(
"../../api.base"
);
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
system
=
require
(
"../../../system"
);
var
moment
=
require
(
"moment"
);
class
TestAPI
extends
APIBase
{
class
TestAPI
extends
APIBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
orderSve
=
system
.
getObject
(
"service.dborder.orderSve"
);
}
}
async
test
(
pobj
,
query
,
req
)
{
async
test
(
pobj
,
query
,
req
)
{
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
// var rc = system.getObject("util.aliyunClient");
var
param
=
pobj
;
// var param = pobj;
try
{
// try {
var
body
=
{
// var body = {
idempotentId
:
"fzsbzc"
,
// 是 业务 ID
// idempotentId: "fzsbzc",// 是 业务 ID
idempotentSource
:
param
.
appSourceCode
||
"tm_1688"
,
// 是 业务来源(ali、jd)
// idempotentSource: param.appSourceCode || "tm_1688",// 是 业务来源(ali、jd)
idempotentSourceName
:
param
.
name
||
"1688应用"
,
// 是 阿里,京东
// idempotentSourceName: param.name || "1688应用",// 是 阿里,京东
city
:
""
,
// 否 所属城市
// city: "",// 否 所属城市
phone
:
"15010929366"
,
// 是 手机号
// phone:"15010929366",// 是 手机号
userId
:
"channelUserIdtest01"
,
// 否 用户 ID
// userId: "channelUserIdtest01",// 否 用户 ID
companyName
:
""
,
// 否 公司名称
// companyName: "",// 否 公司名称
orderPrice
:
899
,
// 是 订单金额
// orderPrice: 899,// 是 订单金额
productId
:
"5dc936eb296d1572b9bc5b8d"
,
// 是 产品 ID
// productId: "5dc936eb296d1572b9bc5b8d",// 是 产品 ID
productQuantity
:
1
,
// 是 产品数量
// productQuantity: 1,// 是 产品数量
};
// };
var
submitTm
=
await
rc
.
post
(
"https://yunfuapi.gongsibao.com/crm/order/submit"
,
body
);
// var submitTm = await rc.post("https://yunfuapi.gongsibao.com/crm/order/submit", body);
return
{
code
:
200
,
message
:
"ok"
,
data
:
submitTm
};
// return { code: 200, message: "ok", data: submitTm };
}
catch
(
e
)
{
// } catch (e) {
//日志记录
// //日志记录
logCtl
.
error
({
// logCtl.error({
optitle
:
"查询阿里商标状态异常---error"
,
// optitle: "查询阿里商标状态异常---error",
op
:
"base/api/impl/tmsub/queryAliTmStatus"
,
// op: "base/api/impl/tmsub/queryAliTmStatus",
content
:
e
.
stack
,
// content: e.stack,
clientIp
:
""
// clientIp: ""
});
// });
// }
var
body
=
{
channelItemCode
:
"1329709"
};
returnRuslt
=
{
"returnValue"
:
[
{
"bizStatusExt"
:
"service"
,
"memberId"
:
"b2b-****02"
,
"productName"
:
"商机**"
,
"gmtCreate"
:
"20171231200252000+0800"
,
"gmtServiceEnd"
:
"20190101000000000+0800"
,
"bizStatus"
:
"S"
,
"paymentAmount"
:
420
,
"executePrice"
:
420
,
"orderItemNum"
:
"W1712*****_1"
,
"gmtServiceBegin"
:
"20171231000000000+0800"
,
"gmtConfirm"
:
"20171231200329000+0800"
,
"settleItemDtos"
:
[
],
"payCustomerUid"
:
"12345678990000"
,
"signCustomerUid"
:
"12345678990000"
}
}
],
"successed"
:
true
};
var
tmpreq
=
{
app
:};
this
.
orderSve
.
addOrderNeed
()
return
system
.
getResultSuccess
({
req
:
"ok"
});
return
system
.
getResultSuccess
({
req
:
"ok"
});
}
}
}
}
...
...
igirl-channel/app/base/db/impl/dborder/orderDao.js
View file @
54723c5e
...
@@ -68,8 +68,6 @@ class OrderDao extends Dao {
...
@@ -68,8 +68,6 @@ class OrderDao extends Dao {
pfSettleProfit
:
0
,
// 平台结算渠道利润,0否,1是
pfSettleProfit
:
0
,
// 平台结算渠道利润,0否,1是
notes
:
apply
.
notes
,
//备注
notes
:
apply
.
notes
,
//备注
appPayType
:
app
.
appPayType
,
// 支付类型:00第三方支付,10平台代收款
appPayType
:
app
.
appPayType
,
// 支付类型:00第三方支付,10平台代收款
// payAccountType: app.appPayType == "00" ? "other" : null,// 帐户类型( 支付类型):cash: 现金, bank: 银行,wx:微信,alipay:支付,other:其它
// payTime: channelOrder.payStatus == "yfk" ? new Date() : null,//支付时间
createuser_id
:
user
.
id
,
createuser_id
:
user
.
id
,
owner_id
:
user
.
id
,
//
owner_id
:
user
.
id
,
//
creator
:
user
.
nickname
,
creator
:
user
.
nickname
,
...
@@ -79,8 +77,8 @@ class OrderDao extends Dao {
...
@@ -79,8 +77,8 @@ class OrderDao extends Dao {
channelUserId
:
channelUser
.
channelUserId
,
// 渠道用户id
channelUserId
:
channelUser
.
channelUserId
,
// 渠道用户id
needNo
:
channelOrder
.
needNo
||
null
,
//需求单号
needNo
:
channelOrder
.
needNo
||
null
,
//需求单号
picUrl
:
productItem
.
picUrl
,
//
picUrl
:
productItem
.
picUrl
,
//
productType_id
:
productItem
.
p
icUrl
,
//产品类型Id
productType_id
:
productItem
.
p
roductType_id
,
//产品类型Id
productOneType_id
:
productItem
.
p
icUrl
,
//产品大类Id
productOneType_id
:
productItem
.
p
roductOneType_id
,
//产品大类Id
serviceItemSnapshot
:
JSON
.
stringify
(
productItem
),
//产品快照
serviceItemSnapshot
:
JSON
.
stringify
(
productItem
),
//产品快照
};
};
var
order
=
await
this
.
create
(
orderObj
,
t
);
var
order
=
await
this
.
create
(
orderObj
,
t
);
...
...
igirl-channel/app/base/service/impl/dborder/orderSve.js
View file @
54723c5e
...
@@ -5,6 +5,148 @@ const settings = require("../../../../config/settings");
...
@@ -5,6 +5,148 @@ const settings = require("../../../../config/settings");
class
OrderService
extends
ServiceBase
{
class
OrderService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"dborder"
,
ServiceBase
.
getDaoName
(
OrderService
));
super
(
"dborder"
,
ServiceBase
.
getDaoName
(
OrderService
));
this
.
logCtl
=
system
.
getObject
(
"web.common.oplogCtl"
);
this
.
appproductDao
=
system
.
getObject
(
"db.dbapp.appproductDao"
);
}
async
op1688ChannelPushOrder
(
action_body
,
req
)
{
try
{
var
reqUrl
=
"https://inte-mcp.chanjet.com/gsb/getOrder?token="
+
action_body
.
token
;
var
rtn
=
await
this
.
execClient
.
execGet
(
""
,
reqUrl
);
this
.
logCtl
.
info
({
appid
:
req
.
app
.
id
,
appkey
:
req
.
app
.
uappKey
,
requestId
:
req
.
requestId
||
""
,
op
:
"/igirl-channel/zhichan/igirl-channel/app/base/service/impl/dborder/orderSve/opChannelCallbackData"
,
content
:
"请求地址:"
+
reqUrl
,
clientIp
:
pobj
.
clientIp
,
optitle
:
"渠道回调信息返回结果:"
+
rtn
.
stdout
,
});
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
&&
result
.
successed
&&
result
.
successed
==
true
&&
result
.
returnValue
&&
result
.
returnValue
.
length
)
{
this
.
addOrderNeed
(
action_body
,
req
,
result
.
returnValue
);
}
//操作需求
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
this
.
logCtl
.
error
({
appid
:
req
.
app
.
id
,
appkey
:
req
.
app
.
uappKey
,
requestId
:
req
.
requestId
||
""
,
op
:
"/igirl-channel/zhichan/igirl-channel/app/base/service/impl/dborder/orderSve/opChannelCallbackData"
,
content
:
"请求地址:"
+
reqUrl
+
",error:"
+
e
.
stack
,
clientIp
:
pobj
.
clientIp
,
optitle
:
"渠道回调信息返回结果:"
+
rtn
.
stdout
,
});
}
}
async
op1688ChannelPushOrderTest
(
action_body
,
req
)
{
try
{
var
returnValue
=
[
{
"bizStatusExt"
:
"service"
,
"memberId"
:
"b2b-****02"
,
"productName"
:
"商机**"
,
"gmtCreate"
:
"20171231200252000+0800"
,
"gmtServiceEnd"
:
"20190101000000000+0800"
,
"bizStatus"
:
"S"
,
"paymentAmount"
:
420
,
"executePrice"
:
420
,
"orderItemNum"
:
"W171200000000_44"
,
"gmtServiceBegin"
:
"20171231000000000+0800"
,
"gmtConfirm"
:
"20171231200329000+0800"
,
"settleItemDtos"
:
[],
"payCustomerUid"
:
"12345678990000"
,
"signCustomerUid"
:
"12345678990000"
},
{
"bizStatusExt"
:
"service"
,
"memberId"
:
"b2b-****02"
,
"productName"
:
"商机**"
,
"gmtCreate"
:
"20171231200252000+0800"
,
"gmtServiceEnd"
:
"20190101000000000+0800"
,
"bizStatus"
:
"S"
,
"paymentAmount"
:
420
,
"executePrice"
:
420
,
"orderItemNum"
:
"W171200000000_33"
,
"gmtServiceBegin"
:
"20171231000000000+0800"
,
"gmtConfirm"
:
"20171231200329000+0800"
,
"settleItemDtos"
:
[],
"payCustomerUid"
:
"12345678990000"
,
"signCustomerUid"
:
"12345678990000"
}
];
this
.
addOrderNeed
(
action_body
,
req
,
returnValue
);
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
console
.
log
(
e
.
stack
,
"渠道回调信息返回结果:error..........."
)
this
.
logCtl
.
error
({
appid
:
req
.
app
.
id
,
appkey
:
req
.
app
.
uappKey
,
requestId
:
req
.
requestId
||
""
,
op
:
"/igirl-channel/zhichan/igirl-channel/app/base/service/impl/dborder/orderSve/opChannelCallbackData"
,
content
:
"请求地址:"
+
reqUrl
+
",error:"
+
e
.
stack
,
clientIp
:
pobj
.
clientIp
,
optitle
:
"渠道回调信息返回结果:"
+
rtn
.
stdout
,
});
}
}
async
addOrderNeed
(
action_body
,
req
,
returnValue
)
{
var
addOrderList
=
[];
var
productItem
=
await
this
.
appproductDao
.
findOneByChannelItemCode
(
action_body
.
channelItemCode
,
req
.
app
.
id
);
//获取产品
if
(
!
productItem
)
{
return
;
}
//创建订单
var
ordercode
=
await
this
.
getBusUid
(
"ts"
);
for
(
let
index
=
0
;
index
<
returnValue
.
length
;
index
++
)
{
const
element
=
returnValue
[
index
];
if
(
element
)
{
if
(
element
.
bizStatusExt
==
"service"
)
{
var
payTime
=
null
;
if
(
element
.
gmtCreate
&&
element
.
gmtCreate
.
length
>
14
)
{
payTime
=
element
.
gmtCreate
.
substr
(
0
,
4
)
+
"-"
+
element
.
gmtCreate
.
substr
(
4
,
2
)
+
"-"
+
element
.
gmtCreate
.
substr
(
6
,
2
)
+
" "
+
element
.
gmtCreate
.
substr
(
8
,
2
)
+
":"
+
element
.
gmtCreate
.
substr
(
10
,
2
)
+
":"
+
element
.
gmtCreate
.
substr
(
12
,
2
);
}
addOrderList
.
push
({
app_id
:
req
.
app
.
id
,
//
orderNo
:
ordercode
,
// 订单号
channelServiceNo
:
element
.
orderItemNum
,
// 渠道服务单号
payTime
:
payTime
,
//
itemCode
:
productItem
.
itemCode
,
//
itemName
:
productItem
.
itemName
,
//
channelItemCode
:
productItem
.
channelItemCode
,
// 渠道产品编码
channelItemName
:
productItem
.
channelItemName
,
// 渠道产品名称
salesNum
:
1
,
//项目订单数量(即服务项目的倍数,默认值为1)
salesDiliverNum
:
0
,
//项目订单交付数量(即与项目订单数量相对应)
minitermNum
:
10
,
//订单小项数量
minitermDiliverNum
:
0
,
//订单小项交付数量
orderType
:
"dkxd"
,
// 订单类型,zzdd: 自主订单,dkxd: 代客下单
orderPayStatus
:
"yfk"
,
// 订单付款状态dfk: 待付款, zfpz: 已上传支付凭证, yfk: 已付款, ddqx: 订单取消, tkclz: 退款处理中, bfytk: 部分已退款, ytk: 已退款,zfshbtg:支付审核不通过
totalServiceCharge
:
productItem
.
totalServiceCharge
||
0
,
// 服务费总额(产品配置的服务费*订单件数)
totalPublicExpense
:
productItem
.
totalPublicExpense
||
0
,
// 官费总额(产品配置的官费*订单件数)
totalSum
:
element
.
executePrice
||
0
,
// 订单总额(产品价格×优惠费率×订单件数)
refundSum
:
0
,
// 退款金额
// notes: apply.notes, //备注
appPayType
:
"00"
,
// 支付类型:00第三方支付,10平台代收款
payAccountType
:
"other"
,
// 帐户类型( 支付类型):cash: 现金, bank: 银行,wx:微信,alipay:支付,other:其它
createuser_id
:
req
.
user
.
id
,
owner_id
:
req
.
user
.
id
,
//
creator
:
req
.
user
.
nickname
||
""
,
owner
:
req
.
user
.
nickname
||
""
,
//
ownerMoblie
:
req
.
user
.
userMoblie
||
""
,
//
invoiceApplyStatus
:
"00"
,
// 发票状态:00: 未申请, 10: 已申请,20:已开票
channelUserId
:
req
.
user
.
channelUserId
||
""
,
// 渠道用户id
needNo
:
element
.
orderItemNum
||
null
,
//需求单号
picUrl
:
productItem
.
picUrl
,
//
productType_id
:
productItem
.
productType_id
,
//产品类型Id
productOneType_id
:
productItem
.
productOneType_id
,
//产品大类Id
serviceItemSnapshot
:
JSON
.
stringify
(
productItem
),
//产品快照
});
}
}
}
this
.
dao
.
model
.
bulkCreate
(
addOrderList
);
}
}
}
}
module
.
exports
=
OrderService
;
module
.
exports
=
OrderService
;
igirl-channel/app/base/utils/execClient.js
View file @
54723c5e
...
@@ -4,7 +4,7 @@ const exec = util.promisify(require('child_process').exec);
...
@@ -4,7 +4,7 @@ const exec = util.promisify(require('child_process').exec);
class
ExecClient
{
class
ExecClient
{
constructor
()
{
constructor
()
{
this
.
cmdPostPattern
=
"curl -
-user admines:adminGSBes. -
k -H 'Content-type: application/json' -d '{data}' {url}"
;
this
.
cmdPostPattern
=
"curl -k -H 'Content-type: application/json' -d '{data}' {url}"
;
this
.
cmdGetPattern
=
"curl -G -X GET '{url}'"
;
this
.
cmdGetPattern
=
"curl -G -X GET '{url}'"
;
this
.
cmdPushDataPostPattern
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"
;
this
.
cmdPushDataPostPattern
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"
;
...
...
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