Files
huangguo_server/app/api/checkinctrl/checkin.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

62 lines
1.4 KiB
Go

package checkinctrl
import (
"91porn-server/app/service/checkinser"
"91porn-server/app/service/m3u8ticket"
"91porn-server/common"
"91porn-server/common/stderr"
"github.com/gin-gonic/gin"
)
// UserCheckin 用户签到
func UserCheckin(c *gin.Context) {
uid, err := common.GetUID(c)
if err != nil {
common.ServeJSON(c, stderr.ErrNoToken, nil)
return
}
resp, code := checkinser.AddCheckin(uid)
if code != stderr.Success {
common.ServeJSON(c, code, nil)
return
}
if resp != nil {
m3u8ticket.SignURL(c, uid, &resp.PrizeVideo, true, false)
}
common.ServeJSON(c, stderr.Success, resp)
}
// GetCheckinPrize 获取签到奖品
func GetCheckinPrize(c *gin.Context) {
uid, err := common.GetUID(c)
if err != nil {
common.ServeJSON(c, stderr.ErrNoToken, nil)
return
}
resp, code := checkinser.GetCheckinPrizes(uid)
if code != stderr.Success {
common.ServeJSON(c, code, nil)
return
}
common.ServeJSON(c, stderr.Success, resp)
}
// ClaimVipCheckinPrize 补领VIP签到奖励
func ClaimVipCheckinPrize(c *gin.Context) {
uid, err := common.GetUID(c)
if err != nil {
common.ServeJSON(c, stderr.ErrNoToken, nil)
return
}
resp, code := checkinser.ClaimVipCheckinPrizes(uid)
if code != stderr.Success {
common.ServeJSON(c, code, nil)
return
}
if resp != nil {
m3u8ticket.SignURL(c, uid, &resp.PrizeVideo, true, false)
}
common.ServeJSON(c, stderr.Success, resp)
}