Commit 8ac6210d authored by haoyanbin's avatar haoyanbin

精彩时刻

parent a26c6a12
...@@ -8,7 +8,6 @@ import ( ...@@ -8,7 +8,6 @@ import (
"go-admin/app/mobile/service" "go-admin/app/mobile/service"
"go-admin/app/mobile/service/dto" "go-admin/app/mobile/service/dto"
"go-admin/common/actions" "go-admin/common/actions"
cDto "go-admin/common/dto"
"strconv" "strconv"
) )
...@@ -238,6 +237,7 @@ func (e OrgPlayer) GetOrgMatchSeason(c *gin.Context) { ...@@ -238,6 +237,7 @@ func (e OrgPlayer) GetOrgMatchSeason(c *gin.Context) {
// @Param matchId path string false "matchId" // @Param matchId path string false "matchId"
// @Param rounds path string false "rounds" // @Param rounds path string false "rounds"
// @Param playerId path string false "playerId" // @Param playerId path string false "playerId"
// @Param type path string false "type"
// @Success 200 {string} string "{"code": 200, "data": [...]}" // @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player/evaluate [get] // @Router /mobile/v1/org-player/evaluate [get]
// @Security Bearer // @Security Bearer
...@@ -255,7 +255,7 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) { ...@@ -255,7 +255,7 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
return return
} }
list := make([]dto.OrgMatchEvaluateList, 0) list := make([]dto.OrgPlayerGetOrgMatchEvaluateReply, 0)
var count int64 var count int64
//p := actions.GetPermissionFromContext(c) //p := actions.GetPermissionFromContext(c)
...@@ -265,31 +265,42 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) { ...@@ -265,31 +265,42 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
return return
} }
reply := make([]dto.OrgMatchEvaluate, 0) e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
}
for _, v := range list {
replyV := dto.OrgMatchEvaluate{} // Get <手机端>获取球员评论
imgList := make([]cDto.Wonderful, 0) // @Summary <手机端>获取球员评论
err = s.GetPageWonderful(v.Id, &imgList, 1) // @Description <手机端>获取球员评论
if err != nil { // @Tags <手机端>球员数据
e.Error(500, err, fmt.Sprintf("获取比赛球员信息 失败,\r\n失败信息 %s", err.Error())) // @Param playerId path string false "playerId"
return // @Success 200 {string} string "{"code": 200, "data": [...]}"
} // @Router /mobile/v1/org-player/evaluate-content [get]
replyV.MatchImg = imgList // @Security Bearer
func (e OrgPlayer) GetOrgMatchEvaluateContent(c *gin.Context) {
mvList := make([]cDto.Wonderful, 0) req := dto.OrgPlayerGetOrgMatchEvaluateContentReq{}
err = s.GetPageWonderful(v.Id, &imgList, 2) s := service.OrgPlayer{}
if err != nil { err := c.Bind(&req)
e.Error(500, err, fmt.Sprintf("获取比赛球员信息 失败,\r\n失败信息 %s", err.Error())) err = e.MakeContext(c).
return MakeOrm().
} MakeService(&s.Service).
replyV.MatchMv = mvList Errors
replyV.Id = v.Id if err != nil {
replyV.Content = v.Content e.Logger.Error(err)
reply = append(reply, replyV) 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 <手机端>精彩时刻比赛轮次列表 // Get <手机端>精彩时刻比赛轮次列表
......
...@@ -121,27 +121,38 @@ type GetRoundsReply struct { ...@@ -121,27 +121,38 @@ type GetRoundsReply struct {
} }
type OrgPlayerGetOrgMatchEvaluateReq struct { type OrgPlayerGetOrgMatchEvaluateReq struct {
LeagueId string `form:"leagueId" json:"leagueId"` dto.Pagination `search:"-"`
SeasonId string `form:"seasonId" json:"seasonId"` LeagueId string `form:"leagueId" json:"leagueId"`
MatchId string `form:"matchId" json:"matchId"` SeasonId string `form:"seasonId" json:"seasonId"`
Rounds string `form:"rounds" json:"rounds"` MatchId string `form:"matchId" json:"matchId"`
PlayerId string `form:"playerId" json:"playerId"` Rounds string `form:"rounds" json:"rounds"`
PlayerId string `form:"playerId" json:"playerId"`
Type string `form:"type" json:"type"`
} }
type OrgPlayerGetOrgMatchEvaluateReply struct { 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 { type OrgPlayerGetOrgMatchEvaluateContentReq struct {
Id string `json:"id"` dto.Pagination `search:"-"`
Content string `json:"content"` PlayerId string `form:"playerId" json:"playerId"`
MatchImg []dto.Wonderful `json:"matchImg"`
MatchMv []dto.Wonderful `json:"matchMv"`
} }
type OrgMatchEvaluateList struct { type OrgPlayerGetOrgMatchEvaluateContentReply struct {
Id string `json:"id"` Id string `json:"id"`
Content string `json:"content"` 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 功能获取请求参数 // OrgPlayerGetReq 功能获取请求参数
......
...@@ -324,19 +324,45 @@ func (e *OrgPlayer) GetOrgRounds(c *dto.GetRoundsReq, list *[]dto.GetRoundsReply ...@@ -324,19 +324,45 @@ func (e *OrgPlayer) GetOrgRounds(c *dto.GetRoundsReq, list *[]dto.GetRoundsReply
} }
return nil 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 var err error
err = e.Orm.Table("org_match_evaluate as ome"). err = e.Orm.Table("org_match_evaluate_wonderful as omew").
Select("ome.id, ome.content"). 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"). Joins("left join org_match as om on om.id = ome.match_id").
Scopes( Scopes(
cDto.PassDel("ome"), cDto.PassDel("omew"),
cDto.SetWhere("om", "league_id", c.LeagueId), cDto.SetWhere("om", "league_id", c.LeagueId),
cDto.SetWhere("om", "season_id", c.SeasonId), cDto.SetWhere("om", "season_id", c.SeasonId),
cDto.SetWhere("ome", "match_id", c.MatchId), cDto.SetWhere("ome", "match_id", c.MatchId),
cDto.SetWhere("ome", "rounds", c.Rounds), 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). Where("ome.player_id=?", c.PlayerId).
Find(list).Limit(-1).Offset(-1). Find(list).Limit(-1).Offset(-1).
Count(count).Error 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