user.go 550 B

1234567891011121314151617181920212223242526
  1. package api
  2. import (
  3. "fmt"
  4. "github.com/gin-gonic/gin"
  5. "main/model/dbModel"
  6. )
  7. type RegistStuct struct {
  8. UserName string `json:"userName"`
  9. PassWord string `json:"passWord"`
  10. }
  11. // @Summary 创建用户
  12. // @Produce application/x-www-form-urlencoded
  13. // @Param data body api.RegistStuct true "用户注册接口"
  14. // @Success 200 {string} json "{"code":200,"data":{},"msg":"ok"}"
  15. // @Router /user/regist [post]
  16. func Regist(c *gin.Context) {
  17. var U dbModel.User
  18. _ = c.BindJSON(&U)
  19. fmt.Println(U)
  20. err, user := U.Create()
  21. fmt.Println(err, user)
  22. }