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: ...@@ -8,7 +8,7 @@ Server:
Addr: "" Addr: ""
Mysql: 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 MaxConn: 8
MaxIdleConn: 2 MaxIdleConn: 2
MaxLifetime: 1800 # 连接有效时间,单位秒 MaxLifetime: 1800 # 连接有效时间,单位秒
......
...@@ -22,7 +22,7 @@ func (h *handler) GetDemo(ctx context.Context, req *demo.DemoReq, resp *demo.Dem ...@@ -22,7 +22,7 @@ func (h *handler) GetDemo(ctx context.Context, req *demo.DemoReq, resp *demo.Dem
if err != nil { if err != nil {
return err return err
} }
*resp = h.convertUserModel(getDemo) *resp = *h.convertUserModel(getDemo)
return nil return nil
} }
...@@ -30,7 +30,7 @@ func (h *handler) ListDemo(ctx context.Context, req *demo.ListDemoReq, resp *dem ...@@ -30,7 +30,7 @@ func (h *handler) ListDemo(ctx context.Context, req *demo.ListDemoReq, resp *dem
if req.Limit <= 0 { if req.Limit <= 0 {
req.Limit = 15 req.Limit = 15
} }
listDemo, err := h.svc.ListDemo(ctx, req) listDemo, err := h.svc.ListDemo(ctx, req)
if err != nil { if err != nil {
return err return err
...@@ -38,7 +38,7 @@ func (h *handler) ListDemo(ctx context.Context, req *demo.ListDemoReq, resp *dem ...@@ -38,7 +38,7 @@ func (h *handler) ListDemo(ctx context.Context, req *demo.ListDemoReq, resp *dem
list := make([]*demo.DemoResp, 0) list := make([]*demo.DemoResp, 0)
for _, v := range listDemo { for _, v := range listDemo {
c := h.convertUserModel(v) c := *h.convertUserModel(v)
list = append(list, &c) list = append(list, &c)
} }
resp.List = list resp.List = list
...@@ -46,8 +46,8 @@ func (h *handler) ListDemo(ctx context.Context, req *demo.ListDemoReq, resp *dem ...@@ -46,8 +46,8 @@ func (h *handler) ListDemo(ctx context.Context, req *demo.ListDemoReq, resp *dem
return nil return nil
} }
func (h *handler) convertUserModel(users *model.User) (resp demo.DemoResp) { func (h *handler) convertUserModel(users *model.User) (resp *demo.DemoResp) {
return demo.DemoResp{ r := &demo.DemoResp{
Id: cast.ToString(users.Id), Id: cast.ToString(users.Id),
Username: users.Username, Username: users.Username,
Email: users.Email, Email: users.Email,
...@@ -56,4 +56,5 @@ func (h *handler) convertUserModel(users *model.User) (resp demo.DemoResp) { ...@@ -56,4 +56,5 @@ func (h *handler) convertUserModel(users *model.User) (resp demo.DemoResp) {
CreatedAt: timestamppb.New(users.CreatedAt), CreatedAt: timestamppb.New(users.CreatedAt),
UpdatedAt: timestamppb.New(users.UpdatedAt), 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