Impl magic login logic && checkin logic
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
24
service/checkin/checkin.go
Normal file
24
service/checkin/checkin.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package checkin
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"nixcn-cms/data"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func Checkin(ctx *gin.Context) {
|
||||
data := new(data.User)
|
||||
userId, ok := ctx.Get("user_id")
|
||||
if !ok {
|
||||
ctx.JSON(http.StatusUnauthorized, gin.H{
|
||||
"status": "unauthorized",
|
||||
})
|
||||
return
|
||||
}
|
||||
data.SetCheckinState(userId.(uuid.UUID), true)
|
||||
ctx.JSON(http.StatusOK, gin.H{
|
||||
"status": "success",
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user