liuxiaolong
2020-06-29 6b1fb57ec1736c5433ad66c310d2797d9870cdcd
service/msgPush.go
@@ -72,11 +72,25 @@
         "ttl": 8 * 3600 * 1000,
      },
      "audience": "all",
      "push_message": map[string]string{
         "title": title,
         "body": msg,
         "click_type": "url",
         "url": "http://baidu.com",
      "push_message": map[string]map[string]string {
         "notification": {
            "title": title,
            "body": msg,
            "click_type": "url",
            "url": "http://baidu.com",
         },
      },
      "push_channel": map[string]map[string]map[string]map[string]string {
         "android": {
            "ups": {
               "notification": {
                  "title": title,
                  "body": msg,
                  "click_type": "url",
                  "url": "http://baidu.com",
               },
            },
         },
      },
   }
   header := map[string]string {
@@ -104,21 +118,18 @@
            goto ReTry
         }
      }
   } else {
      fmt.Println("推送结果:", result)
   }
   return false, errors.New("推送失败")
}
func RefreshToken() (*TokenResult,error) {
   //appId := beego.AppConfig.String("pushAppId")
   //appKey := beego.AppConfig.String("pushAppKey")
   //masterSecret := beego.AppConfig.String("pushMasterSecret")
   //baseUrl := beego.AppConfig.String("pushBaseUrl") + appId
   appId := "WU8KzZBaTwADIjTwaMSzW5"
   appKey := "9JLs4B1ZVkAVh93JXX3MP4"
   masterSecret := "IbSAe83ZoZAczhKSA3Bwj9"
   baseUrl := "https://restapi.getui.com/v2/"+appId
   appId := beego.AppConfig.String("pushAppId")
   appKey := beego.AppConfig.String("pushAppKey")
   masterSecret := beego.AppConfig.String("pushMasterSecret")
   baseUrl := beego.AppConfig.String("pushBaseUrl") + appId
   url := baseUrl +"/auth"
   timestamp := fmt.Sprintf("%v", time.Now().UnixNano() / 1e6)
   sign := util.Sha256(appKey + timestamp + masterSecret)