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
080d2196
Commit
080d2196
authored
Dec 09, 2019
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
c01fa032
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
183 additions
and
26 deletions
+183
-26
igirl-channel/app/base/api/impl/action/tmOrder.js
+11
-2
igirl-channel/app/base/db/impl/dbapp/appproductDao.js
+8
-3
igirl-channel/app/base/db/models/dbapp/appproduct.js
+3
-2
igirl-channel/app/base/db/models/dborder/order.js
+1
-0
igirl-channel/app/base/db/models/dborder/ordertmproduct.js
+1
-0
igirl-channel/app/base/service/impl/dborder/orderSve.js
+146
-11
igirl-channel/app/base/service/impl/dborder/ordertmproductSve.js
+1
-0
igirl-channel/app/base/system.js
+10
-6
igirl-channel/app/base/utils/aliyunClient.js
+2
-2
No files found.
igirl-channel/app/base/api/impl/action/tmOrder.js
View file @
080d2196
...
@@ -52,13 +52,22 @@ class TmOrderAPI extends APIBase {
...
@@ -52,13 +52,22 @@ class TmOrderAPI extends APIBase {
var
opResult
=
null
;
var
opResult
=
null
;
if
([
"subTmOrder"
,
"getTmOrderList"
,
"getTmOrderInfo"
,
"getTmApplyInfo"
,
"getTmNclList"
,
"getNeedInfo"
,
if
([
"subTmOrder"
,
"getTmOrderList"
,
"getTmOrderInfo"
,
"getTmApplyInfo"
,
"getTmNclList"
,
"getNeedInfo"
,
"tmConfirm"
,
"updateTmInfo"
,
"updateNclInfo"
,
"updateContacts"
,
"updateCustomerInfo"
,
"tmConfirm"
,
"updateTmInfo"
,
"updateNclInfo"
,
"updateContacts"
,
"updateCustomerInfo"
,
"updateCustomerInfo"
].
indexOf
(
action_type
)
>=
0
)
{
"updateCustomerInfo"
,
"addOrderAndDelivery"
].
indexOf
(
action_type
)
>=
0
)
{
if
(
!
action_body
.
channelUserId
)
{
if
(
!
action_body
.
channelUserId
)
{
return
system
.
getResult
(
null
,
"verify channelUserId is not empty"
);
return
system
.
getResult
(
null
,
"verify channelUserId is not empty"
);
}
}
}
}
switch
(
action_type
)
{
switch
(
action_type
)
{
// sy
// sy
case
"updateOrderStatus"
:
//更新订单状态
opResult
=
await
this
.
orderSve
.
updateOrderStatus
(
action_body
,
req
);
break
;
case
"updateOrderPayStatus"
:
//更新订单付款状态
opResult
=
await
this
.
orderSve
.
updateOrderStatus
(
action_body
,
req
);
break
;
case
"addOrderAndDelivery"
:
//创建订单和交付单
opResult
=
await
this
.
orderSve
.
addOrderAndDelivery
(
action_body
,
pobj
,
req
);
break
;
case
"clearAllCache"
:
case
"clearAllCache"
:
await
this
.
cacheManager
[
"MagCache"
].
clearAll
();
await
this
.
cacheManager
[
"MagCache"
].
clearAll
();
opResult
=
system
.
getResultSuccess
(
null
,
"清理缓存成功"
);
opResult
=
system
.
getResultSuccess
(
null
,
"清理缓存成功"
);
...
@@ -186,7 +195,7 @@ class TmOrderAPI extends APIBase {
...
@@ -186,7 +195,7 @@ class TmOrderAPI extends APIBase {
}
}
break
;
break
;
case
"pushFqBusiness"
:
//推送商机到峰擎
case
"pushFqBusiness"
:
//推送商机到峰擎
opResult
=
await
this
.
orderSve
.
pushFqBusiness
(
action_body
,
pobj
,
req
);
opResult
=
await
this
.
orderSve
.
push
1688
FqBusiness
(
action_body
,
pobj
,
req
);
break
;
break
;
case
"getProductDetail"
:
//根据渠道产品码获取产品详情
case
"getProductDetail"
:
//根据渠道产品码获取产品详情
opResult
=
await
this
.
appProductSve
.
findByChannelItemCode
(
action_body
);
opResult
=
await
this
.
appProductSve
.
findByChannelItemCode
(
action_body
);
...
...
igirl-channel/app/base/db/impl/dbapp/appproductDao.js
View file @
080d2196
...
@@ -16,7 +16,9 @@ class AppProductDao extends Dao {
...
@@ -16,7 +16,9 @@ class AppProductDao extends Dao {
"itemName"
,
// 产品名称
"itemName"
,
// 产品名称
"picUrl"
,
// 产品图片地址
"picUrl"
,
// 产品图片地址
"channelItemCode"
,
// 渠道产品编码
"channelItemCode"
,
// 渠道产品编码
"channelItemName"
,
// 渠道产品名称
"channelItemName"
,
// 渠道产品名称
"serviceItemCode"
,
"pushServiceItemCode"
,
"status"
,
// 状态 0禁用 1启用
"status"
,
// 状态 0禁用 1启用
"verifyPrice"
,
// 是否验证价格 0不验证 1验证
"verifyPrice"
,
// 是否验证价格 0不验证 1验证
"proPrice"
,
// 产品价格
"proPrice"
,
// 产品价格
...
@@ -43,7 +45,9 @@ class AppProductDao extends Dao {
...
@@ -43,7 +45,9 @@ class AppProductDao extends Dao {
"itemName"
,
// 产品名称
"itemName"
,
// 产品名称
"picUrl"
,
// 产品图片地址
"picUrl"
,
// 产品图片地址
"channelItemCode"
,
// 渠道产品编码
"channelItemCode"
,
// 渠道产品编码
"channelItemName"
,
// 渠道产品名称
"channelItemName"
,
// 渠道产品名称
"serviceItemCode"
,
"pushServiceItemCode"
,
"status"
,
// 状态 0禁用 1启用
"status"
,
// 状态 0禁用 1启用
"verifyPrice"
,
// 是否验证价格 0不验证 1验证
"verifyPrice"
,
// 是否验证价格 0不验证 1验证
"proPrice"
,
// 产品价格
"proPrice"
,
// 产品价格
...
@@ -71,7 +75,8 @@ class AppProductDao extends Dao {
...
@@ -71,7 +75,8 @@ class AppProductDao extends Dao {
"picUrl"
,
// 产品图片地址
"picUrl"
,
// 产品图片地址
"channelItemCode"
,
// 渠道产品编码
"channelItemCode"
,
// 渠道产品编码
"channelItemName"
,
// 渠道产品名称
"channelItemName"
,
// 渠道产品名称
"serviceItemCode"
,
"serviceItemCode"
,
"pushServiceItemCode"
,
"deliveryUrl"
,
"deliveryUrl"
,
"status"
,
// 状态 0禁用 1启用
"status"
,
// 状态 0禁用 1启用
"verifyPrice"
,
// 是否验证价格 0不验证 1验证
"verifyPrice"
,
// 是否验证价格 0不验证 1验证
...
...
igirl-channel/app/base/db/models/dbapp/appproduct.js
View file @
080d2196
...
@@ -3,13 +3,14 @@ const settings = require("../../../../config/settings");
...
@@ -3,13 +3,14 @@ const settings = require("../../../../config/settings");
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"appproduct"
,
{
return
db
.
define
(
"appproduct"
,
{
app_id
:
DataTypes
.
STRING
(
50
),
// 应用id
app_id
:
DataTypes
.
STRING
(
50
),
// 应用id
itemCode
:
DataTypes
.
STRING
(
100
),
// 产品编码
itemCode
:
DataTypes
.
STRING
(
100
),
// 产品编码
itemName
:
DataTypes
.
STRING
(
100
),
// 产品名称
itemName
:
DataTypes
.
STRING
(
100
),
// 产品名称
picUrl
:
DataTypes
.
STRING
(
500
),
// 产品图片地址
picUrl
:
DataTypes
.
STRING
(
500
),
// 产品图片地址
channelItemCode
:
DataTypes
.
STRING
(
100
),
// 渠道产品编码
channelItemCode
:
DataTypes
.
STRING
(
100
),
// 渠道产品编码
channelItemName
:
DataTypes
.
STRING
(
100
),
// 渠道产品名称
channelItemName
:
DataTypes
.
STRING
(
100
),
// 渠道产品名称
serviceItemCode
:
DataTypes
.
STRING
(
100
),
// 服务商产品编码
serviceItemCode
:
DataTypes
.
STRING
(
100
),
// 服务商产品编码
pushServiceItemCode
:
DataTypes
.
STRING
(
100
),
// 推送到服务商的产品编码
status
:
DataTypes
.
BOOLEAN
,
// 状态 0禁用 1启用
status
:
DataTypes
.
BOOLEAN
,
// 状态 0禁用 1启用
verifyPrice
:
DataTypes
.
BOOLEAN
,
// 是否验证价格 0不验证 1验证
verifyPrice
:
DataTypes
.
BOOLEAN
,
// 是否验证价格 0不验证 1验证
proPrice
:
DataTypes
.
DOUBLE
,
// 产品价格
proPrice
:
DataTypes
.
DOUBLE
,
// 产品价格
...
...
igirl-channel/app/base/db/models/dborder/order.js
View file @
080d2196
...
@@ -55,6 +55,7 @@ module.exports = (db, DataTypes) => {
...
@@ -55,6 +55,7 @@ module.exports = (db, DataTypes) => {
invoiceApplyStatus
:
DataTypes
.
STRING
(
10
),
// 发票状态:00: 未申请, 10: 已申请,20:已开票
invoiceApplyStatus
:
DataTypes
.
STRING
(
10
),
// 发票状态:00: 未申请, 10: 已申请,20:已开票
channelUserId
:
DataTypes
.
STRING
(
64
),
// 渠道用户ID
channelUserId
:
DataTypes
.
STRING
(
64
),
// 渠道用户ID
needNo
:
DataTypes
.
STRING
(
64
),
// 需求单号
needNo
:
DataTypes
.
STRING
(
64
),
// 需求单号
needNoOrderNo
:
DataTypes
.
STRING
(
64
),
// 需求订单号
sourceType
:
DataTypes
.
STRING
(
10
),
//来源类型:00订单,10需求需要用户确认方案
sourceType
:
DataTypes
.
STRING
(
10
),
//来源类型:00订单,10需求需要用户确认方案
picUrl
:
DataTypes
.
STRING
(
500
),
// 产品图片地址
picUrl
:
DataTypes
.
STRING
(
500
),
// 产品图片地址
productType_id
:
DataTypes
.
INTEGER
,
//产品类型Id
productType_id
:
DataTypes
.
INTEGER
,
//产品类型Id
...
...
igirl-channel/app/base/db/models/dborder/ordertmproduct.js
View file @
080d2196
...
@@ -50,6 +50,7 @@ module.exports = (db, DataTypes) => {
...
@@ -50,6 +50,7 @@ module.exports = (db, DataTypes) => {
channelServiceNo
:
DataTypes
.
STRING
(
64
),
//渠道服务单号
channelServiceNo
:
DataTypes
.
STRING
(
64
),
//渠道服务单号
channelOrderNo
:
DataTypes
.
STRING
(
1024
),
//渠道订单号列表,多个以,隔开
channelOrderNo
:
DataTypes
.
STRING
(
1024
),
//渠道订单号列表,多个以,隔开
needNo
:
DataTypes
.
STRING
(
64
),
//需求单号
needNo
:
DataTypes
.
STRING
(
64
),
//需求单号
needNoOrderNo
:
DataTypes
.
STRING
(
64
),
// 需求订单号
sourceType
:
DataTypes
.
STRING
(
10
),
//来源类型:00订单,10需求需要用户确认方案
sourceType
:
DataTypes
.
STRING
(
10
),
//来源类型:00订单,10需求需要用户确认方案
picUrl
:
DataTypes
.
STRING
(
500
),
//商标图样
picUrl
:
DataTypes
.
STRING
(
500
),
//商标图样
colorizedPicUrl
:
DataTypes
.
STRING
(
500
),
//商标彩色图样
colorizedPicUrl
:
DataTypes
.
STRING
(
500
),
//商标彩色图样
...
...
igirl-channel/app/base/service/impl/dborder/orderSve.js
View file @
080d2196
...
@@ -9,8 +9,128 @@ class OrderService extends ServiceBase {
...
@@ -9,8 +9,128 @@ class OrderService extends ServiceBase {
this
.
appproductDao
=
system
.
getObject
(
"db.dbapp.appproductDao"
);
this
.
appproductDao
=
system
.
getObject
(
"db.dbapp.appproductDao"
);
this
.
ordertmproductDao
=
system
.
getObject
(
"db.dborder.ordertmproductDao"
);
this
.
ordertmproductDao
=
system
.
getObject
(
"db.dborder.ordertmproductDao"
);
this
.
receiptvoucherDao
=
system
.
getObject
(
"db.dborder.receiptvoucherDao"
);
this
.
receiptvoucherDao
=
system
.
getObject
(
"db.dborder.receiptvoucherDao"
);
this
.
customercontactsDao
=
system
.
getObject
(
"db.dborder.customercontactsDao"
);
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
}
}
async
addOrderAndDelivery
(
action_body
,
pobj
,
req
)
{
if
(
!
action_body
.
needNo
)
{
return
system
.
getResult
(
null
,
"needNo is not empty"
);
}
if
(
!
action_body
.
channelItemCode
)
{
return
system
.
getResult
(
null
,
"channelItemCode is not empty"
);
}
var
productItem
=
await
this
.
appproductDao
.
findOneByChannelItemCode
(
action_body
.
channelItemCode
,
req
.
app
.
id
);
//获取产品
if
(
!
productItem
)
{
return
;
}
var
orderCount
=
await
this
.
dao
.
findCount
({
where
:
{
needNo
:
action_body
.
needNo
}
});
if
(
orderCount
>
0
)
{
return
system
.
getResultFail
(
system
.
existData
,
"order is exist"
);
}
var
self
=
this
;
return
await
self
.
db
.
transaction
(
async
function
(
t
)
{
//创建订单
var
ordercode
=
await
self
.
getBusUid
(
"tm"
);
var
orderParams
=
{
app_id
:
req
.
app
.
id
,
//
orderNo
:
ordercode
,
// 订单号
payTime
:
new
Date
(),
//
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
:
productItem
.
proPrice
||
0
,
// 订单总额(产品价格×优惠费率×订单件数)
refundSum
:
0
,
// 退款金额
buyerMoblie
:
action_body
.
buyerMoblie
||
""
,
// 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
:
action_body
.
needNo
||
null
,
//需求单号
needNoOrderNo
:
action_body
.
needNoOrderNo
||
null
,
//需求单号
picUrl
:
productItem
.
picUrl
,
//
productType_id
:
productItem
.
productType_id
,
//产品类型Id
productOneType_id
:
productItem
.
productOneType_id
,
//产品大类Id
serviceItemSnapshot
:
JSON
.
stringify
(
productItem
),
//产品快照
};
var
orderItem
=
await
self
.
dao
.
create
(
orderParams
,
t
);
//创建订单
var
receiptvoucherItem
=
await
self
.
receiptvoucherDao
.
addReceiptvoucher
(
orderParams
,
req
,
t
);
//创建订单支付信息
var
pushType
=
"ic_"
;
if
([
"fzsbzc"
,
"dbsbzc"
].
indexOf
(
productItem
.
itemCode
)
>=
0
)
{
var
tmDeliveryOrderNo
=
await
self
.
getBusUid
(
"jf"
)
var
orderProductObj
=
{
app_id
:
req
.
app
.
id
,
//
productType_id
:
productItem
.
productType_id
,
//产品类型Id
productOneType_id
:
productItem
.
productOneType_id
,
//产品大类Id
itemCode
:
productItem
.
itemCode
,
//
itemName
:
productItem
.
itemName
,
//
orderServicePayStatus
:
"yfk"
,
//支付状态:dfk: 待付款, yfk: 已支付
appDataOpType
:
req
.
app
.
appDataOpType
,
// 应用数据操作类型:00独立,10全委托,20部分委托
sourceOrderNo
:
ordercode
,
//来源单号
deliveryOrderNo
:
tmDeliveryOrderNo
,
needNo
:
action_body
.
needNo
||
null
,
//需求单号
needNoOrderNo
:
action_body
.
needNoOrderNo
||
null
,
//需求单号
sourceType
:
"00"
,
channelUserId
:
req
.
user
.
channelUserId
||
""
,
// 渠道用户id
createuser_id
:
req
.
user
.
id
,
//
createuser
:
req
.
user
.
nickname
,
//
};
var
orderTm
=
await
self
.
ordertmproductDao
.
create
(
orderProductObj
,
t
);
//创建订单交付流程
pushType
=
"tm_"
;
}
//创建服务单
//推送商机到峰擎
if
(
productItem
.
pushServiceItemCode
&&
orderParams
.
buyerMoblie
)
{
self
.
pushFqBusiness
(
pushType
,
orderParams
,
productItem
.
pushServiceItemCode
,
pobj
,
req
);
}
else
{
self
.
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/addOrderAndDelivery"
,
content
:
"pushServiceItemCode="
+
productItem
.
pushServiceItemCode
+
",buyerMoblie="
+
item
.
buyerMoblie
,
clientIp
:
pobj
.
clientIp
,
optitle
:
"未能推送订单商机到FQ信息,pushServiceItemCode 或 buyerMoblie 为空"
,
});
}
return
system
.
getResultSuccess
({
deliveryOrderNo
:
orderProductObj
.
deliveryOrderNo
,
needNo
:
action_body
.
needNo
});
});
}
//更新订单状态
async
updateOrderStatus
(
action_body
,
pobj
,
req
)
{
var
setObj
=
{};
if
(
pobj
.
actionProcess
==
"jd"
)
{
setObj
.
needNo
=
pobj
.
needNo
;
setObj
.
needNoOrderNo
=
pobj
.
needNoOrderNo
;
}
await
this
.
dao
.
updateByWhere
(
setObj
,
{
where
:
{
orderNo
:
action_body
.
orderNo
}
});
return
system
.
getResultSuccess
();
}
//更新付款状态
async
updateOrderPayStatus
(
action_body
,
pobj
,
req
)
{
return
await
self
.
db
.
transaction
(
async
function
(
t
)
{
await
this
.
dao
.
updateByWhere
({
orderPayStatus
:
"yfk"
,
buyerMoblie
:
action_body
.
buyerMoblie
},
{
where
:
{
needNoOrderNo
:
action_body
.
needNoOrderNo
,
app_id
:
req
.
app
.
id
}
},
t
);
await
this
.
ordertmproductDao
.
updateByWhere
({
payStatus
:
"yfk"
},
{
where
:
{
needNoOrderNo
:
action_body
.
needNoOrderNo
,
app_id
:
req
.
app
.
id
}
},
t
);
return
system
.
getResultSuccess
();
});
}
async
op1688ChannelPushOrder
(
action_body
,
pobj
,
req
)
{
async
op1688ChannelPushOrder
(
action_body
,
pobj
,
req
)
{
try
{
try
{
//var reqUrl = "https://inte-mcp.chanjet.com/gsb/getOrder?token=" + action_body.token; //测试环境
//var reqUrl = "https://inte-mcp.chanjet.com/gsb/getOrder?token=" + action_body.token; //测试环境
...
@@ -387,7 +507,6 @@ class OrderService extends ServiceBase {
...
@@ -387,7 +507,6 @@ class OrderService extends ServiceBase {
}
}
}
}
async
addOrderNeed
(
action_body
,
req
,
returnValue
)
{
async
addOrderNeed
(
action_body
,
req
,
returnValue
)
{
var
addOrderList
=
[];
var
productItem
=
await
this
.
appproductDao
.
findOneByChannelItemCode
(
action_body
.
channelItemCode
,
req
.
app
.
id
);
//获取产品
var
productItem
=
await
this
.
appproductDao
.
findOneByChannelItemCode
(
action_body
.
channelItemCode
,
req
.
app
.
id
);
//获取产品
if
(
!
productItem
)
{
if
(
!
productItem
)
{
return
;
return
;
...
@@ -474,9 +593,7 @@ class OrderService extends ServiceBase {
...
@@ -474,9 +593,7 @@ class OrderService extends ServiceBase {
}
}
}
}
}
}
async
push1688FqBusiness
(
action_body
,
pobj
,
req
)
{
async
pushFqBusiness
(
action_body
,
pobj
,
req
)
{
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
item
=
await
this
.
dao
.
getItemByChannelServiceNo
(
action_body
.
channelServiceNo
,
req
.
app
.
id
);
var
item
=
await
this
.
dao
.
getItemByChannelServiceNo
(
action_body
.
channelServiceNo
,
req
.
app
.
id
);
if
(
!
item
)
{
if
(
!
item
)
{
return
system
.
getResult
(
null
,
"没有找到相关订单信息"
);
return
system
.
getResult
(
null
,
"没有找到相关订单信息"
);
...
@@ -487,19 +604,39 @@ class OrderService extends ServiceBase {
...
@@ -487,19 +604,39 @@ class OrderService extends ServiceBase {
if
(
item
.
buyerMoblie
)
{
if
(
item
.
buyerMoblie
)
{
return
system
.
getResult
(
null
,
"订单已经推送过,请勿重覆推送"
);
return
system
.
getResult
(
null
,
"订单已经推送过,请勿重覆推送"
);
}
}
item
.
buyerMoblie
=
action_body
.
buyerMoblie
;
var
result
=
await
this
.
pushFqBusiness
(
"tm_"
,
item
,
"5dd513db4f3b08000a6fc082"
,
pobj
,
req
);
if
(
result
.
status
!=
0
)
{
return
result
;
}
await
this
.
updateByWhere
({
buyerMoblie
:
action_body
.
buyerMoblie
},
{
where
:
{
channelServiceNo
:
action_body
.
channelServiceNo
}
});
return
result
;
}
/**
*
* @param {*} pushType 推送的类型 tm_ ic_ icp_
* @param {*} item 订单信息 包含buyerMoblie
* @param {*} pushServiceItemCode 推送的产品id
* @param {*} pobj
* @param {*} req
*/
async
pushFqBusiness
(
pushType
,
item
,
pushServiceItemCode
,
pobj
,
req
)
{
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
null
;
var
rtn
=
null
;
var
reqUrl
=
"https://yunfuapi.gongsibao.com/crm/order/submit"
;
// var reqUrl = "https://yunfuapi.gongsibao.com/crm/order/submit";//线上域名
var
reqUrl
=
"https://yunfuapi-dev.gongsibao.com/crm/order/submit"
;
//域名
try
{
try
{
var
body
=
{
var
body
=
{
idempotentId
:
item
.
channelService
No
,
// 是 业务 ID
idempotentId
:
item
.
need
No
,
// 是 业务 ID
idempotentSource
:
req
.
app
.
appSourceCode
?
"tm_"
+
req
.
app
.
appSourceCode
:
"tm_1688"
,
// 是 业务来源(ali、jd)
idempotentSource
:
req
.
app
.
appSourceCode
?
pushType
+
req
.
app
.
appSourceCode
:
"tm_1688"
,
// 是 业务来源(ali、jd)
idempotentSourceName
:
req
.
app
.
name
||
"1688应用"
,
// 是 阿里,京东
idempotentSourceName
:
req
.
app
.
name
||
"1688应用"
,
// 是 阿里,京东
city
:
""
,
// 否 所属城市
city
:
""
,
// 否 所属城市
phone
:
action_body
.
buyerMoblie
,
// 是 手机号
phone
:
item
.
buyerMoblie
,
// 是 手机号
userId
:
item
.
channelUserId
,
// 否 用户 ID
userId
:
item
.
channelUserId
,
// 否 用户 ID
companyName
:
""
,
// 否 公司名称
companyName
:
""
,
// 否 公司名称
orderPrice
:
item
.
totalSum
,
// 是 订单金额
orderPrice
:
item
.
totalSum
,
// 是 订单金额
productId
:
"5dd513db4f3b08000a6fc082"
,
// 是 产品 ID
productId
:
pushServiceItemCode
,
// 是 产品 ID
productQuantity
:
item
.
salesNum
,
// 是 产品数量
productQuantity
:
item
.
salesNum
,
// 是 产品数量
};
};
rtn
=
await
rc
.
post
(
reqUrl
,
body
);
rtn
=
await
rc
.
post
(
reqUrl
,
body
);
...
@@ -512,11 +649,9 @@ class OrderService extends ServiceBase {
...
@@ -512,11 +649,9 @@ class OrderService extends ServiceBase {
clientIp
:
pobj
.
clientIp
,
clientIp
:
pobj
.
clientIp
,
optitle
:
"推送订单商机到FQ信息"
,
optitle
:
"推送订单商机到FQ信息"
,
});
});
if
(
rtn
.
code
!=
200
&&
rtn
.
success
!=
true
)
{
if
(
rtn
.
code
!=
200
&&
rtn
.
success
!=
true
)
{
return
system
.
getResult
(
null
,
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
req
.
requestId
+
",requestId="
+
rtn
.
requestId
);
return
system
.
getResult
(
null
,
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
req
.
requestId
+
",requestId="
+
rtn
.
requestId
);
}
}
await
this
.
updateByWhere
({
buyerMoblie
:
action_body
.
buyerMoblie
},
{
where
:
{
channelServiceNo
:
action_body
.
channelServiceNo
}
});
return
system
.
getResultSuccess
(
null
,
"推送成功"
);
return
system
.
getResultSuccess
(
null
,
"推送成功"
);
}
catch
(
e
)
{
}
catch
(
e
)
{
//日志记录
//日志记录
...
...
igirl-channel/app/base/service/impl/dborder/ordertmproductSve.js
View file @
080d2196
...
@@ -210,6 +210,7 @@ class OrderTmProductService extends ServiceBase {
...
@@ -210,6 +210,7 @@ class OrderTmProductService extends ServiceBase {
var
orderAmount
=
tm
;
var
orderAmount
=
tm
;
orderAmount
.
salesNum
=
tm
.
nclOneCodes
.
length
;
orderAmount
.
salesNum
=
tm
.
nclOneCodes
.
length
;
orderAmount
.
minitermNum
=
tm
.
nclCount
;
orderAmount
.
minitermNum
=
tm
.
nclCount
;
channelOrder
.
payStatus
=
"dfk"
;
var
orderResult
=
await
self
.
orderDao
.
addOrder
(
ordercode
,
orderType
,
user
,
app
,
productItem
,
channelOrder
,
channelUser
,
apply
,
orderAmount
,
t
);
var
orderResult
=
await
self
.
orderDao
.
addOrder
(
ordercode
,
orderType
,
user
,
app
,
productItem
,
channelOrder
,
channelUser
,
apply
,
orderAmount
,
t
);
if
(
orderResult
.
status
!=
0
)
{
if
(
orderResult
.
status
!=
0
)
{
return
orderResult
;
return
orderResult
;
...
...
igirl-channel/app/base/system.js
View file @
080d2196
...
@@ -141,11 +141,11 @@ class System {
...
@@ -141,11 +141,11 @@ class System {
var
bucketlist
=
notice_count
.
buckets
;
var
bucketlist
=
notice_count
.
buckets
;
var
bucklist
=
[];
var
bucklist
=
[];
bucketlist
.
forEach
(
function
(
d
)
{
bucketlist
.
forEach
(
function
(
d
)
{
var
notice_issue
=
d
.
key
;
var
notice_issue
=
d
.
key
;
var
date
=
d
.
date_max
.
value
;
var
date
=
d
.
date_max
.
value
;
var
data
=
{
var
data
=
{
notice_issue
:
notice_issue
,
notice_issue
:
notice_issue
,
date
:
date
date
:
date
}
}
bucklist
.
push
(
data
);
bucklist
.
push
(
data
);
})
})
...
@@ -200,7 +200,7 @@ class System {
...
@@ -200,7 +200,7 @@ class System {
var
objabspath
=
classpath
+
"/"
+
filename
+
".js"
;
var
objabspath
=
classpath
+
"/"
+
filename
+
".js"
;
if
(
System
.
objTable
[
objabspath
]
!=
null
)
{
if
(
System
.
objTable
[
objabspath
]
!=
null
)
{
console
.
log
(
objabspath
,
"get cached obj...."
);
console
.
log
(
objabspath
,
"get cached obj...."
);
return
System
.
objTable
[
objabspath
];
return
System
.
objTable
[
objabspath
];
}
else
{
}
else
{
console
.
log
(
"no cached..."
);
console
.
log
(
"no cached..."
);
...
@@ -309,4 +309,7 @@ System.signFail = 1300;
...
@@ -309,4 +309,7 @@ System.signFail = 1300;
//获取访问token失败
//获取访问token失败
System
.
getAppInfoFail
=
1130
;
System
.
getAppInfoFail
=
1130
;
//已经存在信息
System
.
existData
=
1400
;
module
.
exports
=
System
;
module
.
exports
=
System
;
\ No newline at end of file
igirl-channel/app/base/utils/aliyunClient.js
View file @
080d2196
...
@@ -2,8 +2,8 @@ const Client = require('aliyun-api-gateway').Client;
...
@@ -2,8 +2,8 @@ const Client = require('aliyun-api-gateway').Client;
var
RPCClient
=
require
(
'@alicloud/pop-core'
).
RPCClient
;
var
RPCClient
=
require
(
'@alicloud/pop-core'
).
RPCClient
;
//
const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');
const
client
=
new
Client
(
'203756805'
,
'crkyej0xlmqa6bmvqijun6ltxparllyn'
);
const
client
=
new
Client
(
'203763771'
,
'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu'
);
// const client = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上
class
aliyunClient
{
class
aliyunClient
{
constructor
()
{
constructor
()
{
// this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
// this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
...
...
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