Commit 2f542726 authored by haoyanbin's avatar haoyanbin

Upload

parent 033bc81b
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ 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"
) )
...@@ -28,9 +29,10 @@ type OrgPlayer struct { ...@@ -28,9 +29,10 @@ type OrgPlayer struct {
func (e OrgPlayer) GetPage(c *gin.Context) { func (e OrgPlayer) GetPage(c *gin.Context) {
req := dto.OrgPlayerGetPageReq{} req := dto.OrgPlayerGetPageReq{}
s := service.OrgPlayer{} s := service.OrgPlayer{}
err := e.MakeContext(c).
err := c.Bind(&req)
err = e.MakeContext(c).
MakeOrm(). MakeOrm().
Bind(&req).
MakeService(&s.Service). MakeService(&s.Service).
Errors Errors
if err != nil { if err != nil {
...@@ -66,9 +68,9 @@ func (e OrgPlayer) GetPage(c *gin.Context) { ...@@ -66,9 +68,9 @@ func (e OrgPlayer) GetPage(c *gin.Context) {
func (e OrgPlayer) Get(c *gin.Context) { func (e OrgPlayer) Get(c *gin.Context) {
req := dto.OrgPlayerGetReq{} req := dto.OrgPlayerGetReq{}
s := service.OrgPlayer{} s := service.OrgPlayer{}
err := e.MakeContext(c). err := c.Bind(&req)
err = e.MakeContext(c).
MakeOrm(). MakeOrm().
Bind(&req).
MakeService(&s.Service). MakeService(&s.Service).
Errors Errors
if err != nil { if err != nil {
...@@ -136,9 +138,9 @@ func (e OrgPlayer) Get(c *gin.Context) { ...@@ -136,9 +138,9 @@ func (e OrgPlayer) Get(c *gin.Context) {
func (e OrgPlayer) GetInfo(c *gin.Context) { func (e OrgPlayer) GetInfo(c *gin.Context) {
req := dto.OrgPlayerGetReq{} req := dto.OrgPlayerGetReq{}
s := service.OrgPlayer{} s := service.OrgPlayer{}
err := e.MakeContext(c). err := c.Bind(&req)
err = e.MakeContext(c).
MakeOrm(). MakeOrm().
Bind(&req).
MakeService(&s.Service). MakeService(&s.Service).
Errors Errors
if err != nil { if err != nil {
...@@ -193,9 +195,9 @@ func (e OrgPlayer) GetInfo(c *gin.Context) { ...@@ -193,9 +195,9 @@ func (e OrgPlayer) GetInfo(c *gin.Context) {
func (e OrgPlayer) GetOrgMatchSeason(c *gin.Context) { func (e OrgPlayer) GetOrgMatchSeason(c *gin.Context) {
req := dto.OrgPlayerGetReq{} req := dto.OrgPlayerGetReq{}
s := service.OrgPlayer{} s := service.OrgPlayer{}
err := e.MakeContext(c). err := c.Bind(&req)
err = e.MakeContext(c).
MakeOrm(). MakeOrm().
Bind(&req).
MakeService(&s.Service). MakeService(&s.Service).
Errors Errors
if err != nil { if err != nil {
...@@ -230,9 +232,9 @@ func (e OrgPlayer) GetOrgMatchSeason(c *gin.Context) { ...@@ -230,9 +232,9 @@ func (e OrgPlayer) GetOrgMatchSeason(c *gin.Context) {
func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) { func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
req := dto.OrgPlayerGetOrgMatchEvaluateReq{} req := dto.OrgPlayerGetOrgMatchEvaluateReq{}
s := service.OrgPlayer{} s := service.OrgPlayer{}
err := e.MakeContext(c). err := c.Bind(&req)
err = e.MakeContext(c).
MakeOrm(). MakeOrm().
Bind(&req).
MakeService(&s.Service). MakeService(&s.Service).
Errors Errors
if err != nil { if err != nil {
...@@ -241,7 +243,7 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) { ...@@ -241,7 +243,7 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
return return
} }
list := make([]dto.OrgMatchEvaluate, 0) list := make([]dto.OrgMatchEvaluateList, 0)
var count int64 var count int64
//p := actions.GetPermissionFromContext(c) //p := actions.GetPermissionFromContext(c)
...@@ -251,7 +253,31 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) { ...@@ -251,7 +253,31 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
return return
} }
e.OK(list, "查询成功") 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.OK(reply, "查询成功")
} }
// Get <手机端>获取球员精彩时刻 // Get <手机端>获取球员精彩时刻
...@@ -264,14 +290,14 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) { ...@@ -264,14 +290,14 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
// @Param rounds path string false "rounds" // @Param rounds path string false "rounds"
// @Param playerId path string false "playerId" // @Param playerId path string false "playerId"
// @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/get-rounds [get]
// @Security Bearer // @Security Bearer
func (e OrgPlayer) GetOrgRounds(c *gin.Context) { func (e OrgPlayer) GetOrgRounds(c *gin.Context) {
req := dto.GetRoundsReq{} req := dto.GetRoundsReq{}
s := service.OrgPlayer{} s := service.OrgPlayer{}
err := e.MakeContext(c). err := c.Bind(&req)
err = e.MakeContext(c).
MakeOrm(). MakeOrm().
Bind(&req).
MakeService(&s.Service). MakeService(&s.Service).
Errors Errors
if err != nil { if err != nil {
......
...@@ -22,7 +22,7 @@ type OrgPlayerRank struct { ...@@ -22,7 +22,7 @@ type OrgPlayerRank struct {
// @Tags <手机端>比赛排名 // @Tags <手机端>比赛排名
// @Param pageSize query int false "页条数" // @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码" // @Param pageIndex query int false "页码"
// @Param data body dto.OrgTeamPlayerGetPageReq true "data" // @Param data body dto.OrgPlayerRankGetPageReq true "data"
// @Success 200 {string} string "{"code": 200, "data": [...]}" // @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player-rank [get] // @Router /mobile/v1/org-player-rank [get]
// @Security Bearer // @Security Bearer
...@@ -52,3 +52,40 @@ func (e OrgPlayerRank) GetPage(c *gin.Context) { ...@@ -52,3 +52,40 @@ func (e OrgPlayerRank) GetPage(c *gin.Context) {
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
} }
// GetPage <手机端>获取球队排名
// @Summary <手机端>获取球队排名
// @Description <手机端>获取球队排名
// @Tags <手机端>比赛排名
// @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码"
// @Param data body dto.OrgPlayerRankGetPageReq true "data"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player-rank/team [get]
// @Security Bearer
func (e OrgPlayerRank) GetPageTeam(c *gin.Context) {
req := dto.OrgPlayerRankGetPageReq{}
s := service.OrgPlayerRank{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
e.Logger.Error(err)
e.Error(500, err, err.Error())
return
}
p := actions.GetPermissionFromContext(c)
list := make([]dto.OrgPlayerRankGetPageReply, 0)
var count int64
err = s.GetPage(&req, p, &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(), "查询成功")
}
...@@ -58,9 +58,9 @@ func (m *OrgPlayerGetPageReq) GetNeedSearch() interface{} { ...@@ -58,9 +58,9 @@ func (m *OrgPlayerGetPageReq) GetNeedSearch() interface{} {
} }
type OrgPlayerDataGetReq struct { type OrgPlayerDataGetReq struct {
PlayerId string `json:"playerId"` PlayerId string `form:"playerId" json:"playerId"`
SeasonId string `json:"seasonId"` SeasonId string `form:"seasonId" json:"seasonId"`
Match string `json:"match"` Match string `form:"match" json:"match"`
} }
type OrgPlayerDataGetReply struct { type OrgPlayerDataGetReply struct {
...@@ -100,7 +100,7 @@ type OrgPlayerRoundsScoring struct { ...@@ -100,7 +100,7 @@ type OrgPlayerRoundsScoring struct {
} }
type GetRoundsReq struct { type GetRoundsReq struct {
PlayerId string `json:"playerId"` PlayerId string `form:"playerId" json:"playerId"`
} }
type GetRoundsReply struct { type GetRoundsReply struct {
Id string `json:"id"` Id string `json:"id"`
...@@ -114,11 +114,11 @@ type GetRoundsReply struct { ...@@ -114,11 +114,11 @@ type GetRoundsReply struct {
} }
type OrgPlayerGetOrgMatchEvaluateReq struct { type OrgPlayerGetOrgMatchEvaluateReq struct {
LeagueId string `json:"leagueId"` LeagueId string `form:"leagueId" json:"leagueId"`
SeasonId string `json:"seasonId"` SeasonId string `form:"seasonId" json:"seasonId"`
MatchId string `json:"matchId"` MatchId string `form:"matchId" json:"matchId"`
Rounds string `json:"rounds"` Rounds string `form:"rounds" json:"rounds"`
PlayerId string `json:"playerId"` PlayerId string `form:"playerId" json:"playerId"`
} }
type OrgPlayerGetOrgMatchEvaluateReply struct { type OrgPlayerGetOrgMatchEvaluateReply struct {
...@@ -128,10 +128,13 @@ type OrgPlayerGetOrgMatchEvaluateReply struct { ...@@ -128,10 +128,13 @@ type OrgPlayerGetOrgMatchEvaluateReply struct {
type OrgMatchEvaluate struct { type OrgMatchEvaluate struct {
Id string `json:"id"` Id string `json:"id"`
Content string `json:"content"` Content string `json:"content"`
WonderfulMomentImg string `json:"wonderfulMomentImg"` MatchImg []dto.Wonderful `json:"matchImg"`
WonderfulMomentImgTitle string `json:"wonderfulMomentImgTitle"` MatchMv []dto.Wonderful `json:"matchMv"`
WonderfulMomentMv string `json:"wonderfulMomentMv"` }
WonderfulMomentMvTitle string `json:"wonderfulMomentMvTitle"`
type OrgMatchEvaluateList struct {
Id string `json:"id"`
Content string `json:"content"`
} }
// OrgPlayerGetReq 功能获取请求参数 // OrgPlayerGetReq 功能获取请求参数
......
...@@ -318,22 +318,20 @@ func (e *OrgPlayer) GetOrgRounds(c *dto.GetRoundsReq, list *[]dto.GetRoundsReply ...@@ -318,22 +318,20 @@ func (e *OrgPlayer) GetOrgRounds(c *dto.GetRoundsReq, list *[]dto.GetRoundsReply
} }
return nil return nil
} }
func (e *OrgPlayer) GetOrgMatchEvaluate(c *dto.OrgPlayerGetOrgMatchEvaluateReq, list *[]dto.OrgMatchEvaluate, count *int64) error { func (e *OrgPlayer) GetOrgMatchEvaluate(c *dto.OrgPlayerGetOrgMatchEvaluateReq, list *[]dto.OrgMatchEvaluateList, 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 as ome").
Select("ome.id, ome.content,"+ Select("ome.id, ome.content").
"ome.wonderful_moment_img, ome.wonderful_moment_mv,ome.wonderful_moment_img_title,"+
"ome.wonderful_moment_mv_title").
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("ome"),
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("om.league_id = ?", c.LeagueId). Where("ome.player_id=?", c.PlayerId).
Where("om.season_id = ?", c.SeasonId).
Where("ome.match_id = ?", c.MatchId).
Where("ome.rounds = ?", c.Rounds).
Where("ome.player_id = ?", c.PlayerId).
Find(list).Limit(-1).Offset(-1). Find(list).Limit(-1).Offset(-1).
Count(count).Error Count(count).Error
if err != nil { if err != nil {
...@@ -571,3 +569,21 @@ func (e *OrgPlayer) rankingForGetPage(replyGetPlayerRank []models.OrgMatchTeamPl ...@@ -571,3 +569,21 @@ func (e *OrgPlayer) rankingForGetPage(replyGetPlayerRank []models.OrgMatchTeamPl
} }
return "0" return "0"
} }
func (e *OrgPlayer) GetPageWonderful(evaluateId string, list *[]cDto.Wonderful, wType int) error {
var err error
err = e.Orm.Table("org_match_evaluate_wonderful as omew").
Select("omew.id, omew.wonderful_url, omew.wonderful_title").
Scopes(
cDto.PassDel("omew"),
).
Where("match_evaluate_id=?", evaluateId).
Where("type=?", wType).
Find(list).Error
if err != nil {
e.Log.Errorf("OrgMatchService GetPage error:%s \r\n", err)
return err
}
return nil
}
...@@ -20,7 +20,7 @@ func (e *OrgPlayerRank) GetPage(c *dto.OrgPlayerRankGetPageReq, p *actions.DataP ...@@ -20,7 +20,7 @@ func (e *OrgPlayerRank) GetPage(c *dto.OrgPlayerRankGetPageReq, p *actions.DataP
var err error var err error
err = e.Orm.Table("org_match_team_player as omtp"). err = e.Orm.Table("org_match_team_player as omtp").
Select("ol.league_name, omtp.player_name, omtp.player_id as id, omtp.player_number,"+ Select("omtp.player_id as id, ol.league_name, omtp.player_name, omtp.player_number,"+
"sum(omtp.scoring)as scoring,"+ "sum(omtp.scoring)as scoring,"+
"sum(omtp.rebound)as rebound,"+ "sum(omtp.rebound)as rebound,"+
"sum(omtp.assist)as assist,"+ "sum(omtp.assist)as assist,"+
...@@ -39,7 +39,7 @@ func (e *OrgPlayerRank) GetPage(c *dto.OrgPlayerRankGetPageReq, p *actions.DataP ...@@ -39,7 +39,7 @@ func (e *OrgPlayerRank) GetPage(c *dto.OrgPlayerRankGetPageReq, p *actions.DataP
cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), cDto.Paginate(c.GetPageSize(), c.GetPageIndex()),
actions.Permission("omtp", p), actions.Permission("omtp", p),
cDto.PassDel("omtp"), cDto.PassDel("omtp"),
cDto.SetWhere("omtp", "league_id", c.LeagueId), cDto.SetWhere("om", "league_id", c.LeagueId),
). ).
Group("omtp.player_id"). Group("omtp.player_id").
Find(list).Limit(-1).Offset(-1). Find(list).Limit(-1).Offset(-1).
......
...@@ -57,7 +57,8 @@ func UploadFile(f multipart.File, h *multipart.FileHeader) (string, error) { ...@@ -57,7 +57,8 @@ func UploadFile(f multipart.File, h *multipart.FileHeader) (string, error) {
yunfiletmp := fmt.Sprintf("%s/%s", extConfig.ExtConfig.Upload.Dir, GetDate()) yunfiletmp := fmt.Sprintf("%s/%s", extConfig.ExtConfig.Upload.Dir, GetDate())
fullFileName = fmt.Sprintf("%s/%s%s", yunfiletmp, guid, filepath.Ext(h.Filename)) fullFileName = fmt.Sprintf("%s/%s%s", yunfiletmp, guid, filepath.Ext(h.Filename))
//fmt.Println(fullFileName) //fmt.Println(fullFileName)
if err = bucket.PutObject(fullFileName, buf); err != nil { option := oss.ContentType("image/jpg")
if err = bucket.PutObject(fullFileName, buf, option); err != nil {
return fullFileName, err return fullFileName, err
} }
return fullFileName, nil return fullFileName, nil
......
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