...
|
...
|
@@ -3,6 +3,7 @@ package agg |
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/astaxie/beego/orm"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/idgen"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
|
|
|
"opp/internal/utils"
|
...
|
...
|
@@ -19,7 +20,7 @@ var ( |
|
|
)
|
|
|
|
|
|
//发送审批消息
|
|
|
func SendApproveMsg(receiverId int64, name string, companyId int64, chanceId int64, chanceTypeId int, reviewStatus int) (err error) {
|
|
|
func SendApproveMsg(receiverId int64, name string, companyId int64, chanceId int64, chanceTypeId int, reviewStatus int, data protocol.MsgData) (err error) {
|
|
|
var (
|
|
|
userMsg *models.UserMsg
|
|
|
chanceType *models.ChanceType
|
...
|
...
|
@@ -56,6 +57,7 @@ func SendApproveMsg(receiverId int64, name string, companyId int64, chanceId int |
|
|
IsPublic: 0,
|
|
|
CreateAt: time.Now(),
|
|
|
ChanceId: chanceId,
|
|
|
Data: common.AssertJson(data),
|
|
|
}
|
|
|
if _, err = models.AddUserMsg(userMsg); err != nil {
|
|
|
return
|
...
|
...
|
@@ -65,7 +67,7 @@ func SendApproveMsg(receiverId int64, name string, companyId int64, chanceId int |
|
|
}
|
|
|
|
|
|
//发送审批消息
|
|
|
func SendApproveMsgByFormat(receiverId int64, name string, companyId int64, chanceId int64, chanceTypeId int, format string) (err error) {
|
|
|
func SendApproveMsgByFormat(receiverId int64, name string, companyId int64, chanceId int64, chanceTypeId int, format string, data protocol.MsgData) (err error) {
|
|
|
var (
|
|
|
userMsg *models.UserMsg
|
|
|
chanceType *models.ChanceType
|
...
|
...
|
@@ -83,6 +85,7 @@ func SendApproveMsgByFormat(receiverId int64, name string, companyId int64, chan |
|
|
SourceType: protocol.SourceTypeChance,
|
|
|
IsPublic: 0,
|
|
|
CreateAt: time.Now(),
|
|
|
Data: common.AssertJson(data),
|
|
|
}
|
|
|
if _, err = models.AddUserMsg(userMsg); err != nil {
|
|
|
return
|
...
|
...
|
@@ -92,7 +95,7 @@ func SendApproveMsgByFormat(receiverId int64, name string, companyId int64, chan |
|
|
}
|
|
|
|
|
|
//发送被审核消息
|
|
|
func SendApprovedMsg(receiverId int64, name string, companyId int64, chanceId int64, chanceTypeId int, reviewStatus int, msgType int) (err error) {
|
|
|
func SendApprovedMsg(receiverId int64, name string, companyId int64, chanceId int64, chanceTypeId int, reviewStatus int, msgType int, msgData protocol.MsgData) (err error) {
|
|
|
var (
|
|
|
chanceType *models.ChanceType
|
|
|
format string
|
...
|
...
|
@@ -115,7 +118,7 @@ func SendApprovedMsg(receiverId int64, name string, companyId int64, chanceId in |
|
|
return
|
|
|
}
|
|
|
format = fmt.Sprintf(format, chanceType.Name)
|
|
|
return SendMsg(receiverId, name, companyId, chanceId, protocol.SourceTypeChance, format, msgType, chanceId)
|
|
|
return SendMsgWithData(receiverId, name, companyId, chanceId, protocol.SourceTypeChance, format, msgType, chanceId, msgData)
|
|
|
}
|
|
|
|
|
|
//发送消息
|
...
|
...
|
@@ -143,6 +146,31 @@ func SendMsg(receiverId int64, name string, companyId int64, sourceId int64, sou |
|
|
}
|
|
|
|
|
|
//发送消息
|
|
|
func SendMsgWithData(receiverId int64, name string, companyId int64, sourceId int64, sourceType int, message string, msgType int, chanceId int64, msgData protocol.MsgData) (err error) {
|
|
|
var (
|
|
|
userMsg *models.UserMsg
|
|
|
)
|
|
|
userMsg = &models.UserMsg{
|
|
|
Id: idgen.Next(),
|
|
|
CompanyId: companyId,
|
|
|
ReceiveUserId: receiverId,
|
|
|
MsgType: msgType,
|
|
|
Message: message,
|
|
|
SourceId: sourceId,
|
|
|
SourceType: sourceType,
|
|
|
IsPublic: 0,
|
|
|
CreateAt: time.Now(),
|
|
|
ChanceId: chanceId,
|
|
|
Data: common.AssertJson(msgData),
|
|
|
}
|
|
|
if _, err = models.AddUserMsg(userMsg); err != nil {
|
|
|
return
|
|
|
}
|
|
|
logMsg(userMsg, name)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//发送消息
|
|
|
func SendMsgWithHeader(header *protocol.RequestHeader, receiverId int64, name string, sourceId int64, sourceType int, message string, msgType int, chanceId int64) (err error) {
|
|
|
var (
|
|
|
userMsg *models.UserMsg
|
...
|
...
|
|