fix: issues

This commit is contained in:
Rogee
2024-12-08 13:31:39 +08:00
parent 25df094481
commit d44e8e1121
8 changed files with 111 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"encoding/json"
"testing"
"backend/common/service/model"
@@ -32,3 +33,33 @@ func Test_GenModel2(t *testing.T) {
t.Logf("%+v", oauthInfo)
}
type Response struct {
ErrCode int `json:"errcode"`
}
func (r *Response) Error() error {
return nil
}
type Access struct {
Response
AccessToken string `json:"access_token"`
}
func Test_Data(t *testing.T) {
data := &Access{
Response: Response{
ErrCode: 0,
},
AccessToken: "123",
}
b, err := json.Marshal(data)
if err != nil {
t.Fatal(err)
}
data.Error()
t.Logf("%s", b)
}