feat: wecom message init
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"base-service/app/dao"
|
||||
"base-service/app/models"
|
||||
"base-service/app/services/wecom/message/builder"
|
||||
util "base-service/app/services/wecom/message/utils"
|
||||
"base-service/pkg/wecom/message"
|
||||
"base-service/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type AddressNotifyFirstHandler struct {
|
||||
}
|
||||
|
||||
func (h AddressNotifyFirstHandler) Build(job dao.WeComJob) ([]*message.SendRequest, error) {
|
||||
|
||||
logInfo := dao.EditLogInfo{}
|
||||
|
||||
models.EditLogModel{}.Init().GetOne(models.Params{
|
||||
Eq: map[string]string{
|
||||
"obj_id": strconv.Itoa(job.ObjId),
|
||||
"obj_type": strconv.Itoa(int(job.ObjType)),
|
||||
},
|
||||
Order: "id desc",
|
||||
}, &logInfo)
|
||||
|
||||
content := util.BuildContent(
|
||||
struct{ Key, Value string }{"门店名称", getTypeNameFromContent(logInfo.Content)},
|
||||
struct{ Key, Value string }{"提醒消息", "您有一个地址需要审核"},
|
||||
)
|
||||
|
||||
crad := builder.TextCardParams{
|
||||
ToUser: utils.GetConfigString("wecom.address_notify_second_ids"),
|
||||
Desc: "地址通知",
|
||||
Title: "地址审核通知",
|
||||
Content: content,
|
||||
}
|
||||
|
||||
req, err := builder.TextCard(crad)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return []*message.SendRequest{
|
||||
req,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user