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.
21 lines
678 B
21 lines
678 B
package channel
|
|
|
|
import (
|
|
"context"
|
|
|
|
"practice_Go/api/channel/v1"
|
|
"practice_Go/internal/dao"
|
|
"practice_Go/internal/model/entity"
|
|
)
|
|
|
|
func (c *ControllerV1) GetChannel(ctx context.Context, req *v1.GetChannelReq) (res *v1.GetChannelRes, err error) {
|
|
res = &v1.GetChannelRes{}
|
|
err = dao.GoChannels.Ctx(ctx).WherePri(req.Id).Scan(&res.Channel)
|
|
query := dao.GoShows.Ctx(ctx).With(entity.GoUsers{}).Where("channel_id =?", req.Id)
|
|
if req.FlagType != 0 {
|
|
query = query.Where("flag_type =?", req.FlagType)
|
|
}
|
|
err = query.Scan(&res.List)
|
|
res.Channel.Status, err = dao.GoChannelSubscriptions.Ctx(ctx).Wheref("channel_id =? and user_id =?", req.Id, req.UserId).Exist()
|
|
return
|
|
}
|