|
|
@ -75,6 +75,7 @@ func newGetuiClient() *Getui {
|
|
|
|
|
|
|
|
|
|
|
|
func (g *Getui) Push(userIDList []string, alert, detailContent, platform, operationID string) (resp string, err error) {
|
|
|
|
func (g *Getui) Push(userIDList []string, alert, detailContent, platform, operationID string) (resp string, err error) {
|
|
|
|
token, err := db.DB.GetGetuiToken()
|
|
|
|
token, err := db.DB.GetGetuiToken()
|
|
|
|
|
|
|
|
log.NewDebug(operationID, utils.GetSelfFuncName(), "token:", token)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.NewError(operationID, utils.OperationIDGenerator(), "GetGetuiToken failed", err.Error())
|
|
|
|
log.NewError(operationID, utils.OperationIDGenerator(), "GetGetuiToken failed", err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -83,7 +84,7 @@ func (g *Getui) Push(userIDList []string, alert, detailContent, platform, operat
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", utils.Wrap(err, "Auth failed")
|
|
|
|
return "", utils.Wrap(err, "Auth failed")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log.NewInfo(operationID, "getui", utils.GetSelfFuncName(), token, expireTime, err)
|
|
|
|
log.NewDebug(operationID, "getui", utils.GetSelfFuncName(), token, expireTime, err)
|
|
|
|
err = db.DB.SetGetuiToken(token, 60*60*23)
|
|
|
|
err = db.DB.SetGetuiToken(token, 60*60*23)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", utils.Wrap(err, "Auth failed")
|
|
|
|
return "", utils.Wrap(err, "Auth failed")
|
|
|
@ -148,7 +149,7 @@ func (g *Getui) request(url string, content interface{}, token string, returnStr
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if token != "" {
|
|
|
|
if token != "" {
|
|
|
|
req.Header.Set(token, token)
|
|
|
|
req.Header.Set("token", token)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req.Header.Set("content-type", "application/json")
|
|
|
|
req.Header.Set("content-type", "application/json")
|
|
|
|
resp, err := client.Do(req)
|
|
|
|
resp, err := client.Do(req)
|
|
|
|