Compare commits

..

No commits in common. 'master' and 'v1.0.0' have entirely different histories.

@ -22,7 +22,6 @@ type Config struct {
AccountId uint // 账号id AccountId uint // 账号id
AccessKey string // accessKey AccessKey string // accessKey
SecretKey string // secretKey SecretKey string // secretKey
TopicPrefix string // topic前缀
RefreshTokenCallback func(token *Bearer) RefreshTokenCallback func(token *Bearer)
} }
@ -34,5 +33,6 @@ type Bearer struct {
UID string `json:"uid"` UID string `json:"uid"`
Time int64 `json:"time"` Time int64 `json:"time"`
TokenType string `json:"token_type"` TokenType string `json:"token_type"`
Code uint `json:"code"`
Xid string `json:"xid"` Xid string `json:"xid"`
} }

@ -67,13 +67,13 @@ func exec(action string, data string, result interface{}) error {
respErr := RespErr{} respErr := RespErr{}
json.Unmarshal(bytes, &respErr) json.Unmarshal(bytes, &respErr)
if respErr.ErrorResponse.Code != "" { if respErr.ErrorResponse.Code != "" {
//if respErr.ErrorResponse.Code == "19" && config.SdkConfig.RefreshTokenCallback != nil { if respErr.ErrorResponse.Code == "19" && config.SdkConfig.RefreshTokenCallback != nil {
// token, err := RefreshToken() token, err := RefreshToken()
// if err != nil { if err != nil {
// return err return err
// } }
// config.SdkConfig.RefreshTokenCallback(token) config.SdkConfig.RefreshTokenCallback(token)
//} }
return errors.New(respErr.ErrorResponse.ZhDesc) return errors.New(respErr.ErrorResponse.ZhDesc)
} }
mResp := map[string]resp{} mResp := map[string]resp{}
@ -228,7 +228,7 @@ func (m *Message) ack(ackAction string) error {
// ExecMq @Title 调用mq // ExecMq @Title 调用mq
func ExecMq(action string) (Message, error) { func ExecMq(action string) (Message, error) {
data := map[string]string{ data := map[string]string{
"topic": fmt.Sprintf("%sopen_message_ct_%s_%s", config.SdkConfig.TopicPrefix, action, config.SdkConfig.AppKey), "topic": fmt.Sprintf("open_message_ct_%s_%s", action, config.SdkConfig.AppKey),
"consumerGroupId": fmt.Sprintf("open_message_%d", config.SdkConfig.AccountId), "consumerGroupId": fmt.Sprintf("open_message_%d", config.SdkConfig.AccountId),
} }
value := url.Values{} value := url.Values{}
@ -291,7 +291,6 @@ func RefreshToken() (*config.Bearer, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.Println(string(data))
var b config.Bearer var b config.Bearer
if err = json.Unmarshal(data, &b); err != nil { if err = json.Unmarshal(data, &b); err != nil {
return nil, err return nil, err

Loading…
Cancel
Save