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.

71 lines
1.3 KiB

package setting
import (
"github.com/gin-gonic/gin"
"recook/internal/libs/bean"
"recook/internal/v2/lib/back"
"recook/internal/v2/logic/manage/setting"
"recook/tools"
)
type Invite struct {
}
type PageItem struct {
}
// Lists 返回邀请码
func (*Invite) Lists(c *gin.Context) {
args := bean.Page{}
err := tools.Params(&args, c)
if err != nil {
back.Fail(c, err.Error())
return
}
lists, total := setting.InviteLogic.Lists(args)
back.Suc(c, "操作成功", bean.ResultLists{
List: lists,
Total: int(total),
})
}
type arsgInviteCreateInvite struct {
NowTime string
}
// Gen 创建邀请码
func (*Invite) Gen(c *gin.Context) {
args := arsgInviteCreateInvite{}
err := tools.Params(&args, c)
if err != nil {
back.Fail(c, err.Error())
return
}
if err := setting.InviteLogic.Gen(args.NowTime); err != nil {
back.Fail(c, err.Error())
return
}
back.Suc(c, "操作成功", nil)
}
type arsgInviteCancellation struct {
InviteId int64
}
func (*Invite) Cancellation(c *gin.Context) {
args := arsgInviteCancellation{}
err := tools.Params(&args, c)
if err != nil {
back.Fail(c, err.Error())
return
}
if args.InviteId == 0 {
back.Fail(c, "参数错误")
return
}
if err := setting.InviteLogic.Cancellation(args.InviteId); err != nil {
back.Fail(c, err.Error())
return
}
back.Suc(c, "操作成功", nil)
}