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
de69d1d7
Commit
de69d1d7
authored
Jul 21, 2020
by
王栋源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wdy
parent
5ce3ae83
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
330 additions
and
288 deletions
+330
-288
brg-user-center/app/base/api/impl/action/need.js
+1
-0
brg-user-center/app/base/api/impl/action/order.js
+4
-0
brg-user-center/app/base/db/impl/order/orderDeliveryDao.js
+12
-0
brg-user-center/app/base/service/impl/common/txPushLogSve.js
+11
-11
brg-user-center/app/base/service/impl/need/needSolutionSve.js
+114
-41
brg-user-center/app/base/service/impl/order/orderDeliverySve.js
+145
-233
brg-user-center/app/base/service/impl/order/orderInfoSve.js
+6
-3
brg-user-center/app/base/service/impl/utilsSve/utilsMsgSendSve.js
+37
-0
No files found.
brg-user-center/app/base/api/impl/action/need.js
View file @
de69d1d7
...
...
@@ -41,6 +41,7 @@ class Need extends APIBase {
opResult
=
system
.
getResult
(
null
,
"验证码错误"
);
return
opResult
;
}
await
self
.
utilsMsgSendSve
.
removeVerificationCode
(
pobj
.
actionBody
.
ContactsMobile
);
}
switch
(
action_type
)
{
case
"test"
:
//测试
...
...
brg-user-center/app/base/api/impl/action/order.js
View file @
de69d1d7
...
...
@@ -47,6 +47,7 @@ class Order extends APIBase {
opResult
=
system
.
getResult
(
null
,
"验证码错误"
);
return
opResult
;
}
await
self
.
utilsMsgSendSve
.
removeVerificationCode
(
pobj
.
actionBody
.
Info
[
0
].
formInfo
.
contactsPhone
);
}
}
switch
(
action_type
)
{
...
...
@@ -91,6 +92,9 @@ class Order extends APIBase {
break
;
case
"refundOrder"
:
//退款接口
opResult
=
await
this
.
orderinfoSve
.
refundOrder
(
pobj
.
actionBody
,
req
);
if
(
opResult
.
status
>
0
){
await
self
.
orderDeliverySve
.
sendNotification
(
pobj
.
actionBody
.
orderNum
,
320
);
}
break
;
case
"jftime"
:
//计费时间修改
opResult
=
await
this
.
orderinfoSve
.
jftime
(
pobj
.
actionBody
,
req
);
...
...
brg-user-center/app/base/db/impl/order/orderDeliveryDao.js
View file @
de69d1d7
...
...
@@ -93,6 +93,18 @@ class OrderDeliveryDao extends Dao{
var
list
=
await
this
.
customQuery
(
sql
,
params
);
return
list
;
}
/**
* 通过订单号获取资质证照信息
*/
async
getQcInfoByMainOrderNum
(
mainOrderNum
){
var
params
=
{
mainOrderNum
:
mainOrderNum
};
var
sql
=
"select deliver_content from v_order_oproduct_odelivery where tx_orders_num = :mainOrderNum "
+
"and deliver_content is not null and (product_type='/qcfw/icp/' or product_type='/qcfw/edi/' ) order by updated_at desc limit 1"
;
var
list
=
await
this
.
customQuery
(
sql
,
params
);
return
list
;
}
/**
* 获取订单交付信息
*/
...
...
brg-user-center/app/base/service/impl/common/txPushLogSve.js
View file @
de69d1d7
...
...
@@ -31,9 +31,9 @@ class TxPushLogService extends ServiceBase {
try
{
var
loginfo
=
await
this
.
findOne
({
deal_name
:
pobj
.
interface
.
para
.
dealName
,
push_action_type
:
"orderPayNotify"
});
if
(
loginfo
)
{
return
self
.
returnTX
(
1
,
"cgateway"
,
"ok"
,
{
"flowId"
:
loginfo
.
flow_id
,
"resourceIds"
:
[
pobj
.
interface
.
para
.
dealName
]
})
return
self
.
returnTX
(
0
,
"cgateway"
,
"ok"
,
{
"flowId"
:
loginfo
.
flow_id
,
"resourceIds"
:
[
pobj
.
interface
.
para
.
dealName
]
})
}
var
flow_id
=
await
this
.
getBusUid
(
"f"
);
var
flow_id
=
await
Date
.
now
(
);
var
newobj
=
{
flow_id
:
flow_id
,
deal_name
:
pobj
.
interface
.
para
.
dealName
,
...
...
@@ -60,7 +60,7 @@ class TxPushLogService extends ServiceBase {
};
var
a
=
await
this
.
execPostByTimeOut
(
req
,
pushobj
,
settings
.
opPushUrl
());
return
self
.
returnTX
(
1
,
"cgateway"
,
"ok"
,
{
"flowId"
:
creatlog
.
flow_id
,
"resourceIds"
:
[
pobj
.
interface
.
para
.
dealName
]
})
return
self
.
returnTX
(
0
,
"cgateway"
,
"ok"
,
{
"flowId"
:
creatlog
.
flow_id
,
"resourceIds"
:
[
pobj
.
interface
.
para
.
dealName
]
})
}
catch
(
e
)
{
this
.
execClient
.
execLogs
(
"txPushLogSve.js/createCbsInstance方法出现异常"
,
{
params
:
orderNum
},
"txPushLogSve_createCbsInstance_error"
,
null
,
e
.
stack
);
return
this
.
returnTX
(
-
1
,
"cgateway"
,
"请求失败"
,
null
)
...
...
@@ -78,7 +78,7 @@ class TxPushLogService extends ServiceBase {
if
(
!
loginfo
)
{
return
self
.
returnTX
(
-
1
,
"cgateway"
,
"产品不存在"
,
null
)
}
var
orderInfo
=
await
this
.
orderInfoDao
.
findOne
({
order_num
:
loginfo
.
dataValues
.
deal
N
ame
});
var
orderInfo
=
await
this
.
orderInfoDao
.
findOne
({
order_num
:
loginfo
.
dataValues
.
deal
_n
ame
});
if
(
!
orderInfo
)
{
return
self
.
returnTX
(
-
1
,
"cgateway"
,
"资源不存在"
,
null
)
}
...
...
@@ -86,7 +86,7 @@ class TxPushLogService extends ServiceBase {
if
(
orderInfo
.
status
==
320
)
{
status
=
3
;
}
return
self
.
returnTX
(
1
,
"cgateway"
,
"ok"
,
{
"status"
:
status
})
return
self
.
returnTX
(
0
,
"cgateway"
,
"ok"
,
{
"status"
:
status
})
}
...
...
@@ -119,7 +119,7 @@ class TxPushLogService extends ServiceBase {
}
resources
.
push
(
resource
);
}
return
self
.
returnTX
(
1
,
"cgateway"
,
"ok"
,
{
"resources"
:
resources
})
return
self
.
returnTX
(
0
,
"cgateway"
,
"ok"
,
{
"resources"
:
resources
})
}
//用户所有资源拉取
...
...
@@ -159,7 +159,7 @@ class TxPushLogService extends ServiceBase {
}
resources
.
push
(
resource
);
}
return
self
.
returnTX
(
1
,
"cgateway"
,
"ok"
,
{
"total"
:
orderProduct
.
count
,
"resources"
:
resources
})
return
self
.
returnTX
(
0
,
"cgateway"
,
"ok"
,
{
"total"
:
orderProduct
.
count
,
"resources"
:
resources
})
}
//隔离资源
...
...
@@ -173,13 +173,13 @@ class TxPushLogService extends ServiceBase {
return
self
.
returnTX
(
-
1
,
"mall_logic"
,
"资源不存在"
,
null
)
}
if
(
orderProduct
.
dataValues
.
status
==
2
)
{
return
self
.
returnTX
(
1
,
"mall_logic"
,
"ok"
,
null
)
return
self
.
returnTX
(
0
,
"mall_logic"
,
"ok"
,
null
)
}
if
(
orderProduct
.
dataValues
.
status
==
3
)
{
return
self
.
returnTX
(
-
1
,
"mall_logic"
,
"资源已销毁"
,
null
)
}
await
this
.
orderProductDao
.
update
({
id
:
orderProduct
.
dataValues
.
id
,
status
:
2
,
isolated_time
:
new
Date
()
});
return
self
.
returnTX
(
1
,
"mall_logic"
,
"ok"
,
null
)
return
self
.
returnTX
(
0
,
"mall_logic"
,
"ok"
,
null
)
}
...
...
@@ -197,7 +197,7 @@ class TxPushLogService extends ServiceBase {
return
self
.
returnTX
(
-
1
,
"mall_logic"
,
"资源未隔离"
,
null
)
}
if
(
orderProduct
.
dataValues
.
status
==
3
)
{
return
self
.
returnTX
(
1
,
"mall_logic"
,
"资源已销毁"
,
null
)
return
self
.
returnTX
(
0
,
"mall_logic"
,
"资源已销毁"
,
null
)
}
var
flow_id
=
await
this
.
getBusUid
(
"f"
);
var
newobj
=
{
...
...
@@ -214,7 +214,7 @@ class TxPushLogService extends ServiceBase {
return
self
.
returnTX
(
-
1
,
"mall_logic"
,
"请求错误"
,
null
)
}
await
this
.
orderProductDao
.
update
({
id
:
orderProduct
.
dataValues
.
id
,
status
:
3
});
return
self
.
returnTX
(
1
,
"mall_logic"
,
"ok"
,
{
flowId
:
flow_id
})
return
self
.
returnTX
(
0
,
"mall_logic"
,
"ok"
,
{
flowId
:
flow_id
})
}
...
...
brg-user-center/app/base/service/impl/need/needSolutionSve.js
View file @
de69d1d7
...
...
@@ -8,50 +8,126 @@ class NeedSolutionService extends ServiceBase {
this
.
needInfoDao
=
system
.
getObject
(
"db.need.needInfoDao"
);
this
.
utilsMsgSendSve
=
system
.
getObject
(
"service.utilsSve.utilsMsgSendSve"
);
}
/**
* 发送短信通知
* @param {*} mobile 接收人手机号
* @param {*} userId 用户id
* @param {*} consultType 产品类型
* @param {*} consultName 产品类型名称
* 发送消息通知
* @param {*} needInfo 需求信息
* @param {*} status 状态
*/
async
send
SmsNotification
(
mobile
,
userId
,
consultType
,
consultName
,
status
)
{
async
send
Notification
(
needInfo
,
status
)
{
try
{
var
nameArr
=
consultName
?
consultName
.
split
(
"/"
)
:
[];
if
(
!
needInfo
||
!
status
||
!
needInfo
.
consult_type
){
return
system
.
getResultFail
();
}
var
nameArr
=
needInfo
&&
needInfo
.
consult_type_name
?
needInfo
.
consult_type_name
.
split
(
"/"
)
:
[];
var
productName
=
null
;
if
(
nameArr
&&
nameArr
.
length
==
4
)
{
productName
=
nameArr
[
2
];
}
var
params
=
{
phoneNumber
:
mobile
,
messageBody
:
null
};
var
webinfoParams
=
{
"title"
:
null
,
"subAccount"
:
userId
,
"messageBody"
:
null
};
//站内信通知参数
var
messageBody
=
null
;
var
webinfoMessageBody
=
null
;
if
(
consultType
.
indexOf
(
"/ic/"
)
>=
0
)
{
//工商产品
messageBody
=
MsgTemplate
.
ic
.
need
[
status
]
&&
MsgTemplate
.
ic
.
need
[
status
].
sms
?
MsgTemplate
.
ic
.
need
[
status
].
sms
:
""
;
messageBody
=
messageBody
.
replace
(
/{productName}/g
,
productName
);
webinfoMessageBody
=
MsgTemplate
.
ic
.
need
[
status
]
&&
MsgTemplate
.
ic
.
need
[
status
].
webinfo
?
MsgTemplate
.
ic
.
need
[
status
].
webinfo
:
""
;
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{productName}/g
,
productName
);
webinfoParams
.
title
=
MsgTemplate
.
ic
.
need
[
status
]
&&
MsgTemplate
.
ic
.
need
[
status
].
webinfotitle
?
MsgTemplate
.
ic
.
need
[
status
].
webinfotitle
:
""
;
var
typeOne
=
null
;
if
(
needInfo
.
consult_type
.
indexOf
(
"/ic/"
)
>=
0
)
{
//工商产品
typeOne
=
"ic"
;
}
if
(
consultType
.
indexOf
(
"/qcfw/"
)
>=
0
)
{
//资质证照产品
if
(
needInfo
.
consult_type
.
indexOf
(
"/qcfw/"
)
>=
0
)
{
//资质证照产品
typeOne
=
"qcfw"
;
}
if
(
!
typeOne
||
!
productName
){
return
system
.
getResultFail
();
}
var
params
=
{};
if
(
needInfo
.
contacts_mobile
){
//短信
var
sms
=
MsgTemplate
[
typeOne
].
need
[
status
]
&&
MsgTemplate
[
typeOne
].
need
[
status
].
sms
?
MsgTemplate
[
typeOne
].
need
[
status
].
sms
:
""
;
if
(
sms
){
if
(
productName
){
sms
=
sms
.
replace
(
/{productName}/g
,
productName
);
}
if
(
needInfo
.
region_name
){
sms
=
sms
.
replace
(
/{area}/g
,
needInfo
.
region_name
);
}
if
(
needInfo
.
user_id
){
sms
=
sms
.
replace
(
/{userId}/g
,
needInfo
.
user_id
);
}
if
(
needInfo
.
user_name
){
sms
=
sms
.
replace
(
/{userName}/g
,
needInfo
.
user_name
);
}
if
(
sms
.
indexOf
(
"{"
)
<
0
&&
sms
.
indexOf
(
"}"
)
<
0
)
{
params
[
"phoneList"
]
=
[{
phoneNumber
:
needInfo
.
contacts_mobile
,
messageBody
:
sms
}];
}
}
}
if
(
needInfo
.
user_id
){
//站内信
var
webinfo
=
MsgTemplate
[
typeOne
].
need
[
status
]
&&
MsgTemplate
[
typeOne
].
need
[
status
].
webinfo
?
MsgTemplate
[
typeOne
].
need
[
status
].
webinfo
:
""
;
var
webinfotitle
=
MsgTemplate
[
typeOne
].
need
[
status
]
&&
MsgTemplate
[
typeOne
].
need
[
status
].
webinfotitle
?
MsgTemplate
[
typeOne
].
need
[
status
].
webinfotitle
:
""
;
if
(
webinfo
&&
webinfotitle
){
if
(
productName
){
webinfo
=
webinfo
.
replace
(
/{productName}/g
,
productName
);
}
if
(
needInfo
.
region_name
){
webinfo
=
webinfo
.
replace
(
/{area}/g
,
needInfo
.
region_name
);
}
if
(
needInfo
.
user_id
){
webinfo
=
webinfo
.
replace
(
/{userId}/g
,
needInfo
.
user_id
);
}
if
(
needInfo
.
user_name
){
webinfo
=
webinfo
.
replace
(
/{userName}/g
,
needInfo
.
user_name
);
}
if
(
webinfo
.
indexOf
(
"{"
)
<
0
&&
webinfo
.
indexOf
(
"}"
)
<
0
)
{
params
[
"subAccountList"
]
=
[{
title
:
webinfotitle
,
subAccount
:
needInfo
.
user_id
,
messageBody
:
webinfo
}];
}
}
}
if
(
needInfo
.
wechat_no
){
//微信
var
wechatMsg
=
MsgTemplate
[
typeOne
].
need
[
status
]
&&
MsgTemplate
[
typeOne
].
need
[
status
].
wx
?
MsgTemplate
[
typeOne
].
need
[
status
].
wx
:
""
;
var
wechattitle
=
MsgTemplate
[
typeOne
].
need
[
status
]
&&
MsgTemplate
[
typeOne
].
need
[
status
].
webinfotitle
?
MsgTemplate
[
typeOne
].
need
[
status
].
webinfotitle
:
""
;
if
(
wechatMsg
&&
wechattitle
){
if
(
productName
){
wechatMsg
=
wechatMsg
.
replace
(
/{productName}/g
,
productName
);
}
if
(
needInfo
.
region_name
){
wechatMsg
=
wechatMsg
.
replace
(
/{area}/g
,
needInfo
.
region_name
);
}
if
(
needInfo
.
solutionNum
){
wechatMsg
=
wechatMsg
.
replace
(
/{solutionNum}/g
,
needInfo
.
solutionNum
);
}
if
(
needInfo
.
user_id
){
wechatMsg
=
wechatMsg
.
replace
(
/{userId}/g
,
needInfo
.
user_id
);
}
if
(
needInfo
.
user_name
){
wechatMsg
=
wechatMsg
.
replace
(
/{userName}/g
,
needInfo
.
user_name
);
}
if
(
wechatMsg
.
indexOf
(
"{"
)
<
0
&&
wechatMsg
.
indexOf
(
"}"
)
<
0
)
{
params
[
"wechatList"
]
=
[{
title
:
wechattitle
,
wechatNumber
:
needInfo
.
wechat_no
,
messageBody
:
wechatMsg
}];
}
}
}
// console.log(messageBody,"ddddddddd");
if
(
userId
&&
webinfoParams
.
title
&&
messageBody
&&
messageBody
.
indexOf
(
"{"
)
<
0
&&
messageBody
.
indexOf
(
"}"
)
<
0
&&
webinfoMessageBody
&&
webinfoMessageBody
.
indexOf
(
"{"
)
<
0
&&
webinfoMessageBody
.
indexOf
(
"}"
)
<
0
)
{
params
.
messageBody
=
messageBody
;
webinfoParams
.
messageBody
=
webinfoMessageBody
;
// await this.utilsMsgSendSve.sendMessageByPhone(params);//发送短信
await
this
.
utilsMsgSendSve
.
sendMessageVerify
({
phoneList
:
[
params
],
subAccountList
:
[
webinfoParams
]
});
if
(
needInfo
.
email
){
//邮箱
var
emailMsg
=
MsgTemplate
[
typeOne
].
need
[
status
]
&&
MsgTemplate
[
typeOne
].
need
[
status
].
email
?
MsgTemplate
[
typeOne
].
need
[
status
].
email
:
""
;
if
(
emailMsg
){
if
(
productName
){
emailMsg
=
emailMsg
.
replace
(
/{productName}/g
,
productName
);
}
if
(
needInfo
.
region_name
){
emailMsg
=
emailMsg
.
replace
(
/{area}/g
,
needInfo
.
region_name
);
}
if
(
needInfo
.
user_id
){
emailMsg
=
emailMsg
.
replace
(
/{userId}/g
,
needInfo
.
user_id
);
}
if
(
needInfo
.
user_name
){
emailMsg
=
emailMsg
.
replace
(
/{userName}/g
,
needInfo
.
user_name
);
}
if
(
emailMsg
.
indexOf
(
"{"
)
<
0
&&
emailMsg
.
indexOf
(
"}"
)
<
0
)
{
params
[
"emailList"
]
=
[{
email
:
needInfo
.
email
,
messageBody
:
emailMsg
}];
}
}
}
return
;
await
this
.
utilsMsgSendSve
.
sendMessageVerify
(
params
);
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
this
.
execClient
.
execLogs
(
"needSolutionSve.js/send
SmsNotification(发送短信通知)方法出现异常"
,
{
mobile
:
mobile
,
consultType
:
consultType
,
consultName
:
consultName
,
status
:
status
},
"needSolutionSve_sendSms
Notification_error"
,
null
,
e
.
stack
);
return
;
this
.
execClient
.
execLogs
(
"needSolutionSve.js/send
Notification(发送短信通知)方法出现异常"
,
{
needInfo
:
needInfo
,
status
:
status
},
"needSolutionSve_send
Notification_error"
,
null
,
e
.
stack
);
return
system
.
getResultFail
()
;
}
}
//服务商提交/修改方案
async
submitSolution
(
pobj
)
{
...
...
@@ -101,7 +177,8 @@ class NeedSolutionService extends ServiceBase {
await
self
.
dao
.
update
(
updateObj
,
t
);
await
self
.
needInfoDao
.
update
({
id
:
needinfo
.
id
,
status
:
"3"
},
t
);
//发送短信通知
self
.
sendSmsNotification
(
needinfo
.
contacts_mobile
,
needinfo
.
user_id
,
needinfo
.
consult_type
,
needinfo
.
consult_type_name
,
3
);
needinfo
.
solutionNum
=
ab
.
solutionNum
;
self
.
sendNotification
(
needinfo
,
3
);
return
system
.
getResultSuccess
();
});
...
...
@@ -125,9 +202,9 @@ class NeedSolutionService extends ServiceBase {
return
await
self
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
needInfoDao
.
update
({
id
:
needinfo
.
id
,
status
:
"3"
},
t
);
await
self
.
dao
.
create
(
createObj
,
t
);
//发送
短信
通知
// self.sendSmsNotification(needinfo.contacts_mobile,needinfo.consult_type,needinfo.consult_type_name,3)
;
self
.
send
SmsNotification
(
needinfo
.
contacts_mobile
,
needinfo
.
user_id
,
needinfo
.
consult_type
,
needinfo
.
consult_type_name
,
3
);
//发送
消息
通知
needinfo
.
solutionNum
=
solution_num
;
self
.
send
Notification
(
needinfo
,
3
);
return
system
.
getResultSuccess
(
solution_num
);
});
...
...
@@ -185,8 +262,4 @@ class NeedSolutionService extends ServiceBase {
})
}
}
module
.
exports
=
NeedSolutionService
;
// var task = new NeedSolutionService();
// task.sendSmsNotification("15675201933","/ic/cpreg/","/工商服务/云上园区注册/",3).then(d=>{
// console.log("eeeeeeeeeeeeee"+d);
// })
\ No newline at end of file
module
.
exports
=
NeedSolutionService
;
\ No newline at end of file
brg-user-center/app/base/service/impl/order/orderDeliverySve.js
View file @
de69d1d7
...
...
@@ -155,264 +155,176 @@ class OrderDeliveryService extends ServiceBase {
return
system
.
getResultSuccess
();
}
/**
* 组装
短信模板
* @param {*} orderdetail 订单
数据
* @param {*}
status 订单交付状态
* 组装
模板参数
* @param {*} orderdetail 订单
详情
* @param {*}
productName 产品名称
* @param {*} productType 产品类型
* @param {*} productTypeName 产品类型名称
* @param {*} productTypeOne 产品一类
* @param {*} msgTemplate 消息模板
*/
async
packageSmsTemplates
(
orderdetail
,
status
,
productType
,
productTypeName
,
productTypeOne
){
var
params
=
{};
var
phoneNumber
=
orderdetail
.
order_snapshot
&&
orderdetail
.
order_snapshot
.
contactsPhone
?
orderdetail
.
order_snapshot
.
contactsPhone
:
""
;
//联系人手机号
if
(
phoneNumber
&&
productType
){
if
(
productType
==
"/ic/cpreg/"
&&
status
==
130
){
//云上公司注册工商审核环节不通知
return
;
}
var
smsMessageBody
=
null
;
//短信模板内容
if
(
productType
.
indexOf
(
"/ic/"
)
>=
0
){
//工商产品
smsMessageBody
=
MsgTemplate
.
ic
.
order
[
status
]
&&
MsgTemplate
.
ic
.
order
[
status
].
sms
?
MsgTemplate
.
ic
.
order
[
status
].
sms
:
""
;
if
(
smsMessageBody
){
smsMessageBody
=
smsMessageBody
.
replace
(
/{productName}/g
,
productTypeName
)
.
replace
(
/{orderNum}/g
,
orderdetail
.
order_num
);
if
(
orderdetail
.
end_time
){
//过期时间
smsMessageBody
=
smsMessageBody
.
replace
(
/{expirationDate}/g
,
orderdetail
.
end_time
);
var
m1
=
moment
(
new
Date
());
var
m2
=
moment
(
new
Date
(
orderdetail
.
end_time
));
var
days
=
m2
.
diff
(
m1
,
'day'
);
if
(
days
&&
days
>=
0
){
//剩余天数
smsMessageBody
=
smsMessageBody
.
replace
(
/{timeRemaining}/g
,
days
);
}
}
if
(
orderdetail
.
user_id
){
//用户账号
smsMessageBody
=
smsMessageBody
.
replace
(
/{userId}/g
,
orderdetail
.
user_id
);
}
if
(
orderdetail
.
user_name
){
//用户昵称
smsMessageBody
=
smsMessageBody
.
replace
(
/{userName}/g
,
orderdetail
.
user_name
);
}
if
(
orderdetail
.
region_name
){
//地区
smsMessageBody
=
smsMessageBody
.
replace
(
/{area}/g
,
orderdetail
.
region_name
);
}
var
deliverContent
=
orderdetail
.
deliver_content
;
if
(
deliverContent
){
//注册园区
if
(
productType
==
"/ic/cpreg/"
&&
deliverContent
.
companyInfo
&&
deliverContent
.
companyInfo
.
registeredPark
){
smsMessageBody
=
smsMessageBody
.
replace
(
/{parkName}/g
,
deliverContent
.
companyInfo
.
registeredPark
);
}
//邮寄信息
if
(
deliverContent
.
expressInfo
&&
deliverContent
.
expressInfo
.
logisticsCompany
&&
deliverContent
.
expressInfo
.
trackingNumber
){
smsMessageBody
=
smsMessageBody
.
replace
(
/{logisticsCompany}/g
,
deliverContent
.
expressInfo
.
logisticsCompany
)
.
replace
(
/{waybillNo}/g
,
deliverContent
.
expressInfo
.
trackingNumber
);
}
}
}
async
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
msgTemplate
){
//productName orderNum expirationDate timeRemaining userId userName area parkName logisticsCompany waybillNo
if
(
orderdetail
.
order_num
){
//订单号
msgTemplate
=
msgTemplate
.
replace
(
/{orderNum}/g
,
orderdetail
.
order_num
);
}
if
(
orderdetail
.
total_sum
){
//订单金额
var
totalSum
=
orderdetail
.
total_sum
/
100
;
totalSum
=
totalSum
.
toFixed
(
2
);
msgTemplate
=
msgTemplate
.
replace
(
/{totalSum}/g
,
totalSum
);
}
if
(
orderdetail
.
end_time
){
//过期时间
msgTemplate
=
msgTemplate
.
replace
(
/{expirationDate}/g
,
orderdetail
.
end_time
);
var
m1
=
moment
(
new
Date
());
var
m2
=
moment
(
new
Date
(
orderdetail
.
end_time
));
var
days
=
m2
.
diff
(
m1
,
'day'
);
if
(
days
&&
days
>=
0
){
//剩余天数
msgTemplate
=
msgTemplate
.
replace
(
/{timeRemaining}/g
,
days
);
}
if
(
productType
.
indexOf
(
"/qcfw/"
)
>=
0
){
//资质证照
if
(
status
==
170
&&
(
productType
==
"/qcfw/icpannals/"
||
productType
==
"/qcfw/ediannals/"
)){
//年报已完成
smsMessageBody
=
MsgTemplate
.
qcfw
.
order
[
status
]
&&
MsgTemplate
.
qcfw
.
order
[
status
].
ar_sms
?
MsgTemplate
.
qcfw
.
order
[
status
].
ar_sms
:
""
;
}
else
{
smsMessageBody
=
MsgTemplate
.
qcfw
.
order
[
status
]
&&
MsgTemplate
.
qcfw
.
order
[
status
].
sms
?
MsgTemplate
.
qcfw
.
order
[
status
].
sms
:
""
;
}
if
(
smsMessageBody
){
smsMessageBody
=
smsMessageBody
.
replace
(
/{productName}/g
,
productTypeName
);
if
(
orderdetail
.
user_id
){
//用户账号
smsMessageBody
=
smsMessageBody
.
replace
(
/{userId}/g
,
orderdetail
.
user_id
);
}
if
(
orderdetail
.
user_name
){
//用户昵称
smsMessageBody
=
smsMessageBody
.
replace
(
/{userName}/g
,
orderdetail
.
user_name
);
}
if
(
productTypeOne
){
//产品一类名称
smsMessageBody
=
smsMessageBody
.
replace
(
/{productType}/g
,
productTypeOne
);
}
if
(
orderdetail
.
end_time
){
//过期时间
smsMessageBody
=
smsMessageBody
.
replace
(
/{expirationDate}/g
,
orderdetail
.
end_time
);
var
m1
=
moment
(
new
Date
());
var
m2
=
moment
(
new
Date
(
orderdetail
.
end_time
));
var
days
=
m2
.
diff
(
m1
,
'day'
);
if
(
days
&&
days
>=
0
){
//剩余天数
smsMessageBody
=
smsMessageBody
.
replace
(
/{timeRemaining}/g
,
days
);
}
}
var
deliverContent
=
orderdetail
.
deliver_content
;
if
(
deliverContent
){
//邮寄信息
if
(
deliverContent
.
expressInfo
&&
deliverContent
.
expressInfo
.
logisticsCompany
&&
deliverContent
.
expressInfo
.
trackingNumber
){
smsMessageBody
=
smsMessageBody
.
replace
(
/{logisticsCompany}/g
,
deliverContent
.
expressInfo
.
logisticsCompany
)
.
replace
(
/{waybillNo}/g
,
deliverContent
.
expressInfo
.
trackingNumber
);
}
//资质证号
if
(
deliverContent
.
qualification
&&
deliverContent
.
qualification
.
certificateNumber
){
smsMessageBody
=
smsMessageBody
.
replace
(
/{qcNo}/g
,
deliverContent
.
qualification
.
certificateNumber
);
}
}
var
orderSnapshot
=
orderdetail
.
order_snapshot
;
//订单快照
if
(
orderSnapshot
&&
orderSnapshot
.
serviceArea
){
//服务地址
smsMessageBody
=
smsMessageBody
.
replace
(
/{area}/g
,
orderSnapshot
.
serviceArea
);
}
}
}
var
deliverContent
=
orderdetail
.
deliver_content
;
if
(
deliverContent
){
//注册园区
if
(
orderdetail
.
product_type
==
"/ic/cpreg/"
&&
deliverContent
.
companyInfo
&&
deliverContent
.
companyInfo
.
registeredPark
){
msgTemplate
=
msgTemplate
.
replace
(
/{parkName}/g
,
deliverContent
.
companyInfo
.
registeredPark
);
}
if
(
!
smsMessageBody
||
smsMessageBody
.
indexOf
(
"{"
)
>=
0
||
!
phoneNumber
){
return
null
;
//邮寄信息
if
(
deliverContent
.
expressInfo
&&
deliverContent
.
expressInfo
.
logisticsCompany
&&
deliverContent
.
expressInfo
.
trackingNumber
){
msgTemplate
=
msgTemplate
.
replace
(
/{logisticsCompany}/g
,
deliverContent
.
expressInfo
.
logisticsCompany
)
.
replace
(
/{waybillNo}/g
,
deliverContent
.
expressInfo
.
trackingNumber
);
}
params
.
phoneNumber
=
phoneNumber
;
params
.
messageBody
=
smsMessageBody
;
return
params
;
}
return
null
;
}
/**
* 组装站内信模板
* @param {*} orderdetail 订单数据
* @param {*} status 订单交付状态
* @param {*} productType 产品类型
* @param {*} productTypeName 产品类型名称
* @param {*} productTypeOne 产品一类
*/
async
packageWebinfoTemplates
(
orderdetail
,
status
,
productType
,
productTypeName
,
productTypeOne
){
var
params
=
{};
var
subAccount
=
orderdetail
.
user_id
||
""
;
//用户id
if
(
subAccount
&&
productType
){
if
(
productType
==
"/ic/cpreg/"
&&
status
==
130
){
//云上公司注册工商审核环节不通知
return
;
//资质证号
if
(
deliverContent
.
qualification
&&
deliverContent
.
qualification
.
certificateNumber
){
msgTemplate
=
msgTemplate
.
replace
(
/{qcNo}/g
,
deliverContent
.
qualification
.
certificateNumber
);
}
else
if
(
orderdetail
.
certificateNumber
){
msgTemplate
=
msgTemplate
.
replace
(
/{qcNo}/g
,
orderdetail
.
certificateNumber
);
}
var
webinfoMessageBody
=
null
;
//站内信模板
if
(
productType
.
indexOf
(
"/ic/"
)
>=
0
){
//工商产品
webinfoMessageBody
=
MsgTemplate
.
ic
.
order
[
status
]
&&
MsgTemplate
.
ic
.
order
[
status
].
webinfo
?
MsgTemplate
.
ic
.
order
[
status
].
webinfo
:
""
;
params
.
title
=
MsgTemplate
.
ic
.
order
[
status
]
&&
MsgTemplate
.
ic
.
order
[
status
].
webinfotitle
?
MsgTemplate
.
ic
.
order
[
status
].
webinfotitle
:
""
;
if
(
webinfoMessageBody
){
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{productName}/g
,
productTypeName
)
.
replace
(
/{orderNum}/g
,
orderdetail
.
order_num
);
if
(
orderdetail
.
end_time
){
//过期时间
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{expirationDate}/g
,
orderdetail
.
end_time
);
var
m1
=
moment
(
new
Date
());
var
m2
=
moment
(
new
Date
(
orderdetail
.
end_time
));
var
days
=
m2
.
diff
(
m1
,
'day'
);
if
(
days
&&
days
>=
0
){
//剩余天数
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{timeRemaining}/g
,
days
);
}
}
if
(
orderdetail
.
user_id
){
//用户账号
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{userId}/g
,
orderdetail
.
user_id
);
}
if
(
orderdetail
.
user_name
){
//用户昵称
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{userName}/g
,
orderdetail
.
user_name
);
}
if
(
orderdetail
.
region_name
){
//地区
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{area}/g
,
orderdetail
.
region_name
);
}
var
deliverContent
=
orderdetail
.
deliver_content
;
if
(
deliverContent
){
//注册园区
if
(
productType
==
"/ic/cpreg/"
&&
deliverContent
.
companyInfo
&&
deliverContent
.
companyInfo
.
registeredPark
){
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{parkName}/g
,
deliverContent
.
companyInfo
.
registeredPark
);
}
//邮寄信息
if
(
deliverContent
.
expressInfo
&&
deliverContent
.
expressInfo
.
logisticsCompany
&&
deliverContent
.
expressInfo
.
trackingNumber
){
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{logisticsCompany}/g
,
deliverContent
.
expressInfo
.
logisticsCompany
)
.
replace
(
/{waybillNo}/g
,
deliverContent
.
expressInfo
.
trackingNumber
);
}
if
(
deliverContent
.
annualReport
){
//年报列表
var
year
=
null
;
for
(
var
i
=
0
;
i
<
deliverContent
.
annualReport
.
length
;
i
++
){
var
annualReport
=
deliverContent
.
annualReport
[
i
];
if
(
annualReport
&&
annualReport
.
year
&&
annualReport
.
status
&&
annualReport
.
status
==
'declaresuccess'
){
if
(
!
year
||
year
<
annualReport
.
year
)
year
=
annualReport
.
year
;
}
}
}
if
(
productType
.
indexOf
(
"/qcfw/"
)
>=
0
){
//资质证照
params
.
title
=
MsgTemplate
.
qcfw
.
order
[
status
]
&&
MsgTemplate
.
qcfw
.
order
[
status
].
webinfotitle
?
MsgTemplate
.
qcfw
.
order
[
status
].
webinfotitle
:
""
;
if
(
status
==
170
&&
(
productType
==
"/qcfw/icpannals/"
||
productType
==
"/qcfw/ediannals/"
)){
//年报已完成
webinfoMessageBody
=
MsgTemplate
.
qcfw
.
order
[
status
]
&&
MsgTemplate
.
qcfw
.
order
[
status
].
ar_webinfo
?
MsgTemplate
.
qcfw
.
order
[
status
].
ar_webinfo
:
""
;
}
else
{
webinfoMessageBody
=
MsgTemplate
.
qcfw
.
order
[
status
]
&&
MsgTemplate
.
qcfw
.
order
[
status
].
webinfo
?
MsgTemplate
.
qcfw
.
order
[
status
].
webinfo
:
""
;
}
if
(
webinfoMessageBody
){
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{productName}/g
,
productTypeName
);
if
(
orderdetail
.
end_time
){
//过期时间
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{expirationDate}/g
,
orderdetail
.
end_time
);
var
m1
=
moment
(
new
Date
());
var
m2
=
moment
(
new
Date
(
orderdetail
.
end_time
));
var
days
=
m2
.
diff
(
m1
,
'day'
);
if
(
days
&&
days
>=
0
){
//剩余天数
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{timeRemaining}/g
,
days
);
}
}
if
(
orderdetail
.
user_id
){
//用户账号
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{userId}/g
,
orderdetail
.
user_id
);
}
if
(
orderdetail
.
user_name
){
//用户昵称
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{userName}/g
,
orderdetail
.
user_name
);
}
if
(
productTypeOne
){
//产品一类名称
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{productType}/g
,
productTypeOne
);
}
var
deliverContent
=
orderdetail
.
deliver_content
;
if
(
deliverContent
){
//邮寄信息
if
(
deliverContent
.
expressInfo
&&
deliverContent
.
expressInfo
.
logisticsCompany
&&
deliverContent
.
expressInfo
.
trackingNumber
){
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{logisticsCompany}/g
,
deliverContent
.
expressInfo
.
logisticsCompany
)
.
replace
(
/{waybillNo}/g
,
deliverContent
.
expressInfo
.
trackingNumber
);
}
//资质证号
if
(
deliverContent
.
qualification
&&
deliverContent
.
qualification
.
certificateNumber
){
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{qcNo}/g
,
deliverContent
.
qualification
.
certificateNumber
);
}
}
var
orderSnapshot
=
orderdetail
.
order_snapshot
;
//订单快照
if
(
orderSnapshot
&&
orderSnapshot
.
serviceArea
){
//服务地址
webinfoMessageBody
=
webinfoMessageBody
.
replace
(
/{area}/g
,
orderSnapshot
.
serviceArea
);
}
if
(
year
){
msgTemplate
=
msgTemplate
.
replace
(
/{year}/g
,
year
);
}
}
if
(
!
webinfoMessageBody
||
webinfoMessageBody
.
indexOf
(
"{"
)
>=
0
||
!
subAccount
){
return
null
;
}
params
.
subAccount
=
subAccount
;
params
.
messageBody
=
webinfoMessageBody
;
return
params
;
}
return
null
;
if
(
productName
){
//产品名称
msgTemplate
=
msgTemplate
.
replace
(
/{productName}/g
,
productName
);
}
if
(
productType
){
//产品类型名称
msgTemplate
=
msgTemplate
.
replace
(
/{productType}/g
,
productType
);
}
if
(
orderdetail
.
region_name
){
//地区
msgTemplate
=
msgTemplate
.
replace
(
/{area}/g
,
orderdetail
.
region_name
);
}
if
(
orderdetail
.
user_id
){
//用户id
msgTemplate
=
msgTemplate
.
replace
(
/{userId}/g
,
orderdetail
.
user_id
);
}
if
(
orderdetail
.
user_name
){
//用户昵称
msgTemplate
=
msgTemplate
.
replace
(
/{userName}/g
,
orderdetail
.
user_name
);
}
return
msgTemplate
;
}
/**
* 发送消息通知
* @param {*} orderNum 订单号
* @param {*} status
订单交付
状态
* @param {*} status 状态
*/
async
sendNotification
(
orderNum
,
status
)
{
async
sendNotification
(
orderNum
,
status
)
{
try
{
var
smsParams
=
{
phoneNumber
:
null
,
messageBody
:
null
};
//短信通知参数
var
webinfoParams
=
{
"title"
:
null
,
"subAccount"
:
null
,
"messageBody"
:
null
};
//站内信通知参数
var
functionModule
=
"order"
;
//功能模块编码,用于获取消息模板
var
orderdetail
=
null
;
//获取订单详情
var
orderDetailRes
=
await
this
.
dao
.
getOrderDetailByOrderNum
(
orderNum
);
if
(
orderDetailRes
&&
orderDetailRes
.
length
>
0
){
var
orderdetail
=
orderDetailRes
[
0
];
//订单详情信息
var
productType
=
orderdetail
.
product_type
;
//产品类型
var
product_type_name
=
orderdetail
.
product_type_name
;
//产品类型名称
var
product_type_one_name
=
null
;
//产品一类
if
(
!
productType
||
!
product_type_name
){
return
;
orderdetail
=
orderDetailRes
[
0
];
}
if
(
!
orderdetail
||
!
status
||
!
orderdetail
.
product_type
){
return
system
.
getResultFail
();
}
var
nameArr
=
orderdetail
.
product_type_name
?
orderdetail
.
product_type_name
.
split
(
"/"
)
:
[];
var
productName
=
null
;
//产品名称
var
productType
=
null
;
//产品类型名称
if
(
nameArr
&&
nameArr
.
length
==
4
)
{
productName
=
nameArr
[
2
];
productType
=
nameArr
[
1
];
}
var
typeOne
=
null
;
//产品大类编码,用于获取消息模板
if
(
orderdetail
.
product_type
.
indexOf
(
"/ic/"
)
>=
0
)
{
//工商产品
typeOne
=
"ic"
;
}
if
(
orderdetail
.
product_type
.
indexOf
(
"/qcfw/"
)
>=
0
)
{
//资质证照产品
typeOne
=
"qcfw"
;
}
if
(
!
typeOne
||
!
productName
){
return
system
.
getResultFail
();
}
var
params
=
{};
if
(
status
==
170
&&
(
orderdetail
.
product_type
==
"/qcfw/icpannals/"
||
orderdetail
.
product_type
==
"/qcfw/ediannals/"
)){
//年报已完成
functionModule
=
"others"
;
if
(
orderdetail
.
tx_orders_num
){
//获取资质信息
var
qcInfoRes
=
await
this
.
dao
.
getQcInfoByMainOrderNum
(
orderdetail
.
tx_orders_num
);
if
(
qcInfoRes
&&
qcInfoRes
.
length
>
0
){
if
(
qcInfoRes
[
0
]
&&
qcInfoRes
[
0
].
deliver_content
&&
qcInfoRes
[
0
].
deliver_content
.
qualification
&&
qcInfoRes
[
0
].
deliver_content
.
qualification
.
certificateNumber
){
orderdetail
.
certificateNumber
=
qcInfoRes
[
0
].
deliver_content
.
qualification
.
certificateNumber
;
}
}
}
}
if
(
orderdetail
.
order_snapshot
&&
orderdetail
.
order_snapshot
.
contactsPhone
){
//短信
var
sms
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
sms
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
sms
:
""
;
if
(
sms
){
sms
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
sms
);
if
(
sms
.
indexOf
(
"{"
)
<
0
&&
sms
.
indexOf
(
"}"
)
<
0
)
{
params
[
"phoneList"
]
=
[{
phoneNumber
:
orderdetail
.
order_snapshot
.
contactsPhone
,
messageBody
:
sms
}];
}
}
}
if
(
orderdetail
.
user_id
){
//站内信
var
webinfo
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfo
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfo
:
""
;
var
webinfotitle
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfotitle
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfotitle
:
""
;
if
(
webinfo
&&
webinfotitle
){
webinfo
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
webinfo
);
if
(
webinfo
.
indexOf
(
"{"
)
<
0
&&
webinfo
.
indexOf
(
"}"
)
<
0
)
{
params
[
"subAccountList"
]
=
[{
title
:
webinfotitle
,
subAccount
:
orderdetail
.
user_id
,
messageBody
:
webinfo
}];
}
}
var
productArr
=
product_type_name
.
split
(
"/"
);
if
(
productArr
&&
productArr
.
length
==
4
){
product_type_name
=
productArr
[
2
];
product_type_one_name
=
productArr
[
1
];
}
if
(
orderdetail
.
wechat_no
){
//微信
var
wechatMsg
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
wx
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
wx
:
""
;
var
wechattitle
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfotitle
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfotitle
:
""
;
if
(
wechatMsg
&&
wechattitle
){
wechatMsg
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
wechatMsg
);
if
(
wechatMsg
.
indexOf
(
"{"
)
<
0
&&
wechatMsg
.
indexOf
(
"}"
)
<
0
)
{
params
[
"wechatList"
]
=
[{
title
:
wechattitle
,
wechatNumber
:
orderdetail
.
wechat_no
,
messageBody
:
wechatMsg
}];
}
}
//组装消息模板
var
smsParams
=
await
this
.
packageSmsTemplates
(
orderdetail
,
status
,
productType
,
product_type_name
,
product_type_one_name
);
var
webinfoParams
=
await
this
.
packageWebinfoTemplates
(
orderdetail
,
status
,
productType
,
product_type_name
,
product_type_one_name
);
if
(
smsParams
&&
webinfoParams
){
console
.
log
(
JSON
.
stringify
(
smsParams
),
"smsParams++++++++++++++++++++++++++++++"
);
console
.
log
(
JSON
.
stringify
(
webinfoParams
),
"webinfoParams------------------------"
);
// await this.utilsMsgSendSve.sendMessageVerify({phoneList:[smsParams],subAccountList:[webinfoParams]});//发送消息通知
}
if
(
orderdetail
.
email
){
//邮箱
var
emailMsg
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
email
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
email
:
""
;
if
(
emailMsg
){
emailMsg
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
emailMsg
);
if
(
emailMsg
.
indexOf
(
"{"
)
<
0
&&
emailMsg
.
indexOf
(
"}"
)
<
0
)
{
params
[
"emailList"
]
=
[{
email
:
orderdetail
.
email
,
messageBody
:
emailMsg
}];
}
}
return
;
}
}
await
this
.
utilsMsgSendSve
.
sendMessageVerify
(
params
);
console
.
log
(
JSON
.
stringify
(
params
),
"params++++++++++++++++++++++++++++++++++++++++"
);
return
system
.
getResultSuccess
(
params
);
}
catch
(
e
)
{
console
.
log
(
e
.
stack
)
this
.
execClient
.
execLogs
(
"orderDeliverySve.js/sendNotification(发送短信通知)方法出现异常"
,
{
orderNum
:
orderNum
,
status
:
status
},
"orderDeliverySve_sendNotification_error"
,
null
,
e
.
stack
);
return
;
this
.
execClient
.
execLogs
(
"orderDeliverySve.js/sendNotification(发送消息通知)方法出现异常"
,
{
orderNum
:
orderNum
,
status
:
status
},
"orderDeliverySve_sendNotification_error"
,
null
,
e
.
stack
);
return
system
.
getResultFail
();
}
}
/**
* 创建资质信息
...
...
brg-user-center/app/base/service/impl/order/orderInfoSve.js
View file @
de69d1d7
...
...
@@ -238,8 +238,8 @@ class OrderInfoService extends ServiceBase {
user_id
:
pobj
.
actionBody
.
interface
.
para
.
uin
,
delivery_status
:
1
,
user_name
:
txorderdetail
.
goodsDetail
.
formInfo
.
userName
,
email
:
txorderdetail
.
goodsDetail
.
formInfo
.
e
mail
||
""
,
wechat_no
:
txorderdetail
.
goodsDetail
.
formInfo
.
w
echatNo
||
""
email
:
txorderdetail
.
goodsDetail
.
formInfo
.
E
mail
||
""
,
wechat_no
:
txorderdetail
.
goodsDetail
.
formInfo
.
W
echatNo
||
""
}
var
orderDeliveryinfo
=
await
self
.
orderDeliveryDao
.
create
(
orderDeliveryobj
,
t
);
var
orderPayobj
=
{
...
...
@@ -267,6 +267,9 @@ class OrderInfoService extends ServiceBase {
if
(
!
ispush
)
{
return
system
.
getResultSuccess
();
}
txorderdetail
.
goodsDetail
.
formInfo
.
buyTime
=
new
Date
(
txorderdetail
.
payEndTime
);
txorderdetail
.
goodsDetail
.
formInfo
.
timeSpan
=
1
;
txorderdetail
.
goodsDetail
.
formInfo
.
timeUnit
=
"y"
;
//生产者------订单推送
var
pushobj
=
{
"actionType"
:
"produceData"
,
// Y 功能名称
...
...
@@ -832,7 +835,7 @@ class OrderInfoService extends ServiceBase {
}
//退款
async
refundOrder
(
req
,
pobj
)
{
async
refundOrder
(
pobj
,
req
)
{
if
(
!
pobj
.
orderNum
)
{
return
system
.
getResultFail
(
-
101
,
"orderNum is empty"
);
}
...
...
brg-user-center/app/base/service/impl/utilsSve/utilsMsgSendSve.js
View file @
de69d1d7
...
...
@@ -46,6 +46,20 @@ class UtilsMsgSendService extends AppServiceBase {
return
await
this
.
redisClient
.
getCache
(
key
);
}
/**
* 删除验证码
* @param {*} phoneNumber 手机号
*/
async
removeVerificationCode
(
phoneNumber
)
{
if
(
!
phoneNumber
)
{
return
system
.
getResult
(
null
,
"手机号不能为空"
);
}
if
(
!
(
/^1
[
3|4|5|6|7|8|9
][
0-9
]\d{8}
$/
.
test
(
phoneNumber
)))
{
return
system
.
getResult
(
null
,
"手机号有误,请输入正确手机号"
);
}
var
key
=
this
.
prefix
+
phoneNumber
;
return
await
this
.
redisClient
.
delete
(
key
);
}
/**
* 发送信息
* @param {*} params 格式:
{
...
...
@@ -154,6 +168,29 @@ class UtilsMsgSendService extends AppServiceBase {
}
}
}
if
(
verifyResult
)
{
return
verifyResult
;
}
if
(
params
.
emailList
&&
params
.
emailList
.
length
>
0
)
{
for
(
let
index
=
0
;
index
<
params
.
emailList
.
length
;
index
++
)
{
var
element
=
params
.
emailList
[
index
];
if
(
element
)
{
if
(
!
element
.
email
)
{
verifyResult
=
system
.
getResult
(
null
,
"邮箱不能为空"
);
break
;
}
if
(
!
element
.
messageBody
)
{
verifyResult
=
system
.
getResult
(
null
,
"微信消息主体不能为空"
);
break
;
}
reqParam
.
emailTpl
.
push
(
element
.
messageBody
);
reqParam
.
emailList
.
push
(
element
.
email
);
}
}
}
if
(
verifyResult
)
{
return
verifyResult
;
}
var
sendResult
=
await
this
.
sendMessage
(
reqParam
);
if
(
sendResult
.
status
==
1
)
{
this
.
redisClient
.
setWithEx
(
shaStr
,
1
,
setCacheEx
);
...
...
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