api

package
v0.0.0-...-320e0c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(c *gin.Context)

用户登录函数

func LoginOut

func LoginOut(c *gin.Context)

LoginOut 退出登录接口

func Register

func Register(c *gin.Context)

Register 处理用户注册接口

func Weather

func Weather(c *gin.Context)

Types

type BaiduWeatherResponse

type BaiduWeatherResponse struct {
	Status int `json:"status"`
	Result struct {
		Now struct {
			Temp int `json:"temp"` // 实时温度
		} `json:"now"`
		Indexes []struct {
			Name   string `json:"name"`   // 指数名称(如"穿衣指数")
			Brief  string `json:"brief"`  // 简要建议(如"较冷")
			Detail string `json:"detail"` // 详细说明(如"建议着厚外套加毛衣等服装")
		} `json:"indexes"`
	} `json:"result"`
}

定义百度天气API返回数据的结构体(包含温度和穿衣指数)

type LoginRequest

type LoginRequest struct {
	ID       uint   `json:"id"`
	Username string `json:"username" binding:"required,min=3,max=20"`
	Password string `json:"password" binding:"required,min=6,max=30"`
}

type RegisterRequest

type RegisterRequest struct {
	Username string `json:"username" binding:"required,min=3,max=20"`
	Password string `json:"password" binding:"required,min=6,max=30"`
	Email    string `json:"email" binding:"required,email"`
}

RegisterRequest 定义注册请求结构体

Directories

Path Synopsis
pod

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL