|
@@ -1,26 +1,29 @@
|
|
|
package common
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
+ "fmt"
|
|
|
+ "log"
|
|
|
+ "net/url"
|
|
|
+ "regexp"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
+
|
|
|
"app.yhyue.com/moapp/MessageCenter/entity"
|
|
|
"app.yhyue.com/moapp/MessageCenter/rpc/internal/config"
|
|
|
+ "app.yhyue.com/moapp/MessageCenter/rpc/type/message"
|
|
|
"app.yhyue.com/moapp/MessageCenter/util"
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
dataFormat "app.yhyue.com/moapp/jybase/date"
|
|
|
m "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
|
qrpc "app.yhyue.com/moapp/jybase/rpc"
|
|
|
- "encoding/json"
|
|
|
- "fmt"
|
|
|
- "log"
|
|
|
- "net/url"
|
|
|
- "regexp"
|
|
|
- "strings"
|
|
|
- "time"
|
|
|
)
|
|
|
|
|
|
type WxTmplPush struct {
|
|
|
MgoId, OpenId, Position, OpushId, JpushId, AppPoneType string //UserId 用户mgoId, OpenId 微信id, Position 职位id
|
|
|
Config *WxTmplConfig
|
|
|
+ CustomWxTpl *message.CustomWxTpl
|
|
|
}
|
|
|
|
|
|
var AllMsgType func() map[int64]WxTmplConfig
|
|
@@ -90,12 +93,24 @@ func (stm *WxTmplPush) SendMsg(link, title, detail, date, row4 string) error {
|
|
|
if err := stm.getUserOpenIdAndWxPushState(); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- // 获取消息
|
|
|
- msg, err := stm.getMessage(title, detail, date, row4)
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
+ var msg map[string]*qrpc.TmplItem
|
|
|
+ if stm.CustomWxTpl != nil && stm.CustomWxTpl.TplId != "" {
|
|
|
+ stm.Config.TmplId = stm.CustomWxTpl.TplId
|
|
|
+ msg = map[string]*qrpc.TmplItem{}
|
|
|
+ for k, v := range stm.CustomWxTpl.TmplData {
|
|
|
+ msg[k] = &qrpc.TmplItem{
|
|
|
+ Value: v.Value,
|
|
|
+ Color: v.Color,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 获取消息
|
|
|
+ msgTemp, err := stm.getMessage(title, detail, date, row4)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ msg = msgTemp
|
|
|
}
|
|
|
-
|
|
|
// 校验发送量及频率
|
|
|
err, noteFunc := stm.IncrCount()
|
|
|
if err != nil {
|