50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
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
|
|
}
|