|
@@ -4,6 +4,7 @@ import (
|
|
|
"fmt"
|
|
|
"html/template"
|
|
|
. "qfw/coreconfig"
|
|
|
+ "qfw/coreutil"
|
|
|
"qfw/jgpush"
|
|
|
"qfw/util"
|
|
|
. "qfw/util/mongodb"
|
|
@@ -184,13 +185,13 @@ func sendMes(id, title, subtitle, url, pic string) error {
|
|
|
if mos != nil && util.ObjToString(mos) != "" {
|
|
|
openids := strings.Split(util.ObjToString(mos), ",")
|
|
|
for _, v := range openids {
|
|
|
- userData := FindOneByField("user", `{"s_m_openid":"`+v+`"}`, `{"s_m_openid":1,"s_jpushid":1,"s_province":1,"s_city":1,"s_nickname":1}`)
|
|
|
+ userData := FindOneByField("user", `{"s_m_openid":"`+v+`"}`, `{"s_m_openid":1,"s_jpushid":1,"s_province":1,"s_city":1,"s_nickname":1,"s_appponetype":1}`)
|
|
|
if userData != nil && len(*userData) > 0 {
|
|
|
userDatas = append(userDatas, *userData)
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- userDatas = *Find("user", `{"i_type":{"$in": [1,2]}}`, `{"l_registedate":-1}`, `{"s_m_openid":1,"s_jpushid":1,"s_province":1,"s_city":1,"s_nickname":1}`, false, -1, -1)
|
|
|
+ userDatas = *Find("user", `{"i_type":{"$in": [1,2]}}`, `{"l_registedate":-1}`, `{"s_m_openid":1,"s_jpushid":1,"s_province":1,"s_city":1,"s_nickname":1,"s_appponetype":1}`, false, -1, -1)
|
|
|
}
|
|
|
var total = 0
|
|
|
for _, v := range userDatas {
|
|
@@ -199,6 +200,7 @@ func sendMes(id, title, subtitle, url, pic string) error {
|
|
|
province := util.ObjToString(v["s_province"])
|
|
|
city := util.ObjToString(v["s_city"])
|
|
|
nickname := util.ObjToString(v["s_nickname"])
|
|
|
+ ponetype := util.ObjToString(v["s_appponetype"])
|
|
|
if jpushid != "" && openid != "" && id != "" {
|
|
|
total = total + 1
|
|
|
go ca.SaveCache("jy_message", map[string]interface{}{
|
|
@@ -214,13 +216,26 @@ func sendMes(id, title, subtitle, url, pic string) error {
|
|
|
"date": time.Now().Unix(),
|
|
|
"url": url,
|
|
|
})
|
|
|
- jgpush.JgpushNc(subtitle, "message", []string{jpushid}, map[string]interface{}{
|
|
|
- "url": url + "==" + id,
|
|
|
- "openid": openid,
|
|
|
- "title": title,
|
|
|
- "type": "message",
|
|
|
- "content": pic,
|
|
|
- }, false)
|
|
|
+ if ponetype == "HUAWEI" {
|
|
|
+ coreutil.AppPushServiceCall(map[string]interface{}{
|
|
|
+ "phoneType": "HUAWEI",
|
|
|
+ "deviceToken": jpushid,
|
|
|
+ "url": url + "==" + id,
|
|
|
+ "openid": openid,
|
|
|
+ "title": title,
|
|
|
+ "type": "message",
|
|
|
+ "content": subtitle,
|
|
|
+ "descript": pic,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ jgpush.JgpushNc(subtitle, "message", []string{jpushid}, map[string]interface{}{
|
|
|
+ "url": url + "==" + id,
|
|
|
+ "openid": openid,
|
|
|
+ "title": title,
|
|
|
+ "type": "message",
|
|
|
+ "content": pic,
|
|
|
+ }, false)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
go Update("message_app", map[string]interface{}{"_id": bson.ObjectIdHex(id)}, map[string]interface{}{"$set": map[string]interface{}{"i_total": total}}, false, false)
|