Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nbya
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoyanbin
nbya
Commits
8ac6210d
Commit
8ac6210d
authored
Jan 26, 2022
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
精彩时刻
parent
a26c6a12
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
43 deletions
+91
-43
org_player.go
app/mobile/apis/org_player.go
+36
-25
org_player.go
app/mobile/service/dto/org_player.go
+25
-14
org_player.go
app/mobile/service/org_player.go
+30
-4
No files found.
app/mobile/apis/org_player.go
View file @
8ac6210d
...
...
@@ -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
.
Org
MatchEvaluateList
,
0
)
list
:=
make
([]
dto
.
Org
PlayerGetOrgMatchEvaluateReply
,
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 <手机端>精彩时刻比赛轮次列表
...
...
app/mobile/service/dto/org_player.go
View file @
8ac6210d
...
...
@@ -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 功能获取请求参数
...
...
app/mobile/service/org_player.go
View file @
8ac6210d
...
...
@@ -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
.
Org
MatchEvaluateList
,
count
*
int64
)
error
{
func
(
e
*
OrgPlayer
)
GetOrgMatchEvaluate
(
c
*
dto
.
OrgPlayerGetOrgMatchEvaluateReq
,
list
*
[]
dto
.
Org
PlayerGetOrgMatchEvaluateReply
,
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
(
"ome
w
"
),
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment