liuxiaolong
2020-08-06 dbc843d0b37f786fb816131bcc7ebca86dbe72e9
service/msgPush.go
@@ -66,6 +66,7 @@
      return false, errors.New("token is nil")
   }
   url := baseUrl+"/push/all"
   intent := "intent:#Intent;action=android.intent.action.oppopush;launchFlags=0x14000000;component=uni.UNIEDF0B5C/io.dcloud.PandoraEntry;S.UP-OL-SU=true;S.title="+title+";S.content="+msg+";S.payload=test;end"
   reqBody := map[string]interface{} {
      "request_id": time.Now().Format("20060102150405") + util.GenValidateCode(6),
      "settings":map[string]int {
@@ -76,8 +77,20 @@
         "notification": {
            "title": title,
            "body": msg,
            "click_type": "url",
            "url": "http://baidu.com",
            "click_type": "intent",
            "intent": intent,
         },
      },
      "push_channel": map[string]map[string]map[string]map[string]string {
         "android": {
            "ups": {
               "notification": {
                  "title": title,
                  "body": msg,
                  "click_type": "intent",
                  "intent": intent,
               },
            },
         },
      },
   }
@@ -114,14 +127,10 @@
}
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)