新增了:发放系统优惠卷
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/extend/rabbitMq"
|
||||
)
|
||||
|
||||
// PatientDistributeCoupon 患者-优惠劵发放-站内
|
||||
func PatientDistributeCoupon(couponName string, userId int64) (bool, error) {
|
||||
// 建立队列连接
|
||||
rabbitMQ, err := rabbitMq.NewRabbitMQClient()
|
||||
if err != nil {
|
||||
return false, errors.New("内部错误")
|
||||
}
|
||||
|
||||
defer rabbitMQ.Close()
|
||||
|
||||
data := make(map[string]interface{})
|
||||
data["user_id"] = fmt.Sprintf("%d", userId)
|
||||
data["notice_type"] = 3
|
||||
data["notice_system_type"] = 2
|
||||
data["from_name"] = "肝胆小秘书"
|
||||
data["notice_brief_title"] = "有新的优惠券已下发至您的账户,点击查看详情。"
|
||||
data["notice_title"] = fmt.Sprintf("【%s】已到账", couponName)
|
||||
data["notice_content"] = "有新的优惠劵已下发至您的账户中,点击查看详情!"
|
||||
data["link_type"] = 7
|
||||
|
||||
err = rabbitMQ.Publish("send.station.message.queue", "amqp.direct", "SendStationMessage", data)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user