|
@@ -11,6 +11,7 @@ import (
|
|
qrpc "app.yhyue.com/moapp/jybase/rpc"
|
|
qrpc "app.yhyue.com/moapp/jybase/rpc"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "log"
|
|
"net/url"
|
|
"net/url"
|
|
"regexp"
|
|
"regexp"
|
|
"strings"
|
|
"strings"
|
|
@@ -24,6 +25,7 @@ type WxTmplPush struct {
|
|
|
|
|
|
var AllMsgType func() map[int64]WxTmplConfig
|
|
var AllMsgType func() map[int64]WxTmplConfig
|
|
var allMsgValueKeys = []string{"$class", "$title", "$detail", "$date", "$row4", "$note"}
|
|
var allMsgValueKeys = []string{"$class", "$title", "$detail", "$date", "$row4", "$note"}
|
|
|
|
+var AppPushMsgType map[int]string
|
|
|
|
|
|
type WxTmplConfig struct {
|
|
type WxTmplConfig struct {
|
|
Name string //信息名称
|
|
Name string //信息名称
|
|
@@ -38,8 +40,15 @@ func MessageType() (func() map[int64]WxTmplConfig, []map[string]interface{}) {
|
|
var data []map[string]interface{}
|
|
var data []map[string]interface{}
|
|
rData1 := entity.Mysql.SelectBySql(`SELECT * FROM message_group ORDER BY sequence ASC`)
|
|
rData1 := entity.Mysql.SelectBySql(`SELECT * FROM message_group ORDER BY sequence ASC`)
|
|
switchName := map[int64]WxTmplConfig{}
|
|
switchName := map[int64]WxTmplConfig{}
|
|
|
|
+ appMsgType := map[int]string{}
|
|
if rData1 != nil && len(*rData1) > 0 {
|
|
if rData1 != nil && len(*rData1) > 0 {
|
|
data = *rData1
|
|
data = *rData1
|
|
|
|
+ for _, v := range *rData1 {
|
|
|
|
+ groupId := util.IntAll(v["group_id"])
|
|
|
|
+ switchs := util.ObjToString(v["switch"])
|
|
|
|
+ appMsgType[groupId] = switchs
|
|
|
|
+ }
|
|
|
|
+ AppPushMsgType = appMsgType
|
|
}
|
|
}
|
|
|
|
|
|
rData2 := entity.Mysql.SelectBySql(`SELECT g.switch,c.wxtmpl_Id,c.msg_type,c.msg_name,c.wxtmp_value FROM message_class c INNER JOIN message_group g on c.group_id =g.group_id WHERE c.wxtmpl_Id IS NOT NULL`)
|
|
rData2 := entity.Mysql.SelectBySql(`SELECT g.switch,c.wxtmpl_Id,c.msg_type,c.msg_name,c.wxtmp_value FROM message_class c INNER JOIN message_group g on c.group_id =g.group_id WHERE c.wxtmpl_Id IS NOT NULL`)
|
|
@@ -195,6 +204,7 @@ func (stm *WxTmplPush) getUserOpenIdAndWxPushState() error {
|
|
if stm.OpenId == "" {
|
|
if stm.OpenId == "" {
|
|
return fmt.Errorf("未查询到用户微信信息")
|
|
return fmt.Errorf("未查询到用户微信信息")
|
|
}
|
|
}
|
|
|
|
+ log.Println("======", stm.Config.Switch)
|
|
if pushSetMap := common.ObjToMap(uData["o_pushset"]); pushSetMap != nil && len(*pushSetMap) > 0 {
|
|
if pushSetMap := common.ObjToMap(uData["o_pushset"]); pushSetMap != nil && len(*pushSetMap) > 0 {
|
|
if pushKeyMap := common.ObjToMap((*pushSetMap)[stm.Config.Switch]); pushKeyMap != nil && len(*pushKeyMap) > 0 {
|
|
if pushKeyMap := common.ObjToMap((*pushSetMap)[stm.Config.Switch]); pushKeyMap != nil && len(*pushKeyMap) > 0 {
|
|
if common.Int64All((*pushKeyMap)["i_wxpush"]) == 1 {
|
|
if common.Int64All((*pushKeyMap)["i_wxpush"]) == 1 {
|
|
@@ -228,9 +238,7 @@ func (stm *WxTmplPush) GetUserPushInfo() map[string]interface{} {
|
|
}
|
|
}
|
|
return nil
|
|
return nil
|
|
}()
|
|
}()
|
|
- if uData != nil {
|
|
|
|
|
|
|
|
- }
|
|
|
|
return uData
|
|
return uData
|
|
}
|
|
}
|
|
|
|
|