1
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package uinapp
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type SendMsgRes struct {
|
||||
@@ -16,13 +19,16 @@ type SendMsgRes struct {
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func (a *API) SendMsgByUinApp(parma SendMsgReq) error {
|
||||
func (a *API) SendMsgByUinApp(parma map[string]interface{}) error {
|
||||
if err := a.CheckTokenIsExpire(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
result, err := a.AccessAPI(BaseUrl+a.appId, PushMsgByCid, http.MethodPost, utils.Struct2MapByJson(parma))
|
||||
if err != nil {
|
||||
data, _ := json.Marshal(parma)
|
||||
fmt.Println(string(data))
|
||||
result, err := a.AccessAPI(BaseUrl+a.appId, PushMsgByCid, http.MethodPost, parma)
|
||||
fmt.Println(err.Error())
|
||||
if err != nil && !strings.Contains(err.Error(), "success") {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -30,7 +36,7 @@ func (a *API) SendMsgByUinApp(parma SendMsgReq) error {
|
||||
if err := utils.Map2StructByJson(result, &sendMsgRes, false); err != nil {
|
||||
return err
|
||||
}
|
||||
if sendMsgRes.Code != 200 {
|
||||
if sendMsgRes.Code != 0 {
|
||||
return errors.New(sendMsgRes.Msg)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user