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
89cd0fa7
Commit
89cd0fa7
authored
Jan 15, 2022
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
98b9c2b8
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
231 additions
and
140 deletions
+231
-140
org_club_player.go
app/operate/apis/org_club_player.go
+7
-1
org_team.go
app/operate/apis/org_team.go
+22
-15
org_team_team.go
app/operate/apis/org_team_team.go
+21
-22
org_club_team.go
app/operate/service/dto/org_club_team.go
+1
-0
org_team.go
app/operate/service/dto/org_team.go
+1
-0
org_club_player.go
app/operate/service/org_club_player.go
+3
-1
org_club_team.go
app/operate/service/org_club_team.go
+29
-23
org_team.go
app/operate/service/org_team.go
+5
-3
common.go
common/utils/common.go
+7
-2
docs.go
docs/docs.go
+51
-27
swagger.json
docs/swagger.json
+51
-27
swagger.yaml
docs/swagger.yaml
+33
-19
No files found.
app/operate/apis/org_club_player.go
View file @
89cd0fa7
...
@@ -25,7 +25,7 @@ type OrgClubPlayer struct {
...
@@ -25,7 +25,7 @@ type OrgClubPlayer struct {
// @Param pageSize query int false "页条数"
// @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码"
// @Param pageIndex query int false "页码"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-player [get]
// @Router /api/v1/org-
club-
player [get]
// @Security Bearer
// @Security Bearer
func
(
e
OrgClubPlayer
)
GetPage
(
c
*
gin
.
Context
)
{
func
(
e
OrgClubPlayer
)
GetPage
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgClubPlayerGetPageReq
{}
req
:=
dto
.
OrgClubPlayerGetPageReq
{}
...
@@ -77,6 +77,12 @@ func (e OrgClubPlayer) GetPageMatch(c *gin.Context) {
...
@@ -77,6 +77,12 @@ func (e OrgClubPlayer) GetPageMatch(c *gin.Context) {
return
return
}
}
if
req
.
Id
==
""
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
"id不得为空"
)
return
}
p
:=
actions
.
GetPermissionFromContext
(
c
)
p
:=
actions
.
GetPermissionFromContext
(
c
)
reply
:=
new
(
dto
.
GetPageMatchReply
)
reply
:=
new
(
dto
.
GetPageMatchReply
)
...
...
app/operate/apis/org_team.go
View file @
89cd0fa7
...
@@ -76,29 +76,36 @@ func (e OrgTeam) Get(c *gin.Context) {
...
@@ -76,29 +76,36 @@ func (e OrgTeam) Get(c *gin.Context) {
e
.
Error
(
500
,
err
,
err
.
Error
())
e
.
Error
(
500
,
err
,
err
.
Error
())
return
return
}
}
var
object
models
.
OrgTeam
var
object
dto
.
OrgTeamGetPageReply
p
:=
actions
.
GetPermissionFromContext
(
c
)
p
:=
actions
.
GetPermissionFromContext
(
c
)
err
=
s
.
Get
(
&
req
,
p
,
&
object
)
if
err
!=
nil
{
if
req
.
GetId
()
==
0
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取球队失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
if
object
.
ClubId
==
""
{
sOrgClubUser
:=
service
.
OrgClubUser
{}
sOrgClubUser
:=
service
.
OrgClubUser
{}
_
,
object
.
ClubId
=
sOrgClubUser
.
GetClubId
(
user
.
GetUserId
(
c
))
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgClubUser
.
Service
)
}
reqClub
:=
dto
.
OrgClubGetReq
{}
_
,
object
.
ClubId
=
sOrgClubUser
.
GetClubId
(
user
.
GetUserId
(
c
))
sClub
:=
service
.
OrgClub
{}
var
objectClub
models
.
OrgClub
reqClub
.
Id
,
_
=
strconv
.
Atoi
(
object
.
ClubId
)
reqClub
:=
dto
.
OrgClubGetReq
{}
err
=
sClub
.
Get
(
&
reqClub
,
p
,
&
objectClub
)
sClub
:=
service
.
OrgClub
{}
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sClub
.
Service
)
var
objectClub
models
.
OrgClub
reqClub
.
Id
,
_
=
strconv
.
Atoi
(
object
.
ClubId
)
err
=
sClub
.
Get
(
&
reqClub
,
p
,
&
objectClub
)
object
.
ClubName
=
objectClub
.
ClubName
}
else
{
err
=
s
.
Get
(
&
req
,
p
,
&
object
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取球队失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
}
reply
:=
dto
.
OrgTeamGetReply
{}
reply
:=
dto
.
OrgTeamGetReply
{}
reply
.
ClubId
=
object
.
ClubId
reply
.
ClubId
=
object
.
ClubId
reply
.
ClubName
=
object
Club
.
ClubName
reply
.
ClubName
=
object
.
ClubName
reply
.
TeamName
=
object
.
TeamName
reply
.
TeamName
=
object
.
TeamName
e
.
OK
(
object
,
"查询成功"
)
e
.
OK
(
object
,
"查询成功"
)
...
...
app/operate/apis/org_team_team.go
View file @
89cd0fa7
...
@@ -7,7 +7,6 @@ import (
...
@@ -7,7 +7,6 @@ import (
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/api"
_
"github.com/go-admin-team/go-admin-core/sdk/pkg/response"
_
"github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/operate/models"
"go-admin/app/operate/service"
"go-admin/app/operate/service"
"go-admin/app/operate/service/dto"
"go-admin/app/operate/service/dto"
"go-admin/common/actions"
"go-admin/common/actions"
...
@@ -98,26 +97,26 @@ func (e OrgTeamTeam) GetPageMatch(c *gin.Context) {
...
@@ -98,26 +97,26 @@ func (e OrgTeamTeam) GetPageMatch(c *gin.Context) {
// @Router /api/v1/org-team-team/{id} [get]
// @Router /api/v1/org-team-team/{id} [get]
// @Security Bearer
// @Security Bearer
func
(
e
OrgTeamTeam
)
Get
(
c
*
gin
.
Context
)
{
func
(
e
OrgTeamTeam
)
Get
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgTeamGetReq
{}
//
req := dto.OrgTeamGetReq{}
s
:=
service
.
OrgTeam
{}
//
s := service.OrgTeam{}
err
:=
e
.
MakeContext
(
c
)
.
//
err := e.MakeContext(c).
MakeOrm
()
.
//
MakeOrm().
Bind
(
&
req
)
.
//
Bind(&req).
MakeService
(
&
s
.
Service
)
.
//
MakeService(&s.Service).
Errors
//
Errors
if
err
!=
nil
{
//
if err != nil {
e
.
Logger
.
Error
(
err
)
//
e.Logger.Error(err)
e
.
Error
(
500
,
err
,
err
.
Error
())
//
e.Error(500, err, err.Error())
return
//
return
}
//
}
var
object
models
.
OrgTeam
//
var object models.OrgTeam
//
p
:=
actions
.
GetPermissionFromContext
(
c
)
//
p := actions.GetPermissionFromContext(c)
err
=
s
.
Get
(
&
req
,
p
,
&
object
)
//
err = s.Get(&req, p, &object)
if
err
!=
nil
{
//
if err != nil {
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取球队失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
//
e.Error(500, err, fmt.Sprintf("获取球队失败,\r\n失败信息 %s", err.Error()))
return
//
return
}
//
}
e
.
OK
(
object
,
"查询成功"
)
//
e.OK(object, "查询成功")
}
}
app/operate/service/dto/org_club_team.go
View file @
89cd0fa7
...
@@ -15,6 +15,7 @@ type OrgClubTeamGetPageReq struct {
...
@@ -15,6 +15,7 @@ type OrgClubTeamGetPageReq struct {
}
}
type
OrgClubTeamGetPageReply
struct
{
type
OrgClubTeamGetPageReply
struct
{
Id
string
`json:"id"`
TeamId
string
`json:"teamId"`
TeamId
string
`json:"teamId"`
Rank
string
`json:"rank"`
Rank
string
`json:"rank"`
LeagueName
string
`json:"leagueName"`
LeagueName
string
`json:"leagueName"`
...
...
app/operate/service/dto/org_team.go
View file @
89cd0fa7
...
@@ -16,6 +16,7 @@ type OrgTeamGetPageReq struct {
...
@@ -16,6 +16,7 @@ type OrgTeamGetPageReq struct {
type
OrgTeamGetPageReply
struct
{
type
OrgTeamGetPageReply
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:"俱乐部名称"`
ClubName
string
`json:"clubName" comment:"俱乐部名称"`
TeamName
string
`json:"teamName" comment:"球队名称"`
TeamName
string
`json:"teamName" comment:"球队名称"`
CreatedAt
string
`json:"createdAt" comment:"球队创建时间"`
CreatedAt
string
`json:"createdAt" comment:"球队创建时间"`
...
...
app/operate/service/org_club_player.go
View file @
89cd0fa7
...
@@ -22,7 +22,9 @@ func (e *OrgClubPlayer) GetPage(c *dto.OrgClubPlayerGetPageReq, p *actions.DataP
...
@@ -22,7 +22,9 @@ func (e *OrgClubPlayer) GetPage(c *dto.OrgClubPlayerGetPageReq, 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
(
"omtp.id, ol.league_name, os.season_name, om.rounds, omtp.player_name"
)
.
Select
(
"omtp.id, ol.league_name, os.season_name, om.rounds, omtp.player_name, omtp.player_number,omtp.position,"
+
"omtp.scoring, omtp.scoring, omtp.rebound, omtp.assist, omtp.steal, omtp.free_throw, "
+
"omtp.block_shot, omtp.foul, omtp.two_point_shot, omtp.three_point_shot"
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Joins
(
"left join org_league as ol on ol.id = om.league_id"
)
.
Joins
(
"left join org_league as ol on ol.id = om.league_id"
)
.
Joins
(
"left join org_season as os on os.id = om.season_id"
)
.
Joins
(
"left join org_season as os on os.id = om.season_id"
)
.
...
...
app/operate/service/org_club_team.go
View file @
89cd0fa7
...
@@ -131,17 +131,17 @@ func (e *OrgClubTeam) statisticsScoring(teamId string, rounds string, seasonId s
...
@@ -131,17 +131,17 @@ func (e *OrgClubTeam) statisticsScoring(teamId string, rounds string, seasonId s
var
err
error
var
err
error
field
:=
""
field
:=
""
if
statistics
==
"sum"
{
//
if statistics == "sum" {
field
+=
"sum(omtp.scoring)as scoring,"
+
field
+=
"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,"
+
"sum(omtp.steal)as steal,"
+
"sum(omtp.steal)as steal,"
+
"sum(omtp.free_throw)as free_throw,"
+
"sum(omtp.free_throw)as free_throw,"
+
"sum(omtp.block_shot)as block_shot,"
+
"sum(omtp.block_shot)as block_shot,"
+
"sum(omtp.foul)as foul,"
+
"sum(omtp.foul)as foul,"
+
"sum(omtp.two_point_shot)as two_point_shot,"
+
"sum(omtp.two_point_shot)as two_point_shot,"
+
"sum(omtp.three_point_shot)as three_point_shot"
"sum(omtp.three_point_shot)as three_point_shot"
}
//
}
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
...
@@ -151,7 +151,13 @@ func (e *OrgClubTeam) statisticsScoring(teamId string, rounds string, seasonId s
...
@@ -151,7 +151,13 @@ func (e *OrgClubTeam) statisticsScoring(teamId string, rounds string, seasonId s
First
(
data
)
.
Error
First
(
data
)
.
Error
if
statistics
==
"avg"
{
if
statistics
==
"avg"
{
_
,
_
,
teamCount
:=
e
.
GetPageForTeam
(
seasonId
)
var
teamCount
int64
=
0
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Select
(
field
)
.
Scopes
(
cDto
.
SetWhere
(
"om"
,
"season_id"
,
seasonId
))
.
Count
(
&
teamCount
)
.
Error
//_, _, teamCount := e.GetPageForTeam(seasonId)
data
.
Scoring
=
utils
.
GetAvg
(
data
.
Scoring
,
teamCount
)
data
.
Scoring
=
utils
.
GetAvg
(
data
.
Scoring
,
teamCount
)
data
.
Rebound
=
utils
.
GetAvg
(
data
.
Rebound
,
teamCount
)
data
.
Rebound
=
utils
.
GetAvg
(
data
.
Rebound
,
teamCount
)
...
@@ -222,7 +228,7 @@ func (e *OrgClubTeam) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamPla
...
@@ -222,7 +228,7 @@ func (e *OrgClubTeam) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamPla
return
replyGetPlayerRank
[
i
]
.
Scoring
>
replyGetPlayerRank
[
j
]
.
Scoring
return
replyGetPlayerRank
[
i
]
.
Scoring
>
replyGetPlayerRank
[
j
]
.
Scoring
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Scoring
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
Scoring
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -232,7 +238,7 @@ func (e *OrgClubTeam) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamPla
...
@@ -232,7 +238,7 @@ func (e *OrgClubTeam) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamPla
return
replyGetPlayerRank
[
i
]
.
Rebound
>
replyGetPlayerRank
[
j
]
.
Rebound
return
replyGetPlayerRank
[
i
]
.
Rebound
>
replyGetPlayerRank
[
j
]
.
Rebound
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Rebound
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
Rebound
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -242,7 +248,7 @@ func (e *OrgClubTeam) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPlay
...
@@ -242,7 +248,7 @@ func (e *OrgClubTeam) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPlay
return
replyGetPlayerRank
[
i
]
.
Assist
>
replyGetPlayerRank
[
j
]
.
Assist
return
replyGetPlayerRank
[
i
]
.
Assist
>
replyGetPlayerRank
[
j
]
.
Assist
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Assist
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
Assist
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -252,7 +258,7 @@ func (e *OrgClubTeam) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPlaye
...
@@ -252,7 +258,7 @@ func (e *OrgClubTeam) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPlaye
return
replyGetPlayerRank
[
i
]
.
Steal
>
replyGetPlayerRank
[
j
]
.
Steal
return
replyGetPlayerRank
[
i
]
.
Steal
>
replyGetPlayerRank
[
j
]
.
Steal
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Steal
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
Steal
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -262,7 +268,7 @@ func (e *OrgClubTeam) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTeamP
...
@@ -262,7 +268,7 @@ func (e *OrgClubTeam) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTeamP
return
replyGetPlayerRank
[
i
]
.
FreeThrow
>
replyGetPlayerRank
[
j
]
.
FreeThrow
return
replyGetPlayerRank
[
i
]
.
FreeThrow
>
replyGetPlayerRank
[
j
]
.
FreeThrow
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
FreeThrow
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
FreeThrow
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -272,7 +278,7 @@ func (e *OrgClubTeam) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTeamP
...
@@ -272,7 +278,7 @@ func (e *OrgClubTeam) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTeamP
return
replyGetPlayerRank
[
i
]
.
BlockShot
>
replyGetPlayerRank
[
j
]
.
BlockShot
return
replyGetPlayerRank
[
i
]
.
BlockShot
>
replyGetPlayerRank
[
j
]
.
BlockShot
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
BlockShot
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
BlockShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -282,7 +288,7 @@ func (e *OrgClubTeam) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlayer
...
@@ -282,7 +288,7 @@ func (e *OrgClubTeam) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlayer
return
replyGetPlayerRank
[
i
]
.
Foul
>
replyGetPlayerRank
[
j
]
.
Foul
return
replyGetPlayerRank
[
i
]
.
Foul
>
replyGetPlayerRank
[
j
]
.
Foul
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Foul
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
Foul
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -292,7 +298,7 @@ func (e *OrgClubTeam) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatchTe
...
@@ -292,7 +298,7 @@ func (e *OrgClubTeam) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatchTe
return
replyGetPlayerRank
[
i
]
.
TwoPointShot
>
replyGetPlayerRank
[
j
]
.
TwoPointShot
return
replyGetPlayerRank
[
i
]
.
TwoPointShot
>
replyGetPlayerRank
[
j
]
.
TwoPointShot
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
TwoPointShot
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
TwoPointShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -302,7 +308,7 @@ func (e *OrgClubTeam) rankingThreePointShot(replyGetPlayerRank []models.OrgMatch
...
@@ -302,7 +308,7 @@ func (e *OrgClubTeam) rankingThreePointShot(replyGetPlayerRank []models.OrgMatch
return
replyGetPlayerRank
[
i
]
.
ThreePointShot
>
replyGetPlayerRank
[
j
]
.
ThreePointShot
return
replyGetPlayerRank
[
i
]
.
ThreePointShot
>
replyGetPlayerRank
[
j
]
.
ThreePointShot
})
})
for
k
,
v
:=
range
replyGetPlayerRank
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
ThreePointShot
=
strconv
.
Itoa
(
k
+
1
)
scoring
.
ThreePointShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
}
...
@@ -310,7 +316,7 @@ func (e *OrgClubTeam) rankingThreePointShot(replyGetPlayerRank []models.OrgMatch
...
@@ -310,7 +316,7 @@ func (e *OrgClubTeam) rankingThreePointShot(replyGetPlayerRank []models.OrgMatch
func
(
e
*
OrgClubTeam
)
statisticsRanking
(
seasonId
string
,
data
*
[]
models
.
OrgMatchTeamPlayer
)
error
{
func
(
e
*
OrgClubTeam
)
statisticsRanking
(
seasonId
string
,
data
*
[]
models
.
OrgMatchTeamPlayer
)
error
{
var
err
error
var
err
error
field
:=
"team_id,"
+
field
:=
"
omtp.
team_id,"
+
"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,"
+
...
@@ -324,7 +330,7 @@ func (e *OrgClubTeam) statisticsRanking(seasonId string, data *[]models.OrgMatch
...
@@ -324,7 +330,7 @@ func (e *OrgClubTeam) statisticsRanking(seasonId string, data *[]models.OrgMatch
Select
(
field
)
.
Select
(
field
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Where
(
"om.season_id = ?"
,
seasonId
)
.
Where
(
"om.season_id = ?"
,
seasonId
)
.
Group
(
"team_id"
)
.
Group
(
"
omtp.
team_id"
)
.
Find
(
&
data
)
.
Error
Find
(
&
data
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
...
...
app/operate/service/org_team.go
View file @
89cd0fa7
...
@@ -22,7 +22,7 @@ func (e *OrgTeam) GetPage(c *dto.OrgTeamGetPageReq, p *actions.DataPermission, l
...
@@ -22,7 +22,7 @@ func (e *OrgTeam) GetPage(c *dto.OrgTeamGetPageReq, p *actions.DataPermission, l
var
data
models
.
OrgTeam
var
data
models
.
OrgTeam
err
=
e
.
Orm
.
Table
(
"org_team as ot"
)
.
err
=
e
.
Orm
.
Table
(
"org_team as ot"
)
.
Select
(
"ot.id,oc.club_name,ot.team_name,ot.created_at"
)
.
Select
(
"ot.id,oc.
id as club_id,oc.
club_name,ot.team_name,ot.created_at"
)
.
Joins
(
"left join org_club as oc on ot.club_id=oc.id"
)
.
Joins
(
"left join org_club as oc on ot.club_id=oc.id"
)
.
Scopes
(
Scopes
(
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
...
@@ -39,10 +39,12 @@ func (e *OrgTeam) GetPage(c *dto.OrgTeamGetPageReq, p *actions.DataPermission, l
...
@@ -39,10 +39,12 @@ func (e *OrgTeam) GetPage(c *dto.OrgTeamGetPageReq, p *actions.DataPermission, l
}
}
// Get 获取OrgTeam对象
// Get 获取OrgTeam对象
func
(
e
*
OrgTeam
)
Get
(
d
*
dto
.
OrgTeamGetReq
,
p
*
actions
.
DataPermission
,
model
*
models
.
OrgTeam
)
error
{
func
(
e
*
OrgTeam
)
Get
(
d
*
dto
.
OrgTeamGetReq
,
p
*
actions
.
DataPermission
,
model
*
dto
.
OrgTeamGetPageReply
)
error
{
var
data
models
.
OrgTeam
var
data
models
.
OrgTeam
err
:=
e
.
Orm
.
Model
(
&
data
)
.
err
:=
e
.
Orm
.
Table
(
"org_team as ot"
)
.
Select
(
"ot.id,oc.id as club_id,oc.club_name,ot.team_name,ot.created_at"
)
.
Joins
(
"left join org_club as oc on ot.club_id=oc.id"
)
.
Scopes
(
Scopes
(
actions
.
Permission
(
data
.
TableName
(),
p
),
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
)
.
...
...
common/utils/common.go
View file @
89cd0fa7
package
utils
package
utils
import
"strconv"
import
(
"fmt"
"strconv"
)
func
StringToInt
(
data
string
)
int
{
func
StringToInt
(
data
string
)
int
{
reply
,
_
:=
strconv
.
Atoi
(
data
)
reply
,
_
:=
strconv
.
Atoi
(
data
)
...
@@ -8,5 +11,7 @@ func StringToInt(data string) int {
...
@@ -8,5 +11,7 @@ func StringToInt(data string) int {
}
}
func
GetAvg
(
data
string
,
count
int64
)
string
{
func
GetAvg
(
data
string
,
count
int64
)
string
{
return
strconv
.
Itoa
(
StringToInt
(
data
)
/
int
(
count
))
floatData
,
_
:=
strconv
.
ParseFloat
(
data
,
64
)
res
:=
fmt
.
Sprintf
(
"%.2f"
,
floatData
/
float64
(
count
))
return
res
}
}
docs/docs.go
View file @
89cd0fa7
...
@@ -1309,6 +1309,42 @@ var doc = `{
...
@@ -1309,6 +1309,42 @@ var doc = `{
}
}
}
}
},
},
"/api/v1/org-club-player": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "\u003c俱乐部\u003e获取球员数据列表",
"tags": [
"\u003c俱乐部\u003e球员"
],
"summary": "\u003c俱乐部\u003e获取球员数据列表",
"parameters": [
{
"type": "integer",
"description": "页条数",
"name": "pageSize",
"in": "query"
},
{
"type": "integer",
"description": "页码",
"name": "pageIndex",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"code\": 200, \"data\": [...]}",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/org-club-player/get": {
"/api/v1/org-club-player/get": {
"get": {
"get": {
"security": [
"security": [
...
@@ -2893,11 +2929,11 @@ var doc = `{
...
@@ -2893,11 +2929,11 @@ var doc = `{
"Bearer": []
"Bearer": []
}
}
],
],
"description": "\u003c
俱乐部\u003e获取球员数据
列表",
"description": "\u003c
球队\u003e获取球员
列表",
"tags": [
"tags": [
"\u003c
俱乐部
\u003e球员"
"\u003c
球队
\u003e球员"
],
],
"summary": "\u003c
俱乐部\u003e获取球员数据
列表",
"summary": "\u003c
球队\u003e获取球员
列表",
"parameters": [
"parameters": [
{
{
"type": "integer",
"type": "integer",
...
@@ -8402,12 +8438,21 @@ var doc = `{
...
@@ -8402,12 +8438,21 @@ var doc = `{
"models.SysDept": {
"models.SysDept": {
"type": "object",
"type": "object",
"properties": {
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SysDept"
}
},
"createBy": {
"createBy": {
"type": "integer"
"type": "integer"
},
},
"createdAt": {
"createdAt": {
"type": "string"
"type": "string"
},
},
"dataScope": {
"type": "string"
},
"deptId": {
"deptId": {
"description": "部门编码",
"description": "部门编码",
"type": "integer"
"type": "integer"
...
@@ -8427,6 +8472,9 @@ var doc = `{
...
@@ -8427,6 +8472,9 @@ var doc = `{
"description": "负责人",
"description": "负责人",
"type": "string"
"type": "string"
},
},
"params": {
"type": "string"
},
"parentId": {
"parentId": {
"description": "上级部门",
"description": "上级部门",
"type": "integer"
"type": "integer"
...
@@ -8457,21 +8505,9 @@ var doc = `{
...
@@ -8457,21 +8505,9 @@ var doc = `{
"action": {
"action": {
"type": "string"
"type": "string"
},
},
"apis": {
"type": "array",
"items": {
"type": "integer"
}
},
"breadcrumb": {
"breadcrumb": {
"type": "string"
"type": "string"
},
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SysMenu"
}
},
"component": {
"component": {
"type": "string"
"type": "string"
},
},
...
@@ -8481,18 +8517,12 @@ var doc = `{
...
@@ -8481,18 +8517,12 @@ var doc = `{
"createdAt": {
"createdAt": {
"type": "string"
"type": "string"
},
},
"dataScope": {
"type": "string"
},
"icon": {
"icon": {
"type": "string"
"type": "string"
},
},
"isFrame": {
"isFrame": {
"type": "string"
"type": "string"
},
},
"is_select": {
"type": "boolean"
},
"menuId": {
"menuId": {
"type": "integer"
"type": "integer"
},
},
...
@@ -8505,9 +8535,6 @@ var doc = `{
...
@@ -8505,9 +8535,6 @@ var doc = `{
"noCache": {
"noCache": {
"type": "boolean"
"type": "boolean"
},
},
"params": {
"type": "string"
},
"parentId": {
"parentId": {
"type": "integer"
"type": "integer"
},
},
...
@@ -8520,9 +8547,6 @@ var doc = `{
...
@@ -8520,9 +8547,6 @@ var doc = `{
"permission": {
"permission": {
"type": "string"
"type": "string"
},
},
"roleId": {
"type": "integer"
},
"sort": {
"sort": {
"type": "integer"
"type": "integer"
},
},
...
...
docs/swagger.json
View file @
89cd0fa7
...
@@ -1292,6 +1292,42 @@
...
@@ -1292,6 +1292,42 @@
}
}
}
}
},
},
"/api/v1/org-club-player"
:
{
"get"
:
{
"security"
:
[
{
"Bearer"
:
[]
}
],
"description"
:
"
\u
003c俱乐部
\u
003e获取球员数据列表"
,
"tags"
:
[
"
\u
003c俱乐部
\u
003e球员"
],
"summary"
:
"
\u
003c俱乐部
\u
003e获取球员数据列表"
,
"parameters"
:
[
{
"type"
:
"integer"
,
"description"
:
"页条数"
,
"name"
:
"pageSize"
,
"in"
:
"query"
},
{
"type"
:
"integer"
,
"description"
:
"页码"
,
"name"
:
"pageIndex"
,
"in"
:
"query"
}
],
"responses"
:
{
"200"
:
{
"description"
:
"{
\"
code
\"
: 200,
\"
data
\"
: [...]}"
,
"schema"
:
{
"type"
:
"string"
}
}
}
}
},
"/api/v1/org-club-player/get"
:
{
"/api/v1/org-club-player/get"
:
{
"get"
:
{
"get"
:
{
"security"
:
[
"security"
:
[
...
@@ -2876,11 +2912,11 @@
...
@@ -2876,11 +2912,11 @@
"Bearer"
:
[]
"Bearer"
:
[]
}
}
],
],
"description"
:
"
\u
003c
俱乐部
\u
003e获取球员数据
列表"
,
"description"
:
"
\u
003c
球队
\u
003e获取球员
列表"
,
"tags"
:
[
"tags"
:
[
"
\u
003c
俱乐部
\u
003e球员"
"
\u
003c
球队
\u
003e球员"
],
],
"summary"
:
"
\u
003c
俱乐部
\u
003e获取球员数据
列表"
,
"summary"
:
"
\u
003c
球队
\u
003e获取球员
列表"
,
"parameters"
:
[
"parameters"
:
[
{
{
"type"
:
"integer"
,
"type"
:
"integer"
,
...
@@ -8385,12 +8421,21 @@
...
@@ -8385,12 +8421,21 @@
"models.SysDept"
:
{
"models.SysDept"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"properties"
:
{
"properties"
:
{
"children"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"#/definitions/models.SysDept"
}
},
"createBy"
:
{
"createBy"
:
{
"type"
:
"integer"
"type"
:
"integer"
},
},
"createdAt"
:
{
"createdAt"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"dataScope"
:
{
"type"
:
"string"
},
"deptId"
:
{
"deptId"
:
{
"description"
:
"部门编码"
,
"description"
:
"部门编码"
,
"type"
:
"integer"
"type"
:
"integer"
...
@@ -8410,6 +8455,9 @@
...
@@ -8410,6 +8455,9 @@
"description"
:
"负责人"
,
"description"
:
"负责人"
,
"type"
:
"string"
"type"
:
"string"
},
},
"params"
:
{
"type"
:
"string"
},
"parentId"
:
{
"parentId"
:
{
"description"
:
"上级部门"
,
"description"
:
"上级部门"
,
"type"
:
"integer"
"type"
:
"integer"
...
@@ -8440,21 +8488,9 @@
...
@@ -8440,21 +8488,9 @@
"action"
:
{
"action"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"apis"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"integer"
}
},
"breadcrumb"
:
{
"breadcrumb"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"children"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"#/definitions/models.SysMenu"
}
},
"component"
:
{
"component"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
...
@@ -8464,18 +8500,12 @@
...
@@ -8464,18 +8500,12 @@
"createdAt"
:
{
"createdAt"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"dataScope"
:
{
"type"
:
"string"
},
"icon"
:
{
"icon"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"isFrame"
:
{
"isFrame"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"is_select"
:
{
"type"
:
"boolean"
},
"menuId"
:
{
"menuId"
:
{
"type"
:
"integer"
"type"
:
"integer"
},
},
...
@@ -8488,9 +8518,6 @@
...
@@ -8488,9 +8518,6 @@
"noCache"
:
{
"noCache"
:
{
"type"
:
"boolean"
"type"
:
"boolean"
},
},
"params"
:
{
"type"
:
"string"
},
"parentId"
:
{
"parentId"
:
{
"type"
:
"integer"
"type"
:
"integer"
},
},
...
@@ -8503,9 +8530,6 @@
...
@@ -8503,9 +8530,6 @@
"permission"
:
{
"permission"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"roleId"
:
{
"type"
:
"integer"
},
"sort"
:
{
"sort"
:
{
"type"
:
"integer"
"type"
:
"integer"
},
},
...
...
docs/swagger.yaml
View file @
89cd0fa7
...
@@ -1425,10 +1425,16 @@ definitions:
...
@@ -1425,10 +1425,16 @@ definitions:
type
:
object
type
:
object
models.SysDept
:
models.SysDept
:
properties
:
properties
:
children
:
items
:
$ref
:
'
#/definitions/models.SysDept'
type
:
array
createBy
:
createBy
:
type
:
integer
type
:
integer
createdAt
:
createdAt
:
type
:
string
type
:
string
dataScope
:
type
:
string
deptId
:
deptId
:
description
:
部门编码
description
:
部门编码
type
:
integer
type
:
integer
...
@@ -1443,6 +1449,8 @@ definitions:
...
@@ -1443,6 +1449,8 @@ definitions:
leader
:
leader
:
description
:
负责人
description
:
负责人
type
:
string
type
:
string
params
:
type
:
string
parentId
:
parentId
:
description
:
上级部门
description
:
上级部门
type
:
integer
type
:
integer
...
@@ -1464,28 +1472,16 @@ definitions:
...
@@ -1464,28 +1472,16 @@ definitions:
properties
:
properties
:
action
:
action
:
type
:
string
type
:
string
apis
:
items
:
type
:
integer
type
:
array
breadcrumb
:
breadcrumb
:
type
:
string
type
:
string
children
:
items
:
$ref
:
'
#/definitions/models.SysMenu'
type
:
array
component
:
component
:
type
:
string
type
:
string
createBy
:
createBy
:
type
:
integer
type
:
integer
createdAt
:
createdAt
:
type
:
string
type
:
string
dataScope
:
type
:
string
icon
:
icon
:
type
:
string
type
:
string
is_select
:
type
:
boolean
isFrame
:
isFrame
:
type
:
string
type
:
string
menuId
:
menuId
:
...
@@ -1496,8 +1492,6 @@ definitions:
...
@@ -1496,8 +1492,6 @@ definitions:
type
:
string
type
:
string
noCache
:
noCache
:
type
:
boolean
type
:
boolean
params
:
type
:
string
parentId
:
parentId
:
type
:
integer
type
:
integer
path
:
path
:
...
@@ -1506,8 +1500,6 @@ definitions:
...
@@ -1506,8 +1500,6 @@ definitions:
type
:
string
type
:
string
permission
:
permission
:
type
:
string
type
:
string
roleId
:
type
:
integer
sort
:
sort
:
type
:
integer
type
:
integer
sysApi
:
sysApi
:
...
@@ -2512,6 +2504,28 @@ paths:
...
@@ -2512,6 +2504,28 @@ paths:
summary
:
<俱乐部>创建俱乐部
summary
:
<俱乐部>创建俱乐部
tags
:
tags
:
-
<俱乐部>俱乐部
-
<俱乐部>俱乐部
/api/v1/org-club-player
:
get
:
description
:
<俱乐部>获取球员数据列表
parameters
:
-
description
:
页条数
in
:
query
name
:
pageSize
type
:
integer
-
description
:
页码
in
:
query
name
:
pageIndex
type
:
integer
responses
:
"
200"
:
description
:
'
{"code":
200,
"data":
[...]}'
schema
:
type
:
string
security
:
-
Bearer
:
[]
summary
:
<俱乐部>获取球员数据列表
tags
:
-
<俱乐部>球员
/api/v1/org-club-player/get
:
/api/v1/org-club-player/get
:
get
:
get
:
description
:
<俱乐部>获取球员比赛详情
description
:
<俱乐部>获取球员比赛详情
...
@@ -3496,7 +3510,7 @@ paths:
...
@@ -3496,7 +3510,7 @@ paths:
tags
:
tags
:
-
<球队>球员
-
<球队>球员
get
:
get
:
description
:
<
俱乐部>获取球员数据
列表
description
:
<
球队>获取球员
列表
parameters
:
parameters
:
-
description
:
页条数
-
description
:
页条数
in
:
query
in
:
query
...
@@ -3513,9 +3527,9 @@ paths:
...
@@ -3513,9 +3527,9 @@ paths:
type
:
string
type
:
string
security
:
security
:
-
Bearer
:
[]
-
Bearer
:
[]
summary
:
<
俱乐部>获取球员数据
列表
summary
:
<
球队>获取球员
列表
tags
:
tags
:
-
<
俱乐部
>球员
-
<
球队
>球员
post
:
post
:
consumes
:
consumes
:
-
application/json
-
application/json
...
...
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