Commit 8ac6210d authored by haoyanbin's avatar haoyanbin

精彩时刻

parent a26c6a12
......@@ -8,7 +8,6 @@ import (
"go-admin/app/mobile/service"
"go-admin/app/mobile/service/dto"
"go-admin/common/actions"
cDto "go-admin/common/dto"
"strconv"
)
......@@ -238,6 +237,7 @@ func (e OrgPlayer) GetOrgMatchSeason(c *gin.Context) {
// @Param matchId path string false "matchId"
// @Param rounds path string false "rounds"
// @Param playerId path string false "playerId"
// @Param type path string false "type"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player/evaluate [get]
// @Security Bearer
......@@ -255,7 +255,7 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
return
}
list := make([]dto.OrgMatchEvaluateList, 0)
list := make([]dto.OrgPlayerGetOrgMatchEvaluateReply, 0)
var count int64
//p := actions.GetPermissionFromContext(c)
......@@ -265,31 +265,42 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
return
}
reply := make([]dto.OrgMatchEvaluate, 0)
for _, v := range list {
replyV := dto.OrgMatchEvaluate{}
imgList := make([]cDto.Wonderful, 0)
err = s.GetPageWonderful(v.Id, &imgList, 1)
if err != nil {
e.Error(500, err, fmt.Sprintf("获取比赛球员信息 失败,\r\n失败信息 %s", err.Error()))
return
}
replyV.MatchImg = imgList
mvList := make([]cDto.Wonderful, 0)
err = s.GetPageWonderful(v.Id, &imgList, 2)
if err != nil {
e.Error(500, err, fmt.Sprintf("获取比赛球员信息 失败,\r\n失败信息 %s", err.Error()))
return
}
replyV.MatchMv = mvList
replyV.Id = v.Id
replyV.Content = v.Content
reply = append(reply, replyV)
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
}
// Get <手机端>获取球员评论
// @Summary <手机端>获取球员评论
// @Description <手机端>获取球员评论
// @Tags <手机端>球员数据
// @Param playerId path string false "playerId"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player/evaluate-content [get]
// @Security Bearer
func (e OrgPlayer) GetOrgMatchEvaluateContent(c *gin.Context) {
req := dto.OrgPlayerGetOrgMatchEvaluateContentReq{}
s := service.OrgPlayer{}
err := c.Bind(&req)
err = e.MakeContext(c).
MakeOrm().
MakeService(&s.Service).
Errors
if err != nil {
e.Logger.Error(err)
e.Error(500, err, err.Error())
return
}
e.OK(reply, "查询成功")
list := make([]dto.OrgPlayerGetOrgMatchEvaluateContentReply, 0)
var count int64
//p := actions.GetPermissionFromContext(c)
err = s.GetOrgMatchEvaluateContent(&req, &list, &count)
if err != nil {
e.Error(500, err, fmt.Sprintf("获取球员失败,\r\n失败信息 %s", err.Error()))
return
}
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
}
// Get <手机端>精彩时刻比赛轮次列表
......
......@@ -121,27 +121,38 @@ type GetRoundsReply struct {
}
type OrgPlayerGetOrgMatchEvaluateReq struct {
LeagueId string `form:"leagueId" json:"leagueId"`
SeasonId string `form:"seasonId" json:"seasonId"`
MatchId string `form:"matchId" json:"matchId"`
Rounds string `form:"rounds" json:"rounds"`
PlayerId string `form:"playerId" json:"playerId"`
dto.Pagination `search:"-"`
LeagueId string `form:"leagueId" json:"leagueId"`
SeasonId string `form:"seasonId" json:"seasonId"`
MatchId string `form:"matchId" json:"matchId"`
Rounds string `form:"rounds" json:"rounds"`
PlayerId string `form:"playerId" json:"playerId"`
Type string `form:"type" json:"type"`
}
type OrgPlayerGetOrgMatchEvaluateReply struct {
OrgMatchEvaluate []OrgMatchEvaluate `json:"orgMatchEvaluate"`
Id string `json:"id"`
WonderfulId string `json:"wonderfulId" comment:"精彩时刻id"`
WonderfulUrl string `json:"wonderfulUrl" comment:"精彩时刻url"`
WonderfulTitle string `json:"wonderfulTitle" comment:"精彩时刻标题"`
FileId string `json:"fileId" comment:"文件id"`
}
type OrgMatchEvaluate struct {
Id string `json:"id"`
Content string `json:"content"`
MatchImg []dto.Wonderful `json:"matchImg"`
MatchMv []dto.Wonderful `json:"matchMv"`
type OrgPlayerGetOrgMatchEvaluateContentReq struct {
dto.Pagination `search:"-"`
PlayerId string `form:"playerId" json:"playerId"`
}
type OrgMatchEvaluateList struct {
Id string `json:"id"`
Content string `json:"content"`
type OrgPlayerGetOrgMatchEvaluateContentReply struct {
Id string `json:"id"`
LeagueName string `json:"leagueName"`
DivisionName string `json:"divisionName"`
SeasonName string `json:"seasonName"`
MatchId string `json:"matchId"`
Rounds string `json:"rounds"`
Content string `json:"content"`
ContentDate string `json:"contentDate"`
ContentImg string `json:"contentImg"`
}
// OrgPlayerGetReq 功能获取请求参数
......
......@@ -324,19 +324,45 @@ func (e *OrgPlayer) GetOrgRounds(c *dto.GetRoundsReq, list *[]dto.GetRoundsReply
}
return nil
}
func (e *OrgPlayer) GetOrgMatchEvaluate(c *dto.OrgPlayerGetOrgMatchEvaluateReq, list *[]dto.OrgMatchEvaluateList, count *int64) error {
func (e *OrgPlayer) GetOrgMatchEvaluate(c *dto.OrgPlayerGetOrgMatchEvaluateReq, list *[]dto.OrgPlayerGetOrgMatchEvaluateReply, count *int64) error {
var err error
err = e.Orm.Table("org_match_evaluate as ome").
Select("ome.id, ome.content").
err = e.Orm.Table("org_match_evaluate_wonderful as omew").
Select("omew.id, omew.wonderful_url, omew.wonderful_title, omew.file_id").
Joins("left join org_match_evaluate as ome on ome.id = omew.match_evaluate_id").
Joins("left join org_match as om on om.id = ome.match_id").
Scopes(
cDto.PassDel("ome"),
cDto.PassDel("omew"),
cDto.SetWhere("om", "league_id", c.LeagueId),
cDto.SetWhere("om", "season_id", c.SeasonId),
cDto.SetWhere("ome", "match_id", c.MatchId),
cDto.SetWhere("ome", "rounds", c.Rounds),
).
Where("omew.type=?", c.Type).
Where("ome.player_id=?", c.PlayerId).
Find(list).Limit(-1).Offset(-1).
Count(count).Error
if err != nil {
e.Log.Errorf("OrgMatchService GetPage error:%s \r\n", err)
return err
}
return nil
}
func (e *OrgPlayer) GetOrgMatchEvaluateContent(c *dto.OrgPlayerGetOrgMatchEvaluateContentReq, list *[]dto.OrgPlayerGetOrgMatchEvaluateContentReply, count *int64) error {
var err error
err = e.Orm.Table("org_match_evaluate as ome").
Select("ome.id, ome.content, ome.content_date, ome.content_img, ol.league_name,"+
"os.season_name, od.division_name, ome.match_id, ome.rounds").
Joins("left join org_match as om on om.id = ome.match_id").
Joins("left join org_league as ol on om.league_id = ol.id").
Joins("left join org_season as os on om.season_id = os.id").
Joins("left join org_division as od on om.division_id = od.id").
Scopes(
cDto.Paginate(c.GetPageSize(), c.GetPageIndex()),
cDto.PassDel("ome"),
).
Where("ome.player_id=?", c.PlayerId).
Find(list).Limit(-1).Offset(-1).
Count(count).Error
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment