yxh 4 lat temu
rodzic
commit
c6cb225b47

+ 0 - 13
apiv1/system/hello.go

@@ -1,13 +0,0 @@
-package system
-
-import (
-	"github.com/gogf/gf/v2/frame/g"
-)
-
-type HelloReq struct {
-	g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
-}
-type HelloRes struct {
-	g.Meta `mime:"text/html" example:"string"`
-	Data   g.Map `json:"data"`
-}

+ 17 - 0
apiv1/system/user.go

@@ -0,0 +1,17 @@
+package system
+
+import (
+	"github.com/gogf/gf/v2/frame/g"
+)
+
+type UserLoginReq struct {
+	g.Meta     `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
+	Username   string `p:"username" v:"required#用户名不能为空"`
+	Password   string `p:"password" v:"required#密码不能为空"`
+	VerifyCode string `p:"verifyCode" v:"required#验证码不能为空"`
+	VerifyKey  string `p:"verifyKey"`
+}
+type UserLoginRes struct {
+	g.Meta `mime:"text/html" example:"string"`
+	Data   g.Map `json:"data"`
+}

+ 0 - 22
internal/app/system/controller/hello.go

@@ -1,22 +0,0 @@
-package controller
-
-import (
-	"context"
-	"github.com/gogf/gf/v2/frame/g"
-	"github.com/tiger1103/gfast/v3/apiv1/system"
-)
-
-var (
-	Hello = cHello{}
-)
-
-type cHello struct{}
-
-func (h *cHello) Hello(ctx context.Context, req *system.HelloReq) (res *system.HelloRes, err error) {
-	g.Log().Debug(ctx, "demo test")
-	//g.RequestFromCtx(ctx).Response.Writeln("Hello World!")
-	res = &system.HelloRes{
-		Data: g.Map{"name": "zhangsang", "age": 18},
-	}
-	return
-}

+ 16 - 0
internal/app/system/controller/user.go

@@ -0,0 +1,16 @@
+package controller
+
+import (
+	"context"
+	"github.com/tiger1103/gfast/v3/apiv1/system"
+)
+
+var (
+	User = cUser{}
+)
+
+type cUser struct{}
+
+func (h *cUser) Login(ctx context.Context, req *system.UserLoginReq) (res *system.UserLoginRes, err error) {
+	return
+}

+ 1 - 1
internal/app/system/router/router.go

@@ -17,7 +17,7 @@ func BindController(group *ghttp.RouterGroup) {
 	group.Group("/system", func(group *ghttp.RouterGroup) {
 		group.Middleware(libMiddleware.ExceptionHandle)
 		group.Bind(
-			controller.Hello,
+			controller.User,
 		)
 	})
 }