单元测试
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -20,8 +23,17 @@ type PostLoginParam struct {
|
||||
func (c *Controller) PostLogin(ctx *gin.Context) {
|
||||
param := &PostLoginParam{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
fmt.Println("参数解析失败,请确认参数是否为 JSON")
|
||||
fmt.Println(err)
|
||||
}
|
||||
ctx.JSON(http.StatusOK, gin.H{
|
||||
"message": "success",
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Controller) RegisterRoute(gin *gin.Engine) {
|
||||
group := gin.Group(version).Group(group)
|
||||
group.POST("/login", c.PostLogin)
|
||||
}
|
||||
|
||||
// New 获取用户模块的控制器
|
||||
|
||||
Reference in New Issue
Block a user