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.
52 lines
1.3 KiB
52 lines
1.3 KiB
package clubs
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"practice_Go/internal/dao"
|
|
"practice_Go/internal/model/do"
|
|
"practice_Go/internal/model/entity"
|
|
"practice_Go/internal/service"
|
|
)
|
|
|
|
// 1.注册
|
|
func init() {
|
|
service.RegisterClubs(&sClubs{})
|
|
}
|
|
|
|
type sClubs struct{}
|
|
|
|
func (c sClubs) GetClubs(ctx context.Context) (clubs []entity.GoClubs, err error) {
|
|
clubId := g.RequestFromCtx(ctx).Get("id").Int()
|
|
if clubId == 0 {
|
|
panic("获取俱乐部信息时id不能为空")
|
|
} else {
|
|
err = dao.GoClubs.Ctx(ctx).Where("id", clubId).Scan(&clubs) //查询数据库, 并将可能出现的错误赋给err
|
|
}
|
|
return
|
|
}
|
|
|
|
func (c sClubs) GetClubShows(ctx context.Context) (shows []entity.GoShows, err error) {
|
|
clubId := g.RequestFromCtx(ctx).Get("id").Int()
|
|
if clubId == 0 {
|
|
panic("获取俱乐部内容时id不能为空")
|
|
} else {
|
|
err = dao.GoShows.Ctx(ctx).FieldsEx("club").With(entity.GoUsers{}).Where("club_id", clubId).Scan(&shows)
|
|
}
|
|
return
|
|
}
|
|
|
|
func (c sClubs) AddClub(ctx context.Context, club do.GoShows) (err error) {
|
|
//TODO implement me
|
|
panic("implement me")
|
|
}
|
|
|
|
func (c sClubs) EditClub(ctx context.Context, club do.GoClubs) (err error) {
|
|
//TODO implement me
|
|
panic("implement me")
|
|
}
|
|
|
|
func (c sClubs) DeleteClub(ctx context.Context) (err error) {
|
|
//TODO implement me
|
|
panic("implement me")
|
|
}
|