add
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package logic
|
||||
|
||||
// 这里是创建数据逻辑:
|
||||
// 1、接收 name,code 两个参数。
|
||||
// 2、确认提交的 name,code 两个参数不能为空,如果有空,则返回提示。
|
||||
// 3、第二步通过后,在 country 表中创建一个 id。
|
||||
// 4、通过 3 中的 id,分别保存到 name 和 code 的表中。
|
||||
|
||||
// CreateRequest 注册请求参数结构
|
||||
type CreateRequest struct {
|
||||
|
||||
}
|
||||
|
||||
// CreateResponse 注册响应结构
|
||||
type CreateResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
Data struct {
|
||||
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
// CreateHandler 逻辑
|
||||
func CreateHandler(c *gin.Context) {
|
||||
|
||||
}
|
||||
@@ -21,12 +21,9 @@ func main() {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
r := gin.Default()
|
||||
|
||||
// 登录接口
|
||||
r.POST("/user/login", logic.LoginHandler)
|
||||
zap.L().Info("✅ 登录接口注册完成: POST /user/login")
|
||||
// 注册接口
|
||||
r.POST("/user/register", logic.RegisterHandler)
|
||||
zap.L().Info("✅ 登录接口注册完成: POST /user/register")
|
||||
// 创建接口
|
||||
r.POST("/country/create", logic.CreateHandler)
|
||||
zap.L().Info("✅ 登录接口注册完成: POST /country/create")
|
||||
|
||||
// 启动服务,监听80端口
|
||||
zap.L().Info("✅ 服务启动在80端口")
|
||||
|
||||
Reference in New Issue
Block a user