Commit 1ae63cd0 authored by kzkzzzz's avatar kzkzzzz

feat: 调整

parent 5205d2de
package hashutil
import "encoding/base64"
func Base64Decode(src string) string {
res, _ := base64.StdEncoding.DecodeString(src)
return string(res)
}
......@@ -8,7 +8,7 @@ Server:
Addr: ""
Mysql:
dsn: remote:admin666@tcp(127.0.0.1:3306)/test?loc=Local&charset=utf8mb4&writeTimeout=3s&readTimeout=3s&timeout=1s&parseTime=true
Dsn: remote:admin666@tcp(127.0.0.1:3306)/test?loc=Local&charset=utf8mb4&writeTimeout=3s&readTimeout=3s&timeout=1s&parseTime=true
MaxConn: 8
MaxIdleConn: 2
MaxLifetime: 1800 # 连接有效时间,单位秒
......
......@@ -22,7 +22,7 @@ func (h *handler) GetDemo(ctx context.Context, req *demo.DemoReq, resp *demo.Dem
if err != nil {
return err
}
*resp = h.convertUserModel(getDemo)
*resp = *h.convertUserModel(getDemo)
return nil
}
......@@ -38,7 +38,7 @@ func (h *handler) ListDemo(ctx context.Context, req *demo.ListDemoReq, resp *dem
list := make([]*demo.DemoResp, 0)
for _, v := range listDemo {
c := h.convertUserModel(v)
c := *h.convertUserModel(v)
list = append(list, &c)
}
resp.List = list
......@@ -46,8 +46,8 @@ func (h *handler) ListDemo(ctx context.Context, req *demo.ListDemoReq, resp *dem
return nil
}
func (h *handler) convertUserModel(users *model.User) (resp demo.DemoResp) {
return demo.DemoResp{
func (h *handler) convertUserModel(users *model.User) (resp *demo.DemoResp) {
r := &demo.DemoResp{
Id: cast.ToString(users.Id),
Username: users.Username,
Email: users.Email,
......@@ -56,4 +56,5 @@ func (h *handler) convertUserModel(users *model.User) (resp demo.DemoResp) {
CreatedAt: timestamppb.New(users.CreatedAt),
UpdatedAt: timestamppb.New(users.UpdatedAt),
}
return r
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment