|
@@ -62,6 +62,7 @@ type Login struct {
|
|
|
brand xweb.Mapper `xweb:"/jyapp/free/message/brand"` //设置手机类型和推送id
|
|
|
afterPageLoadToCheck xweb.Mapper `xweb:"/jyapp/free/afterPageLoadToCheck"` //检测
|
|
|
channelSign xweb.Mapper `xweb:"/jyapp/free/channelSign"` //渠道统计
|
|
|
+ savePushIdMsg xweb.Mapper `xweb:"/jyapp/free/savePushIdMsg"` //推送id记录
|
|
|
}
|
|
|
|
|
|
var (
|
|
@@ -1205,9 +1206,6 @@ func (l *Login) ChannelSign() {
|
|
|
result := false
|
|
|
channel := l.GetString("sign")
|
|
|
deviceId := l.GetString("id")
|
|
|
- phoneType := l.GetString("phoneType")
|
|
|
- rid := l.GetString("rid")
|
|
|
- oid := l.GetString("oid")
|
|
|
if channel != "" && deviceId != "" {
|
|
|
data := map[string]interface{}{
|
|
|
"s_deviceId": deviceId,
|
|
@@ -1216,14 +1214,39 @@ func (l *Login) ChannelSign() {
|
|
|
if mongodb.Count("jyapp_channel", data) == 0 {
|
|
|
data["i_cometime"] = time.Now().Unix()
|
|
|
data["s_channel"] = channel
|
|
|
- data["phoneType"] = phoneType
|
|
|
- data["rid"] = rid
|
|
|
- data["oid"] = oid
|
|
|
mongodb.Save("jyapp_channel", data)
|
|
|
}
|
|
|
result = true
|
|
|
}
|
|
|
- log.Printf("channel:%s deviceId:%s phoneType:%s rid:%s oid:%s\n", channel, deviceId, phoneType, rid, oid)
|
|
|
+ l.ServeJson(map[string]interface{}{
|
|
|
+ "success": result,
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func (l *Login) SavePushIdMsg() {
|
|
|
+ result := false
|
|
|
+ deviceId := l.GetString("id")
|
|
|
+ phoneType := l.GetString("phoneType")
|
|
|
+ rid := l.GetString("rid")
|
|
|
+ oid := l.GetString("oid")
|
|
|
+ if rid != "" && deviceId != "" {
|
|
|
+ data := map[string]interface{}{
|
|
|
+ "s_rid": rid,
|
|
|
+ }
|
|
|
+ if mongodb.Count("jyapp_pushId", data) == 0 {
|
|
|
+ data["i_cometime"] = time.Now().Unix()
|
|
|
+ data["s_oid"] = oid
|
|
|
+ data["phoneType"] = phoneType
|
|
|
+ data["s_deviceId"] = deviceId
|
|
|
+ mongodb.Save("jyapp_pushId", data)
|
|
|
+ } else {
|
|
|
+ mongodb.Update("jyapp_pushId", data, map[string]interface{}{"$set": map[string]interface{}{
|
|
|
+ "i_lastTime": time.Now().Unix(),
|
|
|
+ }}, false, true)
|
|
|
+ }
|
|
|
+ result = true
|
|
|
+ }
|
|
|
+ log.Printf("deviceId:%s phoneType:%s rid:%s oid:%s\n", deviceId, phoneType, rid, oid)
|
|
|
l.ServeJson(map[string]interface{}{
|
|
|
"success": result,
|
|
|
})
|