39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package handlers
|
|
|
|
import (
|
|
"context"
|
|
|
|
"lone-services/pkg/utils"
|
|
"lone-services/pkg/wecom/message"
|
|
"lone-services/services/wecom/internal/dao"
|
|
"lone-services/services/wecom/internal/logic/message/builder"
|
|
msgutil "lone-services/services/wecom/internal/logic/message/utils"
|
|
)
|
|
|
|
type AddressNotifySubmitHandler struct{}
|
|
|
|
func (h AddressNotifySubmitHandler) Build(ctx context.Context, job dao.WeComJob) ([]*message.SendRequest, error) {
|
|
change, err := msgutil.GetLatestReviewChange(job.BizType, int64(job.BizId))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
content := msgutil.BuildContent(
|
|
struct{ Key, Value string }{"门店名称", getTypeNameFromContent(msgutil.DiffContent(change))},
|
|
struct{ Key, Value string }{"提醒消息", "您有一个地址需要审核"},
|
|
)
|
|
|
|
card := builder.TextCardParams{
|
|
ToUser: utils.GetConfigString("wecom.address_notify_first_ids"),
|
|
Desc: "地址通知",
|
|
Title: "地址审核通知",
|
|
Content: content,
|
|
}
|
|
|
|
req, err := builder.TextCard(card)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return []*message.SendRequest{req}, nil
|
|
}
|