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
1539b3c7
Commit
1539b3c7
authored
Jan 15, 2022
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
e5105abb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
34 deletions
+59
-34
org_team_team.go
app/operate/apis/org_team_team.go
+26
-7
org_club_team.go
app/operate/service/org_club_team.go
+1
-4
org_match_evaluate.go
app/operate/service/org_match_evaluate.go
+1
-0
org_team_match.go
app/operate/service/org_team_match.go
+1
-0
org_team_match_evaluate.go
app/operate/service/org_team_match_evaluate.go
+1
-0
org_team_player.go
app/operate/service/org_team_player.go
+1
-0
org_team_team.go
app/operate/service/org_team_team.go
+27
-23
org_team_user.go
app/operate/service/org_team_user.go
+1
-0
No files found.
app/operate/apis/org_team_team.go
View file @
1539b3c7
...
...
@@ -2,6 +2,8 @@ package apis
import
(
"fmt"
cDto
"go-admin/common/dto"
"strconv"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
...
...
@@ -62,8 +64,8 @@ func (e OrgTeamTeam) GetPage(c *gin.Context) {
// @Router /api/v1/org-team-team/get-match [get]
// @Security Bearer
func
(
e
OrgTeamTeam
)
GetPageMatch
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgTeamGetPage
Req
{}
s
:=
service
.
OrgTeam
{}
req
:=
dto
.
GetPageMatchTeamTeam
Req
{}
s
:=
service
.
OrgTeam
Team
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
...
...
@@ -76,16 +78,33 @@ func (e OrgTeamTeam) GetPageMatch(c *gin.Context) {
}
p
:=
actions
.
GetPermissionFromContext
(
c
)
list
:=
make
([]
dto
.
OrgTeamGetPageReply
,
0
)
var
count
int64
reply
:=
new
(
dto
.
GetPageMatchReply
)
err
=
s
.
GetPage
(
&
req
,
p
,
&
list
,
&
count
)
replyGetMatchInfo
:=
new
(
cDto
.
PageMatchInfo
)
err
=
s
.
GetMatchInfo
(
strconv
.
Itoa
(
req
.
TeamId
),
p
,
replyGetMatchInfo
)
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
}
reply
.
MatchInfo
=
*
replyGetMatchInfo
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
replyGetRoundsScoring
:=
make
([]
cDto
.
RoundsScoring
,
0
)
err
=
s
.
GetRoundsScoring
(
replyGetMatchInfo
.
PlayerId
,
replyGetMatchInfo
.
Rounds
,
&
replyGetRoundsScoring
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛球员信息 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
reply
.
RoundsScoring
=
replyGetRoundsScoring
replyGetTotalScoring
:=
make
([]
cDto
.
TotalScoring
,
0
)
err
=
s
.
GetTotalScoring
(
replyGetMatchInfo
.
PlayerId
,
replyGetMatchInfo
.
Rounds
,
replyGetMatchInfo
.
SeasonId
,
&
replyGetTotalScoring
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛球员信息 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
reply
.
TotalScoring
=
replyGetTotalScoring
e
.
OK
(
reply
,
"查询成功"
)
}
// Get <球队>获取球队表现比赛详情
...
...
app/operate/service/org_club_team.go
View file @
1539b3c7
...
...
@@ -35,7 +35,7 @@ func (e *OrgClubTeam) GetPage(c *dto.OrgClubTeamGetPageReq, p *actions.DataPermi
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
data
.
TableName
(),
p
),
cDto
.
PassDel
(
"om
pt
"
),
cDto
.
PassDel
(
"om
tp
"
),
)
.
Group
(
"omtp.team_id"
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
...
...
@@ -132,7 +132,6 @@ func (e *OrgClubTeam) statisticsScoring(teamId string, rounds string, seasonId s
var
err
error
field
:=
""
//if statistics == "sum" {
field
+=
"sum(omtp.scoring)as scoring,"
+
"sum(omtp.rebound)as rebound,"
+
"sum(omtp.assist)as assist,"
+
...
...
@@ -142,7 +141,6 @@ func (e *OrgClubTeam) statisticsScoring(teamId string, rounds string, seasonId s
"sum(omtp.foul)as foul,"
+
"sum(omtp.two_point_shot)as two_point_shot,"
+
"sum(omtp.three_point_shot)as three_point_shot"
//}
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"
)
.
...
...
@@ -158,7 +156,6 @@ func (e *OrgClubTeam) statisticsScoring(teamId string, rounds string, seasonId s
Select
(
field
)
.
Scopes
(
cDto
.
SetWhere
(
"om"
,
"season_id"
,
seasonId
))
.
Count
(
&
teamCount
)
.
Error
//_, _, teamCount := e.GetPageForTeam(seasonId)
data
.
Scoring
=
utils
.
GetAvg
(
data
.
Scoring
,
teamCount
)
data
.
Rebound
=
utils
.
GetAvg
(
data
.
Rebound
,
teamCount
)
...
...
app/operate/service/org_match_evaluate.go
View file @
1539b3c7
...
...
@@ -32,6 +32,7 @@ func (e *OrgMatchEvaluate) GetPage(c *dto.OrgMatchEvaluateGetPageReq, p *actions
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
"omtp"
,
p
),
cDto
.
PassDel
(
"omtp"
),
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Count
(
count
)
.
Error
...
...
app/operate/service/org_team_match.go
View file @
1539b3c7
...
...
@@ -34,6 +34,7 @@ func (e *OrgTeamMatch) GetPage(c *dto.OrgTeamMatchGetPageReq, p *actions.DataPer
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
data
.
TableName
(),
p
),
cDto
.
PassDel
(
"om"
),
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Count
(
count
)
.
Error
...
...
app/operate/service/org_team_match_evaluate.go
View file @
1539b3c7
...
...
@@ -32,6 +32,7 @@ func (e *OrgTeamMatchEvaluate) GetPage(c *dto.OrgMatchEvaluateGetPageReq, p *act
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
"omtp"
,
p
),
cDto
.
PassDel
(
"omtp"
),
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Count
(
count
)
.
Error
...
...
app/operate/service/org_team_player.go
View file @
1539b3c7
...
...
@@ -30,6 +30,7 @@ func (e *OrgTeamPlayer) GetPage(c *dto.OrgTeamPlayerGetPageReq, p *actions.DataP
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
"omtp"
,
p
),
cDto
.
PassDel
(
"omtp"
),
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Count
(
count
)
.
Error
...
...
app/operate/service/org_team_team.go
View file @
1539b3c7
...
...
@@ -35,6 +35,7 @@ func (e *OrgTeamTeam) GetPage(c *dto.OrgTeamTeamGetPageReq, p *actions.DataPermi
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
data
.
TableName
(),
p
),
cDto
.
PassDel
(
"omtp"
),
)
.
Group
(
"omtp.team_id"
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
...
...
@@ -131,17 +132,15 @@ func (e *OrgTeamTeam) statisticsScoring(teamId string, rounds string, seasonId s
var
err
error
field
:=
""
if
statistics
==
"sum"
{
field
+=
"sum(omtp.scoring)as scoring,"
+
"sum(omtp.rebound)as rebound,"
+
"sum(omtp.assist)as assist,"
+
"sum(omtp.steal)as steal,"
+
"sum(omtp.free_throw)as free_throw,"
+
"sum(omtp.block_shot)as block_shot,"
+
"sum(omtp.foul)as foul,"
+
"sum(omtp.two_point_shot)as two_point_shot,"
+
"sum(omtp.three_point_shot)as three_point_shot"
}
field
+=
"sum(omtp.scoring)as scoring,"
+
"sum(omtp.rebound)as rebound,"
+
"sum(omtp.assist)as assist,"
+
"sum(omtp.steal)as steal,"
+
"sum(omtp.free_throw)as free_throw,"
+
"sum(omtp.block_shot)as block_shot,"
+
"sum(omtp.foul)as foul,"
+
"sum(omtp.two_point_shot)as two_point_shot,"
+
"sum(omtp.three_point_shot)as three_point_shot"
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"
)
.
...
...
@@ -151,7 +150,12 @@ func (e *OrgTeamTeam) statisticsScoring(teamId string, rounds string, seasonId s
First
(
data
)
.
Error
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
data
.
Scoring
=
utils
.
GetAvg
(
data
.
Scoring
,
teamCount
)
data
.
Rebound
=
utils
.
GetAvg
(
data
.
Rebound
,
teamCount
)
...
...
@@ -222,7 +226,7 @@ func (e *OrgTeamTeam) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamPla
return
replyGetPlayerRank
[
i
]
.
Scoring
>
replyGetPlayerRank
[
j
]
.
Scoring
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Scoring
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -232,7 +236,7 @@ func (e *OrgTeamTeam) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamPla
return
replyGetPlayerRank
[
i
]
.
Rebound
>
replyGetPlayerRank
[
j
]
.
Rebound
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Rebound
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -242,7 +246,7 @@ func (e *OrgTeamTeam) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPlay
return
replyGetPlayerRank
[
i
]
.
Assist
>
replyGetPlayerRank
[
j
]
.
Assist
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Assist
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -252,7 +256,7 @@ func (e *OrgTeamTeam) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPlaye
return
replyGetPlayerRank
[
i
]
.
Steal
>
replyGetPlayerRank
[
j
]
.
Steal
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Steal
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -262,7 +266,7 @@ func (e *OrgTeamTeam) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTeamP
return
replyGetPlayerRank
[
i
]
.
FreeThrow
>
replyGetPlayerRank
[
j
]
.
FreeThrow
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
FreeThrow
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -272,7 +276,7 @@ func (e *OrgTeamTeam) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTeamP
return
replyGetPlayerRank
[
i
]
.
BlockShot
>
replyGetPlayerRank
[
j
]
.
BlockShot
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
BlockShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -282,7 +286,7 @@ func (e *OrgTeamTeam) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlayer
return
replyGetPlayerRank
[
i
]
.
Foul
>
replyGetPlayerRank
[
j
]
.
Foul
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
Foul
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -292,7 +296,7 @@ func (e *OrgTeamTeam) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatchTe
return
replyGetPlayerRank
[
i
]
.
TwoPointShot
>
replyGetPlayerRank
[
j
]
.
TwoPointShot
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
TwoPointShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -302,7 +306,7 @@ func (e *OrgTeamTeam) rankingThreePointShot(replyGetPlayerRank []models.OrgMatch
return
replyGetPlayerRank
[
i
]
.
ThreePointShot
>
replyGetPlayerRank
[
j
]
.
ThreePointShot
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
Player
Id
==
playerId
{
if
v
.
Team
Id
==
playerId
{
scoring
.
ThreePointShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
...
...
@@ -310,7 +314,7 @@ func (e *OrgTeamTeam) rankingThreePointShot(replyGetPlayerRank []models.OrgMatch
func
(
e
*
OrgTeamTeam
)
statisticsRanking
(
seasonId
string
,
data
*
[]
models
.
OrgMatchTeamPlayer
)
error
{
var
err
error
field
:=
"team_id,"
+
field
:=
"
omtp.
team_id,"
+
"sum(omtp.scoring)as scoring,"
+
"sum(omtp.rebound)as rebound,"
+
"sum(omtp.assist)as assist,"
+
...
...
@@ -324,7 +328,7 @@ func (e *OrgTeamTeam) statisticsRanking(seasonId string, data *[]models.OrgMatch
Select
(
field
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Where
(
"om.season_id = ?"
,
seasonId
)
.
Group
(
"team_id"
)
.
Group
(
"
omtp.
team_id"
)
.
Find
(
&
data
)
.
Error
if
err
!=
nil
{
...
...
app/operate/service/org_team_user.go
View file @
1539b3c7
...
...
@@ -33,6 +33,7 @@ func (e *OrgTeamUser) GetPage(c *dto.OrgTeamUserGetPageReq, p *actions.DataPermi
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
data
.
TableName
(),
p
),
cDto
.
PassDel
(
"otu"
),
)
.
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