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
a6d53585
Commit
a6d53585
authored
Mar 14, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
52596cca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
147 deletions
+1
-147
bpo-admin/app/base/api/impl/channelApi2.js
+0
-146
bpo-admin/app/base/api/impl/testApi.js
+1
-1
No files found.
bpo-admin/app/base/api/impl/channelApi2.js
deleted
100644 → 0
View file @
52596cca
var
system
=
require
(
"../../system"
)
const
md5
=
require
(
"MD5"
);
const
logCtl
=
system
.
getObject
(
"web.oplogCtl"
);
const
moment
=
require
(
"moment"
);
class
ChannelApi2
{
constructor
()
{
this
.
channelSve
=
system
.
getObject
(
"service.channelSve"
);
this
.
esettleSve
=
system
.
getObject
(
"service.esettleSve"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
esettleofflineitemSve
=
system
.
getObject
(
"service.esettleofflineitemSve"
);
this
.
FQURL
=
"http://yunfuapi-dev.gongsibao.com/crm/order/submit"
this
.
esettleofflineSve
=
system
.
getObject
(
"service.esettleofflineSve"
);
}
//渠道绑定
async
bindPlatform
(
queryobj
,
qobj
,
req
)
{
if
(
!
this
.
trim
(
queryobj
.
platform_id
))
{
return
system
.
getErrResult2
(
"platform_id不能为空"
)
}
if
(
!
this
.
trim
(
queryobj
.
channel_id
))
{
return
system
.
getErrResult2
(
"channel_id不能为空"
)
}
if
(
!
this
.
trim
(
queryobj
.
platform_channel_id
))
{
return
system
.
getErrResult2
(
"platform_channel_id不能为空"
)
}
var
result
=
await
this
.
channelSve
.
bindPlatform
(
queryobj
);
return
result
;
}
//绑定渠道推送
async
pushbindingchannel
(
queryobj
,
qobj
,
req
)
{
queryobj
.
begin
=
moment
().
subtract
(
1
,
'days'
).
format
(
'YYYY-MM-DD 00:00:00'
);
/*前一天的时间*/
queryobj
.
end
=
moment
().
subtract
(
1
,
'days'
).
format
(
'YYYY-MM-DD 23:59:59'
);
/*前一天的时间*/
var
result
=
await
this
.
channelSve
.
pushbindingchannel
(
queryobj
);
var
data
=
result
.
data
;
if
(
data
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
channel_id
==
'10000'
&&
data
[
i
].
origin_merchant_id
!=
''
)
{
var
busiData
=
await
this
.
esettleSve
.
findBybusiId
(
data
[
i
].
origin_merchant_id
);
if
(
busiData
.
length
>
0
)
{
for
(
let
j
=
0
;
j
<
busiData
.
length
;
j
++
)
{
var
pushData
=
this
.
getBusiData
(
busiData
[
j
],
data
[
i
]);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
null
;
rtn
=
await
rc
.
post
(
this
.
FQURL
,
pushData
);
console
.
log
(
pushData
)
console
.
log
(
rtn
)
}
}
}
else
{
if
(
data
[
i
].
origin_merchant_id
!=
''
)
{
var
esettleoffline
=
await
this
.
esettleofflineSve
.
findOne
({
"ecompany_id"
:
data
[
i
].
origin_merchant_id
});
if
(
esettleoffline
!=
null
)
{
var
pushData
=
this
.
getBusiDatas
(
esettleoffline
.
dataValues
,
data
[
i
]);
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
null
;
rtn
=
await
rc
.
post
(
this
.
FQURL
,
pushData
);
console
.
log
(
pushData
)
console
.
log
(
rtn
)
}
}
}
}
}
}
async
paydayCount
(
queryobj
,
qobj
,
req
)
{
var
data
=
await
this
.
separateGet
(
queryobj
);
console
.
log
(
data
.
dataValues
)
}
async
separateGet
(
queryobj
)
{
let
encry
=
system
.
decryption
(
queryobj
.
param
);
encry
=
JSON
.
parse
(
encry
);
if
(
encry
.
channel_id
==
10000
)
{
var
busiData
=
await
this
.
esettleSve
.
findByIdList
(
encry
.
data_id
);
return
busiData
;
}
var
esettleoffline
=
await
this
.
esettleofflineitemSve
.
find
({
"esettleoffline_id"
:
encry
.
data_id
});
return
esettleoffline
;
}
getBusiData
(
da
,
chnanel
)
{
var
resultData
=
{
"idempotentId"
:
da
.
out_trade_no
,
// 业务编号(订单id)
"idempotentSource"
:
"bpo_xbg"
,
// 来源编号,写死:bpo_xbg
"idempotentSourceName"
:
"BPO"
,
// 来源编号,写死:BPO薪必果
"thirdPartyChannelId"
:
"10000"
,
// 渠道id
"thirdPartyCustomerId"
:
da
.
busi_id
,
// 第三方客户id
"productId"
:
"5e6b02cc3290c3000a3a63dc"
,
// 云服产品id (测试环境)
"allotRatio"
:
"50"
,
// 分润比例(百分比的数字部分(如:50代表50%))
"orderPrice"
:
da
.
deduct_amt
,
// 订单金额
"productQuantity"
:
"1"
,
// 产品数量
"companyName"
:
chnanel
.
merchant_name
,
// 公司名称
"phone"
:
"13722223333"
};
var
str
=
{
"data_id"
:
da
.
id
,
// 发薪批次id tbl_order.id 或者 c_esettle_offline.id
"channel_id"
:
chnanel
.
channel_id
,
//渠道id
"channel_merchant_id"
:
da
.
busi_id
,
//渠道商户id
"origin_merchant_id"
:
chnanel
.
origin_merchant_id
,
//来源商户id
"pushplatform_channel_id"
:
chnanel
.
platform_id
,
//对方渠道id
};
let
encry
=
System
.
encryption
(
JSON
.
stringify
(
str
));
resultData
.
param
=
system
.
encryption
(
encry
);
return
resultData
;
}
getBusiDatas
(
da
,
chnanel
)
{
var
resultData
=
{
"idempotentId"
:
da
.
id
,
// 业务编号(订单id)
"idempotentSource"
:
"bpo_xbg"
,
// 来源编号,写死:bpo_xbg
"idempotentSourceName"
:
"BPO"
,
// 来源编号,写死:BPO薪必果
"thirdPartyChannelId"
:
"10000"
,
// 渠道id
"thirdPartyCustomerId"
:
da
.
busi_id
,
// 第三方客户id
"productId"
:
"5e6b02cc3290c3000a3a63dc"
,
// 云服产品id (测试环境)
"allotRatio"
:
"50"
,
// 分润比例(百分比的数字部分(如:50代表50%))
"orderPrice"
:
da
.
amt
,
// 订单金额
"productQuantity"
:
"1"
,
// 产品数量
"companyName"
:
da
.
ecompanyName
,
// 公司名称
"phone"
:
"13722223333"
};
var
str
=
{
"data_id"
:
da
.
id
,
// 发薪批次id tbl_order.id 或者 c_esettle_offline.id
"channel_id"
:
chnanel
.
channel_id
,
//渠道id
"channel_merchant_id"
:
da
.
busi_id
,
//渠道商户id
"origin_merchant_id"
:
chnanel
.
origin_merchant_id
,
//来源商户id
"pushplatform_channel_id"
:
chnanel
.
platform_id
,
//对方渠道id
};
resultData
.
param
=
system
.
encryption
(
JSON
.
stringify
(
str
));
return
resultData
;
}
trim
(
o
)
{
if
(
!
o
)
{
return
""
;
}
return
o
.
toString
().
trim
();
}
}
module
.
exports
=
ChannelApi2
;
bpo-admin/app/base/api/impl/testApi.js
View file @
a6d53585
...
...
@@ -15,7 +15,7 @@ class TestApi {
async
testaes
(
obj
)
{
let
str
=
'{"channel_id": "11111", "platform_channel_id": "1asdqqwdwqdwqdwqddqdwq", "channel_merchant_id": "
211111", "origin_merchant_id": "11112312wqdwqdwqwqd", "data_id": "11221321321dwwqwqdwq1
"}'
;
let
str
=
'{"channel_id": "11111", "platform_channel_id": "1asdqqwdwqdwqdwqddqdwq", "channel_merchant_id": "
9", "origin_merchant_id": "xxxx", "data_id": "1209403539471060994
"}'
;
console
.
log
(
`字符串:
${
str
}
`
);
let
encry
=
System
.
encryption
(
str
);
...
...
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