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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
185 additions
and
55 deletions
+185
-55
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
+0
-0
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
This diff is collapsed.
Click to expand it.
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