mirror of https://github.com/usual2970/certimate
fix: #626
parent
c10ceed753
commit
32ff658e84
|
@ -1,6 +1,6 @@
|
||||||
package cdnflysdk
|
package cdnflysdk
|
||||||
|
|
||||||
import "encoding/json"
|
import "fmt"
|
||||||
|
|
||||||
type BaseResponse interface {
|
type BaseResponse interface {
|
||||||
GetCode() string
|
GetCode() string
|
||||||
|
@ -8,12 +8,24 @@ type BaseResponse interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type baseResponse struct {
|
type baseResponse struct {
|
||||||
Code json.Number `json:"code"`
|
Code any `json:"code"`
|
||||||
Message string `json:"msg"`
|
Message string `json:"msg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *baseResponse) GetCode() string {
|
func (r *baseResponse) GetCode() string {
|
||||||
return r.Code.String()
|
if r.Code == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if code, ok := r.Code.(int); ok {
|
||||||
|
return fmt.Sprintf("%d", code)
|
||||||
|
}
|
||||||
|
|
||||||
|
if code, ok := r.Code.(string); ok {
|
||||||
|
return code
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *baseResponse) GetMessage() string {
|
func (r *baseResponse) GetMessage() string {
|
||||||
|
|
Loading…
Reference in New Issue