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
4bcc9c5f
Commit
4bcc9c5f
authored
Jan 19, 2022
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生涯
parent
74495b09
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
644 additions
and
31 deletions
+644
-31
org_player.go
app/mobile/apis/org_player.go
+125
-20
org_player.go
app/mobile/router/org_player.go
+2
-0
org_player.go
app/mobile/service/dto/org_player.go
+66
-1
org_player.go
app/mobile/service/org_player.go
+442
-1
org_team_player.go
app/operate/service/org_team_player.go
+9
-9
No files found.
app/mobile/apis/org_player.go
View file @
4bcc9c5f
...
...
@@ -15,10 +15,10 @@ type OrgPlayer struct {
api
.
Api
}
// GetPage <
球队
>获取球员列表
// @Summary <
球队
>获取球员列表
// @Description <
球队
>获取球员列表
// @Tags <
球队
>球员
// GetPage <
手机端
>获取球员列表
// @Summary <
手机端
>获取球员列表
// @Description <
手机端
>获取球员列表
// @Tags <
手机端
>球员
// @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码"
// @Param data body dto.OrgPlayerGetPageReq true "body"
...
...
@@ -55,10 +55,10 @@ func (e OrgPlayer) GetPage(c *gin.Context) {
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
}
// Get <
球队>获取球员
// @Summary <
球队>获取球员
// @Description <
球队>获取球员
// @Tags <
球队
>球员
// Get <
手机端>获取球员详情
// @Summary <
手机端>获取球员详情
// @Description <
手机端>获取球员详情
// @Tags <
手机端
>球员
// @Param id path string false "id"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-player/{id} [get]
...
...
@@ -97,18 +97,18 @@ func (e OrgPlayer) Get(c *gin.Context) {
}
object
.
TotalScoring
=
replyTotalScoringGetData
.
Scoring
//
赛季总分
//
var reqScoringGetData dto.OrgPlayerDataGetReq
//
reqScoringGetData.PlayerId = strconv.Itoa(object.Id)
//
reqScoringGetData.SeasonId = object.SeasonId
//
//
var replyScoringGetData dto.OrgPlayerDataGetReply
//err = s.GetData
(&reqScoringGetData, p, &replyScoringGetData)
//
if err != nil {
//
e.Error(500, err, fmt.Sprintf("获取球员失败,\r\n失败信息 %s", err.Error()))
//
return
//
}
//
object.SeasonScoring = replyScoringGetData.Scoring
//
参加赛季
var
reqScoringGetData
dto
.
OrgPlayerDataGetReq
reqScoringGetData
.
PlayerId
=
strconv
.
Itoa
(
object
.
Id
)
reqScoringGetData
.
SeasonId
=
object
.
SeasonId
var
replyScoringGetData
dto
.
OrgPlayerDataGetReply
err
=
s
.
GetDataSeason
(
&
reqScoringGetData
,
p
,
&
replyScoringGetData
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取球员失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
object
.
SeasonScoring
=
replyScoringGetData
.
Scoring
//出赛次数
var
reqMatchGetData
dto
.
OrgPlayerDataGetReq
...
...
@@ -124,3 +124,108 @@ func (e OrgPlayer) Get(c *gin.Context) {
e
.
OK
(
object
,
"查询成功"
)
}
// Get <手机端>获取球员赛季数据
// @Summary <手机端>获取球员赛季数据
// @Description <手机端>获取球员赛季数据
// @Tags <手机端>球员
// @Param id path string false "id"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player/info [get]
// @Security Bearer
func
(
e
OrgPlayer
)
GetInfo
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerGetReq
{}
s
:=
service
.
OrgPlayer
{}
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
}
var
object
dto
.
OrgPlayerGetReply
//reqGet := dto.OrgPlayerGetReq{Id: req.Id}
p
:=
actions
.
GetPermissionFromContext
(
c
)
err
=
s
.
Get
(
&
req
,
p
,
&
object
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取球员失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
seasonId
:=
"4"
reply
:=
new
(
dto
.
OrgPlayerGetInfoReply
)
reply
.
OrgPlayerInfo
=
object
replyOrgMatchInfo
:=
new
(
dto
.
OrgMatchInfo
)
err
=
s
.
StatisticsScoringAvg
(
strconv
.
Itoa
(
req
.
Id
),
seasonId
,
"avg"
,
replyOrgMatchInfo
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛球员信息 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
reply
.
OrgMatchInfo
=
*
replyOrgMatchInfo
err
,
matchId
:=
s
.
GetMatchId
(
strconv
.
Itoa
(
req
.
Id
),
seasonId
)
replyGetRoundsScoring
:=
make
([]
dto
.
OrgPlayerRoundsScoring
,
0
)
err
=
s
.
GetRoundsScoring
(
strconv
.
Itoa
(
req
.
Id
),
matchId
,
&
replyGetRoundsScoring
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛球员信息 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
reply
.
RoundsScoring
=
replyGetRoundsScoring
//生涯数据
err
,
matchId2
:=
s
.
GetMatchId
(
strconv
.
Itoa
(
req
.
Id
),
""
)
replyGetRoundsScoring2
:=
make
([]
dto
.
OrgPlayerRoundsScoring
,
0
)
err
=
s
.
GetSeasonRoundsScoring
(
strconv
.
Itoa
(
req
.
Id
),
matchId2
,
&
replyGetRoundsScoring2
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛球员信息 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
//reply.RoundsScoring = replyGetRoundsScoring
//精彩时刻
e
.
OK
(
reply
,
"查询成功"
)
}
// Get <手机端>获取球员精彩时刻
// @Summary <手机端>获取球员精彩时刻
// @Description <手机端>获取球员精彩时刻
// @Tags <手机端>球员
// @Param id path string false "id"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player/evaluate [get]
// @Security Bearer
func
(
e
OrgPlayer
)
GetOrgMatchEvaluate
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerGetOrgMatchEvaluateReq
{}
s
:=
service
.
OrgPlayer
{}
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
}
list
:=
make
([]
dto
.
OrgMatchEvaluate
,
0
)
var
count
int64
//p := actions.GetPermissionFromContext(c)
err
=
s
.
GetOrgMatchEvaluate
(
&
req
,
&
list
,
&
count
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取球员失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
e
.
OK
(
list
,
"查询成功"
)
}
app/mobile/router/org_player.go
View file @
4bcc9c5f
...
...
@@ -16,5 +16,7 @@ func registerOrgPlayerRouter(v1 *gin.RouterGroup) {
{
r
.
GET
(
""
,
api
.
GetPage
)
r
.
GET
(
"/:id"
,
api
.
Get
)
r
.
GET
(
"/info/:id"
,
api
.
GetInfo
)
r
.
GET
(
"/evaluate"
,
api
.
GetOrgMatchEvaluate
)
}
}
app/mobile/service/dto/org_player.go
View file @
4bcc9c5f
...
...
@@ -16,7 +16,7 @@ type OrgPlayerGetPageReq struct {
Status
string
`form:"status" search:"type:exact;column:status;table:op" comment:""`
}
type
OrgPlayerGetPageReply
struct
{
Id
string
`json:"id" comment:"球
队id"`
//球队
id
Id
string
`json:"id" comment:"球
员id"`
//球员
id
ClubId
string
`json:"clubId" comment:"俱乐部id"`
ClubName
string
`json:"clubName" comment:"俱乐部名称"`
TeamId
string
`json:"teamId" comment:"球队id"`
...
...
@@ -30,6 +30,10 @@ type OrgPlayerGetPageReply struct {
Status
string
`json:"status" comment:"状态"`
}
type
MatchId
struct
{
Id
string
`json:"id" `
}
type
OrgPlayerOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:id;table:org_player"`
ClubId
string
`form:"clubIdOrder" search:"type:order;column:club_id;table:org_player"`
...
...
@@ -63,6 +67,67 @@ type OrgPlayerDataGetReply struct {
Scoring
string
`json:"scoring"`
CountMatch
string
`json:"countMatch"`
}
type
OrgPlayerGetInfoReq
struct
{
Id
int
`uri:"id"`
}
type
OrgPlayerGetInfoReply
struct
{
OrgPlayerInfo
OrgPlayerGetReply
`json:"orgPlayerInfo"`
OrgMatchInfo
OrgMatchInfo
`json:"orgMatchInfo"`
RoundsScoring
[]
OrgPlayerRoundsScoring
`json:"roundsScoring"`
}
type
OrgMatchInfo
struct
{
Id
string
`json:"id"`
SeasonId
string
`json:"seasonId" comment:"赛季id"`
SeasonName
string
`json:"seasonName" comment:"赛季名称"`
LeagueName
string
`json:"leagueName" comment:"联赛级别"`
dto
.
TotalScoring
}
type
OrgPlayerRoundsScoring
struct
{
Id
string
`json:"id"`
TeamAScore
string
`json:"teamAScore"`
TeamBScore
string
`json:"teamBScore"`
TeamAName
string
`json:"teamAName"`
TeamBName
string
`json:"teamBName"`
TeamAId
string
`json:"teamAId"`
TeamBId
string
`json:"teamBId"`
MatchStartTime
string
`json:"matchStartTime"`
MatchEndTime
string
`json:"matchEndTime"`
TeamName
string
`json:"teamName"`
dto
.
RoundsScoring
}
type
GetEvaluateInfo
struct
{
Id
string
`json:"id"`
LeagueId
string
`json:"leagueId"`
LeagueName
string
`json:"leagueName"`
SeasonId
string
`json:"seasonId"`
SeasonName
string
`json:"seasonName"`
MatchId
string
`json:"matchId"`
Rounds
string
`json:"rounds"`
}
type
OrgPlayerGetOrgMatchEvaluateReq
struct
{
LeagueId
string
`json:"leagueId"`
SeasonId
string
`json:"seasonId"`
MatchId
string
`json:"matchId"`
Rounds
string
`json:"rounds"`
PlayerId
string
`json:"playerId"`
}
type
OrgPlayerGetOrgMatchEvaluateReply
struct
{
OrgMatchEvaluate
[]
OrgMatchEvaluate
`json:"orgMatchEvaluate"`
}
type
OrgMatchEvaluate
struct
{
Id
string
`json:"id"`
Content
string
`json:"content"`
WonderfulMomentImg
string
`json:"wonderfulMomentImg"`
WonderfulMomentImgTitle
string
`json:"wonderfulMomentImgTitle"`
WonderfulMomentMv
string
`json:"wonderfulMomentMv"`
WonderfulMomentMvTitle
string
`json:"wonderfulMomentMvTitle"`
}
// OrgPlayerGetReq 功能获取请求参数
type
OrgPlayerGetReq
struct
{
...
...
app/mobile/service/org_player.go
View file @
4bcc9c5f
This diff is collapsed.
Click to expand it.
app/operate/service/org_team_player.go
View file @
4bcc9c5f
...
...
@@ -180,7 +180,7 @@ func (e *OrgTeamPlayer) statisticsRankingList(playerId string, seasonId string,
func
(
e
*
OrgTeamPlayer
)
rankingScoring
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
Scoring
>
replyGetPlayerRank
[
j
]
.
Scoring
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Scoring
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Scoring
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
@@ -190,7 +190,7 @@ func (e *OrgTeamPlayer) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamP
}
func
(
e
*
OrgTeamPlayer
)
rankingRebound
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
Rebound
>
replyGetPlayerRank
[
j
]
.
Rebound
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Rebound
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Rebound
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
@@ -200,7 +200,7 @@ func (e *OrgTeamPlayer) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamP
}
func
(
e
*
OrgTeamPlayer
)
rankingAssist
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
Assist
>
replyGetPlayerRank
[
j
]
.
Assist
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Assist
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Assist
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
@@ -210,7 +210,7 @@ func (e *OrgTeamPlayer) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPl
}
func
(
e
*
OrgTeamPlayer
)
rankingSteal
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
Steal
>
replyGetPlayerRank
[
j
]
.
Steal
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Steal
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Steal
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
@@ -220,7 +220,7 @@ func (e *OrgTeamPlayer) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPla
}
func
(
e
*
OrgTeamPlayer
)
rankingFreeThrow
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
FreeThrow
>
replyGetPlayerRank
[
j
]
.
FreeThrow
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
FreeThrow
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
FreeThrow
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
@@ -230,7 +230,7 @@ func (e *OrgTeamPlayer) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTea
}
func
(
e
*
OrgTeamPlayer
)
rankingBlockShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
BlockShot
>
replyGetPlayerRank
[
j
]
.
BlockShot
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
BlockShot
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
BlockShot
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
@@ -240,7 +240,7 @@ func (e *OrgTeamPlayer) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTea
}
func
(
e
*
OrgTeamPlayer
)
rankingFoul
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
Foul
>
replyGetPlayerRank
[
j
]
.
Foul
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Foul
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Foul
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
@@ -250,7 +250,7 @@ func (e *OrgTeamPlayer) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlay
}
func
(
e
*
OrgTeamPlayer
)
rankingTwoPointShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
TwoPointShot
>
replyGetPlayerRank
[
j
]
.
TwoPointShot
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
TwoPointShot
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
TwoPointShot
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
@@ -260,7 +260,7 @@ func (e *OrgTeamPlayer) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatch
}
func
(
e
*
OrgTeamPlayer
)
rankingThreePointShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
replyGetPlayerRank
[
i
]
.
ThreePointShot
>
replyGetPlayerRank
[
j
]
.
ThreePointShot
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
ThreePointShot
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
ThreePointShot
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
...
...
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