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
3 years ago
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生涯
parent
74495b09
master
No related merge requests found
Changes
5
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 {
...
@@ -15,10 +15,10 @@ type OrgPlayer struct {
api
.
Api
api
.
Api
}
}
// GetPage <
球队
>获取球员列表
// GetPage <
手机端
>获取球员列表
// @Summary <
球队
>获取球员列表
// @Summary <
手机端
>获取球员列表
// @Description <
球队
>获取球员列表
// @Description <
手机端
>获取球员列表
// @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.OrgPlayerGetPageReq true "body"
// @Param data body dto.OrgPlayerGetPageReq true "body"
...
@@ -55,10 +55,10 @@ func (e OrgPlayer) GetPage(c *gin.Context) {
...
@@ -55,10 +55,10 @@ func (e OrgPlayer) GetPage(c *gin.Context) {
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
}
}
// Get <
球队>获取球员
// Get <
手机端>获取球员详情
// @Summary <
球队>获取球员
// @Summary <
手机端>获取球员详情
// @Description <
球队>获取球员
// @Description <
手机端>获取球员详情
// @Tags <
球队
>球员
// @Tags <
手机端
>球员
// @Param id path string false "id"
// @Param id path string false "id"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-player/{id} [get]
// @Router /api/v1/org-player/{id} [get]
...
@@ -97,18 +97,18 @@ func (e OrgPlayer) Get(c *gin.Context) {
...
@@ -97,18 +97,18 @@ func (e OrgPlayer) Get(c *gin.Context) {
}
}
object
.
TotalScoring
=
replyTotalScoringGetData
.
Scoring
object
.
TotalScoring
=
replyTotalScoringGetData
.
Scoring
//
赛季总分
//
参加赛季
//
var reqScoringGetData dto.OrgPlayerDataGetReq
var
reqScoringGetData
dto
.
OrgPlayerDataGetReq
//
reqScoringGetData.PlayerId = strconv.Itoa(object.Id)
reqScoringGetData
.
PlayerId
=
strconv
.
Itoa
(
object
.
Id
)
//
reqScoringGetData.SeasonId = object.SeasonId
reqScoringGetData
.
SeasonId
=
object
.
SeasonId
//
//
var replyScoringGetData dto.OrgPlayerDataGetReply
var
replyScoringGetData
dto
.
OrgPlayerDataGetReply
//err = s.GetData
(&reqScoringGetData, p, &replyScoringGetData)
err
=
s
.
GetDataSeason
(
&
reqScoringGetData
,
p
,
&
replyScoringGetData
)
//
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
//
}
}
//
object.SeasonScoring = replyScoringGetData.Scoring
object
.
SeasonScoring
=
replyScoringGetData
.
Scoring
//出赛次数
//出赛次数
var
reqMatchGetData
dto
.
OrgPlayerDataGetReq
var
reqMatchGetData
dto
.
OrgPlayerDataGetReq
...
@@ -124,3 +124,108 @@ func (e OrgPlayer) Get(c *gin.Context) {
...
@@ -124,3 +124,108 @@ func (e OrgPlayer) Get(c *gin.Context) {
e
.
OK
(
object
,
"查询成功"
)
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
,
"查询成功"
)
}
This diff is collapsed.
Click to expand it.
app/mobile/router/org_player.go
View file @
4bcc9c5f
...
@@ -16,5 +16,7 @@ func registerOrgPlayerRouter(v1 *gin.RouterGroup) {
...
@@ -16,5 +16,7 @@ func registerOrgPlayerRouter(v1 *gin.RouterGroup) {
{
{
r
.
GET
(
""
,
api
.
GetPage
)
r
.
GET
(
""
,
api
.
GetPage
)
r
.
GET
(
"/:id"
,
api
.
Get
)
r
.
GET
(
"/:id"
,
api
.
Get
)
r
.
GET
(
"/info/:id"
,
api
.
GetInfo
)
r
.
GET
(
"/evaluate"
,
api
.
GetOrgMatchEvaluate
)
}
}
}
}
This diff is collapsed.
Click to expand it.
app/mobile/service/dto/org_player.go
View file @
4bcc9c5f
...
@@ -16,7 +16,7 @@ type OrgPlayerGetPageReq struct {
...
@@ -16,7 +16,7 @@ type OrgPlayerGetPageReq struct {
Status
string
`form:"status" search:"type:exact;column:status;table:op" comment:""`
Status
string
`form:"status" search:"type:exact;column:status;table:op" comment:""`
}
}
type
OrgPlayerGetPageReply
struct
{
type
OrgPlayerGetPageReply
struct
{
Id
string
`json:"id" comment:"球
队id"`
//球队
id
Id
string
`json:"id" comment:"球
员id"`
//球员
id
ClubId
string
`json:"clubId" comment:"俱乐部id"`
ClubId
string
`json:"clubId" comment:"俱乐部id"`
ClubName
string
`json:"clubName" comment:"俱乐部名称"`
ClubName
string
`json:"clubName" comment:"俱乐部名称"`
TeamId
string
`json:"teamId" comment:"球队id"`
TeamId
string
`json:"teamId" comment:"球队id"`
...
@@ -30,6 +30,10 @@ type OrgPlayerGetPageReply struct {
...
@@ -30,6 +30,10 @@ type OrgPlayerGetPageReply struct {
Status
string
`json:"status" comment:"状态"`
Status
string
`json:"status" comment:"状态"`
}
}
type
MatchId
struct
{
Id
string
`json:"id" `
}
type
OrgPlayerOrder
struct
{
type
OrgPlayerOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:id;table:org_player"`
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"`
ClubId
string
`form:"clubIdOrder" search:"type:order;column:club_id;table:org_player"`
...
@@ -63,6 +67,67 @@ type OrgPlayerDataGetReply struct {
...
@@ -63,6 +67,67 @@ type OrgPlayerDataGetReply struct {
Scoring
string
`json:"scoring"`
Scoring
string
`json:"scoring"`
CountMatch
string
`json:"countMatch"`
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 功能获取请求参数
// OrgPlayerGetReq 功能获取请求参数
type
OrgPlayerGetReq
struct
{
type
OrgPlayerGetReq
struct
{
...
...
This diff is collapsed.
Click to expand it.
app/mobile/service/org_player.go
View file @
4bcc9c5f
...
@@ -3,7 +3,10 @@ package service
...
@@ -3,7 +3,10 @@ package service
import
(
import
(
"errors"
"errors"
"github.com/go-admin-team/go-admin-core/sdk/service"
"github.com/go-admin-team/go-admin-core/sdk/service"
"go-admin/common/utils"
"gorm.io/gorm"
"gorm.io/gorm"
"sort"
"strconv"
"go-admin/app/mobile/service/dto"
"go-admin/app/mobile/service/dto"
"go-admin/app/operate/models"
"go-admin/app/operate/models"
...
@@ -85,7 +88,7 @@ func (e *OrgPlayer) GetData(d *dto.OrgPlayerDataGetReq, p *actions.DataPermissio
...
@@ -85,7 +88,7 @@ func (e *OrgPlayer) GetData(d *dto.OrgPlayerDataGetReq, p *actions.DataPermissio
}
}
// Get 获取OrgPlayer对象
// Get 获取OrgPlayer对象
func
(
e
*
OrgPlayer
)
GetData
Match
(
d
*
dto
.
OrgPlayerDataGetReq
,
p
*
actions
.
DataPermission
,
model
*
dto
.
OrgPlayerDataGetReply
)
error
{
func
(
e
*
OrgPlayer
)
GetData
Season
(
d
*
dto
.
OrgPlayerDataGetReq
,
p
*
actions
.
DataPermission
,
model
*
dto
.
OrgPlayerDataGetReply
)
error
{
var
err
error
var
err
error
field
:=
"count(om.id) as count_match"
field
:=
"count(om.id) as count_match"
...
@@ -96,6 +99,29 @@ func (e *OrgPlayer) GetDataMatch(d *dto.OrgPlayerDataGetReq, p *actions.DataPerm
...
@@ -96,6 +99,29 @@ func (e *OrgPlayer) GetDataMatch(d *dto.OrgPlayerDataGetReq, p *actions.DataPerm
Scopes
(
Scopes
(
actions
.
Permission
(
"omtp"
,
p
),
actions
.
Permission
(
"omtp"
,
p
),
cDto
.
PassDel
(
"omtp"
),
cDto
.
PassDel
(
"omtp"
),
cDto
.
PassDel
(
"om"
),
)
.
Where
(
"omtp.player_id = ?"
,
d
.
PlayerId
)
.
Group
(
"om.season_id"
)
.
First
(
model
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"db error:%s"
,
err
)
return
err
}
return
nil
}
// Get 获取OrgPlayer对象
func
(
e
*
OrgPlayer
)
GetDataMatch
(
d
*
dto
.
OrgPlayerDataGetReq
,
p
*
actions
.
DataPermission
,
model
*
dto
.
OrgPlayerDataGetReply
)
error
{
var
err
error
field
:=
"count(om.id) as count_match"
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
Select
(
field
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Scopes
(
actions
.
Permission
(
"omtp"
,
p
),
cDto
.
SetWhere
(
"om"
,
"season_id"
,
d
.
SeasonId
),
cDto
.
SetWhere
(
"om"
,
"season_id"
,
d
.
SeasonId
),
cDto
.
PassDel
(
"omtp"
),
cDto
.
PassDel
(
"omtp"
),
cDto
.
PassDel
(
"om"
),
cDto
.
PassDel
(
"om"
),
...
@@ -109,3 +135,418 @@ func (e *OrgPlayer) GetDataMatch(d *dto.OrgPlayerDataGetReq, p *actions.DataPerm
...
@@ -109,3 +135,418 @@ func (e *OrgPlayer) GetDataMatch(d *dto.OrgPlayerDataGetReq, p *actions.DataPerm
}
}
return
nil
return
nil
}
}
// GetPage 获取OrgMatchEvaluate列表
func
(
e
*
OrgPlayer
)
GetMatchInfo
(
seasonId
string
,
playerId
string
,
p
*
actions
.
DataPermission
,
data
*
cDto
.
PageMatchInfo
)
error
{
var
err
error
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
Select
(
"ol.league_name, os.season_name, om.season_id"
)
.
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_season as os on os.id = om.season_id"
)
.
Scopes
(
actions
.
Permission
(
"omtp"
,
p
),
)
.
Where
(
"om.season_id = ?"
,
seasonId
)
.
Where
(
"omtp.player_id = ?"
,
playerId
)
.
Group
(
"om.season_id"
)
.
First
(
data
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetMatchInfo error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
func
(
e
*
OrgPlayer
)
StatisticsScoringAvg
(
playerId
string
,
seasonId
string
,
statistics
string
,
data
*
dto
.
OrgMatchInfo
)
error
{
var
err
error
field
:=
""
field
+=
"omtp.id, ol.league_name, os.season_name, om.season_id,"
+
"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"
)
.
Select
(
field
)
.
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_season as os on os.id = om.season_id"
)
.
Where
(
"om.season_id = ?"
,
seasonId
)
.
Where
(
"omtp.player_id = ?"
,
playerId
)
.
Group
(
"om.season_id"
)
.
First
(
data
)
.
Error
if
statistics
==
"avg"
{
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
)
data
.
Assist
=
utils
.
GetAvg
(
data
.
Assist
,
teamCount
)
data
.
Steal
=
utils
.
GetAvg
(
data
.
Steal
,
teamCount
)
data
.
FreeThrow
=
utils
.
GetAvg
(
data
.
FreeThrow
,
teamCount
)
data
.
BlockShot
=
utils
.
GetAvg
(
data
.
BlockShot
,
teamCount
)
data
.
Foul
=
utils
.
GetAvg
(
data
.
Foul
,
teamCount
)
data
.
TwoPointShot
=
utils
.
GetAvg
(
data
.
TwoPointShot
,
teamCount
)
data
.
ThreePointShot
=
utils
.
GetAvg
(
data
.
ThreePointShot
,
teamCount
)
}
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetTotalScoring error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
//参加比赛id
func
(
e
*
OrgPlayer
)
GetMatchId
(
playerId
string
,
seasonId
string
)
(
error
,
[]
string
)
{
var
err
error
data
:=
make
([]
dto
.
MatchId
,
0
)
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
Select
(
"distinct(om.id) as id"
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Scopes
(
cDto
.
SetWhere
(
"om"
,
"season_id"
,
seasonId
),
cDto
.
PassDel
(
"omtp"
),
cDto
.
PassDel
(
"om"
),
)
.
Where
(
"omtp.player_id = ?"
,
playerId
)
.
Order
(
"om.id desc"
)
.
Find
(
&
data
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetRoundsScoring error:%s
\r\n
"
,
err
)
return
err
,
nil
}
matchId
:=
make
([]
string
,
0
)
for
_
,
v
:=
range
data
{
matchId
=
append
(
matchId
,
v
.
Id
)
}
return
nil
,
matchId
}
func
(
e
*
OrgPlayer
)
GetRoundsScoring
(
playerId
string
,
matchId
[]
string
,
data
*
[]
dto
.
OrgPlayerRoundsScoring
)
error
{
var
err
error
field
:=
"om.id, om.rounds, om.grouping,"
+
"om.team_a_id,om.team_b_id,om.team_a_score,om.team_b_score,"
+
"om.match_start_time, om.match_end_time, omtp.other_team_id,"
+
"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 as om"
)
.
Select
(
field
)
.
Joins
(
"left join org_match_team_player as omtp on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Where
(
"omtp.match_id in (?)"
,
matchId
)
.
Where
(
"omtp.player_id = ? "
,
playerId
)
.
Group
(
"omtp.match_id"
)
.
Find
(
data
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetRoundsScoring error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
func
(
e
*
OrgPlayer
)
GetSeasonRoundsScoring
(
playerId
string
,
matchId
[]
string
,
data
*
[]
dto
.
OrgPlayerRoundsScoring
)
error
{
var
err
error
field
:=
"om.season_id as id, omtp.team_id, ot.team_name,"
+
"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 as om"
)
.
Select
(
field
)
.
Joins
(
"left join org_match_team_player as omtp on omtp.match_id = om.id and omtp.rounds = om.rounds"
)
.
Joins
(
"left join org_team as ot on omtp.team_id = ot.id"
)
.
Where
(
"omtp.match_id in (?)"
,
matchId
)
.
Where
(
"omtp.player_id = ? "
,
playerId
)
.
Group
(
"om.season_id"
)
.
Find
(
data
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetRoundsScoring error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
func
(
e
*
OrgPlayer
)
GetOrgMatchEvaluate
(
c
*
dto
.
OrgPlayerGetOrgMatchEvaluateReq
,
list
*
[]
dto
.
OrgMatchEvaluate
,
count
*
int64
)
error
{
var
err
error
err
=
e
.
Orm
.
Table
(
"org_match_evaluate as ome"
)
.
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"
)
.
Scopes
(
cDto
.
PassDel
(
"ome"
),
)
.
Where
(
"om.league_id = ?"
,
c
.
LeagueId
)
.
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
)
.
Count
(
count
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetPage error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
func
(
e
*
OrgPlayer
)
statisticsScoring
(
playerId
string
,
rounds
string
,
seasonId
string
,
statistics
string
,
data
*
cDto
.
TotalScoring
)
error
{
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"
}
if
statistics
==
"avg"
{
field
+=
"avg(omtp.scoring)as scoring,"
+
"avg(omtp.rebound)as rebound,"
+
"avg(omtp.assist)as assist,"
+
"avg(omtp.steal)as steal,"
+
"avg(omtp.free_throw)as free_throw,"
+
"avg(omtp.block_shot)as block_shot,"
+
"avg(omtp.foul)as foul,"
+
"avg(omtp.two_point_shot)as two_point_shot,"
+
"avg(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"
)
.
Select
(
field
)
.
Where
(
"omtp.player_id = ?"
,
playerId
)
.
Where
(
"omtp.rounds = ?"
,
rounds
)
.
Scopes
(
cDto
.
SetWhere
(
"om"
,
"season_id"
,
seasonId
))
.
First
(
data
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetTotalScoring error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
// Get 获取OrgMatchEvaluate对象
func
(
e
*
OrgPlayer
)
GetTotalScoring
(
playerId
string
,
rounds
string
,
seasonId
string
,
data
*
[]
cDto
.
TotalScoring
)
error
{
replyGetTotalScoring1
:=
new
(
cDto
.
TotalScoring
)
e
.
statisticsScoring
(
playerId
,
rounds
,
"0"
,
"sum"
,
replyGetTotalScoring1
)
*
data
=
append
(
*
data
,
*
replyGetTotalScoring1
)
replyGetTotalScoring2
:=
new
(
cDto
.
TotalScoring
)
e
.
statisticsScoring
(
playerId
,
rounds
,
"0"
,
"avg"
,
replyGetTotalScoring2
)
*
data
=
append
(
*
data
,
*
replyGetTotalScoring2
)
replyGetTotalScoring3
:=
new
(
cDto
.
TotalScoring
)
e
.
statisticsScoring
(
playerId
,
rounds
,
seasonId
,
"sum"
,
replyGetTotalScoring3
)
*
data
=
append
(
*
data
,
*
replyGetTotalScoring3
)
replyGetTotalScoring4
:=
new
(
cDto
.
TotalScoring
)
e
.
statisticsScoring
(
playerId
,
rounds
,
seasonId
,
"avg"
,
replyGetTotalScoring4
)
*
data
=
append
(
*
data
,
*
replyGetTotalScoring4
)
replyGetTotalScoring5
:=
new
(
cDto
.
TotalScoring
)
e
.
statisticsRankingList
(
playerId
,
seasonId
,
replyGetTotalScoring5
)
*
data
=
append
(
*
data
,
*
replyGetTotalScoring5
)
return
nil
}
func
(
e
*
OrgPlayer
)
statisticsRankingList
(
playerId
string
,
seasonId
string
,
scoring
*
cDto
.
TotalScoring
)
error
{
replyGetPlayerRank
:=
make
([]
models
.
OrgMatchTeamPlayer
,
0
)
err
:=
e
.
statisticsRanking
(
seasonId
,
&
replyGetPlayerRank
)
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetTotalScoring error:%s
\r\n
"
,
err
)
return
err
}
e
.
rankingScoring
(
replyGetPlayerRank
,
playerId
,
scoring
)
e
.
rankingRebound
(
replyGetPlayerRank
,
playerId
,
scoring
)
e
.
rankingAssist
(
replyGetPlayerRank
,
playerId
,
scoring
)
e
.
rankingSteal
(
replyGetPlayerRank
,
playerId
,
scoring
)
e
.
rankingFreeThrow
(
replyGetPlayerRank
,
playerId
,
scoring
)
e
.
rankingBlockShot
(
replyGetPlayerRank
,
playerId
,
scoring
)
e
.
rankingFoul
(
replyGetPlayerRank
,
playerId
,
scoring
)
e
.
rankingTwoPointShot
(
replyGetPlayerRank
,
playerId
,
scoring
)
e
.
rankingThreePointShot
(
replyGetPlayerRank
,
playerId
,
scoring
)
return
nil
}
func
(
e
*
OrgPlayer
)
rankingScoring
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Scoring
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Scoring
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
Scoring
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
rankingRebound
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Rebound
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Rebound
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
Rebound
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
rankingAssist
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Assist
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Assist
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
Assist
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
rankingSteal
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Steal
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Steal
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
Steal
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
rankingFreeThrow
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
FreeThrow
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
FreeThrow
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
FreeThrow
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
rankingBlockShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
BlockShot
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
BlockShot
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
BlockShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
rankingFoul
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Foul
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Foul
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
Foul
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
rankingTwoPointShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
TwoPointShot
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
TwoPointShot
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
TwoPointShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
rankingThreePointShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
ThreePointShot
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
ThreePointShot
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
scoring
.
ThreePointShot
=
strconv
.
Itoa
(
k
+
1
)
}
}
}
func
(
e
*
OrgPlayer
)
statisticsRanking
(
seasonId
string
,
data
*
[]
models
.
OrgMatchTeamPlayer
)
error
{
var
err
error
field
:=
"player_id,"
+
"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"
)
.
Select
(
field
)
.
Joins
(
"left join org_match as om on omtp.match_id = om.id"
)
.
Where
(
"om.season_id = ?"
,
seasonId
)
.
Order
(
"player_id asc"
)
.
Group
(
"player_id"
)
.
Find
(
&
data
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetTotalScoring error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
func
(
e
*
OrgPlayer
)
GetRankForGetPage
(
seasonId
string
,
playerId
string
)
string
{
replyGetPlayerRank
:=
make
([]
models
.
OrgMatchTeamPlayer
,
0
)
err
:=
e
.
statisticsRanking
(
seasonId
,
&
replyGetPlayerRank
)
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetTotalScoring error:%s
\r\n
"
,
err
)
return
"0"
}
return
e
.
rankingForGetPage
(
replyGetPlayerRank
,
playerId
)
}
func
(
e
*
OrgPlayer
)
rankingForGetPage
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
)
string
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
return
utils
.
StringToFloat
(
replyGetPlayerRank
[
i
]
.
Scoring
)
>
utils
.
StringToFloat
(
replyGetPlayerRank
[
j
]
.
Scoring
)
})
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
return
strconv
.
Itoa
(
k
+
1
)
}
}
return
"0"
}
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,
...
@@ -180,7 +180,7 @@ func (e *OrgTeamPlayer) statisticsRankingList(playerId string, seasonId string,
func
(
e
*
OrgTeamPlayer
)
rankingScoring
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingScoring
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
@@ -190,7 +190,7 @@ func (e *OrgTeamPlayer) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamP
...
@@ -190,7 +190,7 @@ func (e *OrgTeamPlayer) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamP
}
}
func
(
e
*
OrgTeamPlayer
)
rankingRebound
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingRebound
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
@@ -200,7 +200,7 @@ func (e *OrgTeamPlayer) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamP
...
@@ -200,7 +200,7 @@ func (e *OrgTeamPlayer) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamP
}
}
func
(
e
*
OrgTeamPlayer
)
rankingAssist
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingAssist
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
@@ -210,7 +210,7 @@ func (e *OrgTeamPlayer) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPl
...
@@ -210,7 +210,7 @@ func (e *OrgTeamPlayer) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPl
}
}
func
(
e
*
OrgTeamPlayer
)
rankingSteal
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingSteal
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
@@ -220,7 +220,7 @@ func (e *OrgTeamPlayer) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPla
...
@@ -220,7 +220,7 @@ func (e *OrgTeamPlayer) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPla
}
}
func
(
e
*
OrgTeamPlayer
)
rankingFreeThrow
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingFreeThrow
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
@@ -230,7 +230,7 @@ func (e *OrgTeamPlayer) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTea
...
@@ -230,7 +230,7 @@ func (e *OrgTeamPlayer) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTea
}
}
func
(
e
*
OrgTeamPlayer
)
rankingBlockShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingBlockShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
@@ -240,7 +240,7 @@ func (e *OrgTeamPlayer) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTea
...
@@ -240,7 +240,7 @@ func (e *OrgTeamPlayer) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTea
}
}
func
(
e
*
OrgTeamPlayer
)
rankingFoul
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingFoul
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
@@ -250,7 +250,7 @@ func (e *OrgTeamPlayer) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlay
...
@@ -250,7 +250,7 @@ func (e *OrgTeamPlayer) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlay
}
}
func
(
e
*
OrgTeamPlayer
)
rankingTwoPointShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingTwoPointShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
@@ -260,7 +260,7 @@ func (e *OrgTeamPlayer) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatch
...
@@ -260,7 +260,7 @@ func (e *OrgTeamPlayer) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatch
}
}
func
(
e
*
OrgTeamPlayer
)
rankingThreePointShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
func
(
e
*
OrgTeamPlayer
)
rankingThreePointShot
(
replyGetPlayerRank
[]
models
.
OrgMatchTeamPlayer
,
playerId
string
,
scoring
*
cDto
.
TotalScoring
)
{
sort
.
Slice
(
replyGetPlayerRank
,
func
(
i
,
j
int
)
bool
{
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
{
for
k
,
v
:=
range
replyGetPlayerRank
{
if
v
.
PlayerId
==
playerId
{
if
v
.
PlayerId
==
playerId
{
...
...
This diff is collapsed.
Click to expand it.
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