| | |
| | | } |
| | | url := baseUrl+"/push/list/message" |
| | | 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" |
| | | androidPush := map[string]map[string]map[string]string { |
| | | "ups": { |
| | | "notification": { |
| | | "title": title, |
| | | "body": msg, |
| | | "click_type": "intent", |
| | | "intent": intent, |
| | | }, |
| | | }, |
| | | } |
| | | iosPush := map[string]interface{}{ |
| | | "type":"notify", |
| | | "payload":"育英中学停车", |
| | | "aps":map[string]interface{}{ |
| | | "alert":map[string]string{ |
| | | "title": title, |
| | | "body": msg, |
| | | }, |
| | | "content-available":0, |
| | | }, |
| | | } |
| | | reqBody := map[string]interface{} { |
| | | "request_id": time.Now().Format("20060102150405") + util.GenValidateCode(6), |
| | | "settings":map[string]int { |
| | |
| | | "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, |
| | | }, |
| | | }, |
| | | }, |
| | | "push_channel": map[string]interface{} { |
| | | "android": androidPush, |
| | | "ios":iosPush, |
| | | }, |
| | | } |
| | | header := map[string]string { |
| | |
| | | } |
| | | lenAS := len(aliasArr) |
| | | if lenAS == 0 { |
| | | return false, errors.New("aliasArr is empty"),aliasArr |
| | | return false, errors.New("没有推送目标,aliasArr is empty"),aliasArr |
| | | } |
| | | if isTest { |
| | | //只给内部手机号推 |
| | |
| | | } |
| | | } |
| | | if len(pushUserM) == 0 { |
| | | return true,nil, aliasArr |
| | | return false, errors.New("len(pushUserM) == 0"), aliasArr |
| | | } |
| | | carPersonM := make(map[string]string) |
| | | csv := NewCarService() |
| | |
| | | |
| | | if len(aliasArr) == 0 { |
| | | fmt.Println("没有推送目标,aliasArr is empty") |
| | | return true, nil, aliasArr |
| | | return false, errors.New("没有推送目标,aliasArr is empty"), aliasArr |
| | | } |
| | | |
| | | cResult, taskId, ce := createPushMsg(title, msg) |
| | |
| | | return b,e, aliasArr |
| | | } |
| | | |
| | | /* |
| | | func PushAll(title string, msg string) (bool,error) { |
| | | appId := beego.AppConfig.String("pushAppId") |
| | | baseUrl := beego.AppConfig.String("pushBaseUrl") + appId |
| | |
| | | } |
| | | |
| | | return false, errors.New("推送失败") |
| | | } |
| | | }*/ |
| | | |
| | | func RefreshToken() (*TokenResult,error) { |
| | | appId := beego.AppConfig.String("pushAppId") |