You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
269 lines
9.8 KiB
269 lines
9.8 KiB
package sendmessage
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
|
|
)
|
|
|
|
/*
|
|
发送文本
|
|
@sendUserList 接收信息人员
|
|
@Title 一级标题,建议不超过36个字
|
|
@Desc 标题辅助信息,建议不超过44个字
|
|
@Unit 考核计量单位
|
|
@Reason 考核原因
|
|
@handleUrl 访问Key
|
|
@Type 1:加分;2:减分
|
|
@departmentId 执行考核部门
|
|
@userKey 执行考核人
|
|
@Score 考核分值
|
|
@keyNumber 任务卡ID
|
|
*/
|
|
func SendMsgPublic(sendUserList, Title, Desc, Unit, Reason, handleUrl string, Type int, departmentId, userKey, Score, keyNumber int64, msgTxt string) (callbakcMsg []byte, isTrueCall bool, callBackCont string) {
|
|
var sendTextMsg TextNoticeTemplateMedium
|
|
sendTextMsg.Inset(sendUserList, "template_card", "text_notice", keyNumber)
|
|
|
|
//获取考核详情
|
|
sendTextMsg.TemplateCard.MainTitle.Title = Title
|
|
sendTextMsg.TemplateCard.MainTitle.Desc = Desc
|
|
|
|
var scoreReason string
|
|
if Type == 1 {
|
|
scoreReason = "增加:" + strconv.FormatInt(Score, 10) + Unit
|
|
} else {
|
|
scoreReason = "扣除:" + strconv.FormatInt(Score, 10) + Unit
|
|
}
|
|
//引用文献样式
|
|
sendTextMsg.TemplateCard.QuoteArea.Type = 0
|
|
sendTextMsg.TemplateCard.QuoteArea.Title = scoreReason
|
|
sendTextMsg.TemplateCard.QuoteArea.QuoteText = "原因:\n" + Reason
|
|
|
|
var htalConListStrMap []HorizontalContentListType
|
|
var htalConListStrCon HorizontalContentListType
|
|
//二级普通文本,
|
|
sendTextMsg.TemplateCard.SubTitleText = "考核上报部门:"
|
|
execDerpatCont := ""
|
|
// execDerpatCont := "考核部门:"
|
|
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId)
|
|
if execDerpatErr == true {
|
|
execDerpatCont = execDerpatCont + execDerpat.Name
|
|
}
|
|
htalConListStrCon.KeyName = execDerpatCont
|
|
//获取操作人
|
|
userFileStr := "wm_number,qywx_key,wx_key"
|
|
//操作人条件
|
|
userWherAry := commonus.MapOut()
|
|
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|
userWherAry["wm_key"] = userKey
|
|
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry)
|
|
if userIsTrue == true {
|
|
|
|
if userConting.WechatId != "" {
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WechatId)
|
|
if userWechatErr == true {
|
|
htalConListStrCon.Type = 3
|
|
htalConListStrCon.Value = userWechat.Name
|
|
htalConListStrCon.UserId = userConting.WechatId
|
|
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
}
|
|
}
|
|
if userConting.WorkWechatId != "" {
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WorkWechatId)
|
|
if userWechatErr == true {
|
|
htalConListStrCon.Type = 3
|
|
htalConListStrCon.Value = userWechat.Name
|
|
htalConListStrCon.UserId = userConting.WorkWechatId
|
|
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
}
|
|
}
|
|
}
|
|
htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
|
|
sendTextMsg.TemplateCard.CardAction.Type = 1
|
|
sendTextMsg.TemplateCard.CardAction.Url = handleUrl
|
|
|
|
if msgTxt == "" {
|
|
msgTxt = "请前往处理"
|
|
}
|
|
//地板处理
|
|
var jumpListStruct JumpListType
|
|
jumpListStruct.Type = 1
|
|
jumpListStruct.Title = msgTxt
|
|
jumpListStruct.Url = handleUrl
|
|
sendTextMsg.TemplateCard.JumpList = append(sendTextMsg.TemplateCard.JumpList, jumpListStruct)
|
|
|
|
callbakcMsg, isTrueCall, callBackCont = sendTextMsg.SendMessage("school")
|
|
return
|
|
}
|
|
|
|
/*
|
|
发送按钮交互
|
|
@sendUserList 接收信息人员
|
|
@Title 一级标题,建议不超过36个字
|
|
@Desc 标题辅助信息,建议不超过44个字
|
|
@subtitle 二级文献标题
|
|
@reason 二级文献内容
|
|
@Type 1:加分;2:减分
|
|
@departmentId 执行考核部门
|
|
@userKey 执行考核人
|
|
@keyNumber 任务卡ID
|
|
*/
|
|
func SendButtonPublic(sendUserList, Title, Desc, subtitle, reason string, departmentId, userKey, keyNumber int64, buttonMap []ButtonListtype) (callbakcMsg []byte, isTrueCall bool, callBackCont string, send ButtonNoticeTemplateMedium) {
|
|
var sendTextMsg ButtonNoticeTemplateMedium
|
|
sendTextMsg.Inset(sendUserList, "template_card", "button_interaction", keyNumber)
|
|
|
|
//获取考核详情
|
|
sendTextMsg.TemplateCard.MainTitle.Title = Title
|
|
sendTextMsg.TemplateCard.MainTitle.Desc = Desc
|
|
|
|
//引用文献样式
|
|
sendTextMsg.TemplateCard.QuoteArea.Type = 0
|
|
sendTextMsg.TemplateCard.QuoteArea.Title = subtitle
|
|
sendTextMsg.TemplateCard.QuoteArea.QuoteText = reason
|
|
|
|
var htalConListStrMap []HorizontalContentListType
|
|
var htalConListStrCon HorizontalContentListType
|
|
//二级普通文本,
|
|
sendTextMsg.TemplateCard.SubTitleText = "责任部门:"
|
|
execDerpatCont := ""
|
|
// execDerpatCont := "考核部门:"
|
|
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId)
|
|
if execDerpatErr == true {
|
|
execDerpatCont = execDerpatCont + execDerpat.Name
|
|
}
|
|
htalConListStrCon.KeyName = execDerpatCont
|
|
//获取操作人
|
|
userFileStr := "wm_number,qywx_key,wx_key"
|
|
//操作人条件
|
|
userWherAry := commonus.MapOut()
|
|
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|
userWherAry["wm_key"] = userKey
|
|
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry)
|
|
if userIsTrue == true {
|
|
|
|
if userConting.WechatId != "" {
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WechatId)
|
|
if userWechatErr == true {
|
|
htalConListStrCon.Type = 3
|
|
htalConListStrCon.Value = userWechat.Name
|
|
htalConListStrCon.UserId = userConting.WechatId
|
|
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
}
|
|
}
|
|
if userConting.WorkWechatId != "" {
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WorkWechatId)
|
|
if userWechatErr == true {
|
|
htalConListStrCon.Type = 3
|
|
htalConListStrCon.Value = userWechat.Name
|
|
htalConListStrCon.UserId = userConting.WorkWechatId
|
|
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
}
|
|
}
|
|
}
|
|
htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
|
|
sendTextMsg.TemplateCard.CardAction.Type = 1
|
|
sendTextMsg.TemplateCard.CardAction.Url = "http://www.hxgk.group"
|
|
//按钮列表,列表长度不超过6(必填)
|
|
sendTextMsg.TemplateCard.ButtonList = buttonMap
|
|
send = sendTextMsg
|
|
callbakcMsg, isTrueCall, callBackCont = sendTextMsg.SendMessage("school")
|
|
return
|
|
}
|
|
|
|
/*
|
|
发送文本任务卡
|
|
@sendUserList 接收信息人员
|
|
@Title 一级标题,建议不超过36个字
|
|
@Desc 标题辅助信息,建议不超过44个字
|
|
@Unit 考核计量单位
|
|
@Reason 二级文本标题
|
|
@handleUrl 访问Key
|
|
@Type 1:加分;2:减分
|
|
@departmentId 执行考核部门
|
|
@userKey 执行考核人
|
|
@Score 考核分值
|
|
@keyNumber 任务卡ID
|
|
@scoreReason 二级文本描述
|
|
@subTitleText 下级 组件标题"考核上报部门:"
|
|
*/
|
|
func SendMsgTxtPublic(sendUserList, Title, Desc, Unit, Reason, handleUrl, scoreReason, subTitleText string, Type int, departmentId, userKey, Score, keyNumber int64, msgTxt string) (callbakcMsg []byte, isTrueCall bool, callBackCont string, sendTextMsg TextNoticeTemplateMedium) {
|
|
// var sendTextMsg TextNoticeTemplateMedium
|
|
sendTextMsg.Inset(sendUserList, "template_card", "text_notice", keyNumber)
|
|
|
|
//获取考核详情
|
|
sendTextMsg.TemplateCard.MainTitle.Title = Title
|
|
sendTextMsg.TemplateCard.MainTitle.Desc = Desc
|
|
|
|
//引用文献样式
|
|
sendTextMsg.TemplateCard.QuoteArea.Type = 0
|
|
sendTextMsg.TemplateCard.QuoteArea.Title = scoreReason
|
|
sendTextMsg.TemplateCard.QuoteArea.QuoteText = Reason
|
|
|
|
var htalConListStrMap []HorizontalContentListType
|
|
var htalConListStrCon HorizontalContentListType
|
|
//二级普通文本,
|
|
sendTextMsg.TemplateCard.SubTitleText = subTitleText
|
|
execDerpatCont := ""
|
|
// execDerpatCont := "考核部门:"
|
|
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId)
|
|
if execDerpatErr == true {
|
|
execDerpatCont = execDerpatCont + execDerpat.Name
|
|
}
|
|
htalConListStrCon.KeyName = execDerpatCont
|
|
//获取操作人
|
|
userFileStr := "wm_number,qywx_key,wx_key"
|
|
//操作人条件
|
|
userWherAry := commonus.MapOut()
|
|
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|
userWherAry["wm_key"] = userKey
|
|
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry)
|
|
if userIsTrue == true {
|
|
|
|
if userConting.WechatId != "" {
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WechatId)
|
|
if userWechatErr == true {
|
|
htalConListStrCon.Type = 3
|
|
htalConListStrCon.Value = userWechat.Name
|
|
htalConListStrCon.UserId = userConting.WechatId
|
|
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
}
|
|
}
|
|
if userConting.WorkWechatId != "" {
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WorkWechatId)
|
|
if userWechatErr == true {
|
|
htalConListStrCon.Type = 3
|
|
htalConListStrCon.Value = userWechat.Name
|
|
htalConListStrCon.UserId = userConting.WorkWechatId
|
|
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
}
|
|
}
|
|
}
|
|
htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|
sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|
|
|
sendTextMsg.TemplateCard.CardAction.Type = 1
|
|
sendTextMsg.TemplateCard.CardAction.Url = handleUrl
|
|
|
|
if msgTxt == "" {
|
|
msgTxt = "请前往处理"
|
|
}
|
|
//地板处理
|
|
var jumpListStruct JumpListType
|
|
jumpListStruct.Type = 1
|
|
jumpListStruct.Title = msgTxt
|
|
jumpListStruct.Url = handleUrl
|
|
sendTextMsg.TemplateCard.JumpList = append(sendTextMsg.TemplateCard.JumpList, jumpListStruct)
|
|
|
|
callbakcMsg, isTrueCall, callBackCont = sendTextMsg.SendMessage("school")
|
|
return
|
|
}
|
|
|