You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudreve/routers/controllers/user.go

28 lines
514 B

package controllers
import (
5 years ago
"cloudreve/pkg/serializer"
"cloudreve/service/user"
"github.com/gin-gonic/gin"
)
// UserLogin 用户登录
func UserLogin(c *gin.Context) {
5 years ago
var service user.UserLoginService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.Login(c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}
5 years ago
// UserMe 获取当前登录的用户
func UserMe(c *gin.Context) {
user := CurrentUser(c)
res := serializer.BuildUserResponse(*user)
c.JSON(200, res)
}