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
2f542726
Commit
2f542726
authored
3 years ago
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload
parent
033bc81b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
43 deletions
+126
-43
org_player.go
app/mobile/apis/org_player.go
+41
-15
org_player_rank.go
app/mobile/apis/org_player_rank.go
+38
-1
org_player.go
app/mobile/service/dto/org_player.go
+18
-15
org_player.go
app/mobile/service/org_player.go
+25
-9
org_player_rank.go
app/mobile/service/org_player_rank.go
+2
-2
common.go
common/utils/common.go
+2
-1
No files found.
app/mobile/apis/org_player.go
View file @
2f542726
...
...
@@ -8,6 +8,7 @@ import (
"go-admin/app/mobile/service"
"go-admin/app/mobile/service/dto"
"go-admin/common/actions"
cDto
"go-admin/common/dto"
"strconv"
)
...
...
@@ -28,9 +29,10 @@ type OrgPlayer struct {
func
(
e
OrgPlayer
)
GetPage
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerGetPageReq
{}
s
:=
service
.
OrgPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
err
:=
c
.
Bind
(
&
req
)
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
...
...
@@ -66,9 +68,9 @@ func (e OrgPlayer) GetPage(c *gin.Context) {
func
(
e
OrgPlayer
)
Get
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerGetReq
{}
s
:=
service
.
OrgPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
err
:=
c
.
Bind
(
&
req
)
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
...
...
@@ -136,9 +138,9 @@ func (e OrgPlayer) Get(c *gin.Context) {
func
(
e
OrgPlayer
)
GetInfo
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerGetReq
{}
s
:=
service
.
OrgPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
err
:=
c
.
Bind
(
&
req
)
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
...
...
@@ -193,9 +195,9 @@ func (e OrgPlayer) GetInfo(c *gin.Context) {
func
(
e
OrgPlayer
)
GetOrgMatchSeason
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerGetReq
{}
s
:=
service
.
OrgPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
err
:=
c
.
Bind
(
&
req
)
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
...
...
@@ -230,9 +232,9 @@ func (e OrgPlayer) GetOrgMatchSeason(c *gin.Context) {
func
(
e
OrgPlayer
)
GetOrgMatchEvaluate
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerGetOrgMatchEvaluateReq
{}
s
:=
service
.
OrgPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
err
:=
c
.
Bind
(
&
req
)
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
...
...
@@ -241,7 +243,7 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
return
}
list
:=
make
([]
dto
.
OrgMatchEvaluate
,
0
)
list
:=
make
([]
dto
.
OrgMatchEvaluate
List
,
0
)
var
count
int64
//p := actions.GetPermissionFromContext(c)
...
...
@@ -251,7 +253,31 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
return
}
e
.
OK
(
list
,
"查询成功"
)
reply
:=
make
([]
dto
.
OrgMatchEvaluate
,
0
)
for
_
,
v
:=
range
list
{
replyV
:=
dto
.
OrgMatchEvaluate
{}
imgList
:=
make
([]
cDto
.
Wonderful
,
0
)
err
=
s
.
GetPageWonderful
(
v
.
Id
,
&
imgList
,
1
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛球员信息 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
replyV
.
MatchImg
=
imgList
mvList
:=
make
([]
cDto
.
Wonderful
,
0
)
err
=
s
.
GetPageWonderful
(
v
.
Id
,
&
imgList
,
2
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛球员信息 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
replyV
.
MatchMv
=
mvList
replyV
.
Id
=
v
.
Id
replyV
.
Content
=
v
.
Content
reply
=
append
(
reply
,
replyV
)
}
e
.
OK
(
reply
,
"查询成功"
)
}
// Get <手机端>获取球员精彩时刻
...
...
@@ -264,14 +290,14 @@ func (e OrgPlayer) GetOrgMatchEvaluate(c *gin.Context) {
// @Param rounds path string false "rounds"
// @Param playerId path string false "playerId"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player/
evaluate
[get]
// @Router /mobile/v1/org-player/
get-rounds
[get]
// @Security Bearer
func
(
e
OrgPlayer
)
GetOrgRounds
(
c
*
gin
.
Context
)
{
req
:=
dto
.
GetRoundsReq
{}
s
:=
service
.
OrgPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
err
:=
c
.
Bind
(
&
req
)
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
app/mobile/apis/org_player_rank.go
View file @
2f542726
...
...
@@ -22,7 +22,7 @@ type OrgPlayerRank struct {
// @Tags <手机端>比赛排名
// @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码"
// @Param data body dto.Org
TeamPlayer
GetPageReq true "data"
// @Param data body dto.Org
PlayerRank
GetPageReq true "data"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player-rank [get]
// @Security Bearer
...
...
@@ -52,3 +52,40 @@ func (e OrgPlayerRank) GetPage(c *gin.Context) {
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
}
// GetPage <手机端>获取球队排名
// @Summary <手机端>获取球队排名
// @Description <手机端>获取球队排名
// @Tags <手机端>比赛排名
// @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码"
// @Param data body dto.OrgPlayerRankGetPageReq true "data"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /mobile/v1/org-player-rank/team [get]
// @Security Bearer
func
(
e
OrgPlayerRank
)
GetPageTeam
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerRankGetPageReq
{}
s
:=
service
.
OrgPlayerRank
{}
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
}
p
:=
actions
.
GetPermissionFromContext
(
c
)
list
:=
make
([]
dto
.
OrgPlayerRankGetPageReply
,
0
)
var
count
int64
err
=
s
.
GetPage
(
&
req
,
p
,
&
list
,
&
count
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取球队 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
}
This diff is collapsed.
Click to expand it.
app/mobile/service/dto/org_player.go
View file @
2f542726
...
...
@@ -58,9 +58,9 @@ func (m *OrgPlayerGetPageReq) GetNeedSearch() interface{} {
}
type
OrgPlayerDataGetReq
struct
{
PlayerId
string
`json:"playerId"`
SeasonId
string
`json:"seasonId"`
Match
string
`json:"match"`
PlayerId
string
`
form:"playerId"
json:"playerId"`
SeasonId
string
`
form:"seasonId"
json:"seasonId"`
Match
string
`
form:"match"
json:"match"`
}
type
OrgPlayerDataGetReply
struct
{
...
...
@@ -100,7 +100,7 @@ type OrgPlayerRoundsScoring struct {
}
type
GetRoundsReq
struct
{
PlayerId
string
`json:"playerId"`
PlayerId
string
`
form:"playerId"
json:"playerId"`
}
type
GetRoundsReply
struct
{
Id
string
`json:"id"`
...
...
@@ -114,11 +114,11 @@ type GetRoundsReply struct {
}
type
OrgPlayerGetOrgMatchEvaluateReq
struct
{
LeagueId
string
`json:"leagueId"`
SeasonId
string
`json:"seasonId"`
MatchId
string
`json:"matchId"`
Rounds
string
`json:"rounds"`
PlayerId
string
`json:"playerId"`
LeagueId
string
`
form:"leagueId"
json:"leagueId"`
SeasonId
string
`
form:"seasonId"
json:"seasonId"`
MatchId
string
`
form:"matchId"
json:"matchId"`
Rounds
string
`
form:"rounds"
json:"rounds"`
PlayerId
string
`
form:"playerId"
json:"playerId"`
}
type
OrgPlayerGetOrgMatchEvaluateReply
struct
{
...
...
@@ -126,12 +126,15 @@ type OrgPlayerGetOrgMatchEvaluateReply struct {
}
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"`
Id
string
`json:"id"`
Content
string
`json:"content"`
MatchImg
[]
dto
.
Wonderful
`json:"matchImg"`
MatchMv
[]
dto
.
Wonderful
`json:"matchMv"`
}
type
OrgMatchEvaluateList
struct
{
Id
string
`json:"id"`
Content
string
`json:"content"`
}
// OrgPlayerGetReq 功能获取请求参数
...
...
This diff is collapsed.
Click to expand it.
app/mobile/service/org_player.go
View file @
2f542726
...
...
@@ -318,22 +318,20 @@ func (e *OrgPlayer) GetOrgRounds(c *dto.GetRoundsReq, list *[]dto.GetRoundsReply
}
return
nil
}
func
(
e
*
OrgPlayer
)
GetOrgMatchEvaluate
(
c
*
dto
.
OrgPlayerGetOrgMatchEvaluateReq
,
list
*
[]
dto
.
OrgMatchEvaluate
,
count
*
int64
)
error
{
func
(
e
*
OrgPlayer
)
GetOrgMatchEvaluate
(
c
*
dto
.
OrgPlayerGetOrgMatchEvaluateReq
,
list
*
[]
dto
.
OrgMatchEvaluate
List
,
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"
)
.
Select
(
"ome.id, ome.content"
)
.
Joins
(
"left join org_match as om on om.id = ome.match_id"
)
.
Scopes
(
cDto
.
PassDel
(
"ome"
),
cDto
.
SetWhere
(
"om"
,
"league_id"
,
c
.
LeagueId
),
cDto
.
SetWhere
(
"om"
,
"season_id"
,
c
.
SeasonId
),
cDto
.
SetWhere
(
"ome"
,
"match_id"
,
c
.
MatchId
),
cDto
.
SetWhere
(
"ome"
,
"rounds"
,
c
.
Rounds
),
)
.
Where
(
"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
)
.
Where
(
"ome.player_id=?"
,
c
.
PlayerId
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Count
(
count
)
.
Error
if
err
!=
nil
{
...
...
@@ -571,3 +569,21 @@ func (e *OrgPlayer) rankingForGetPage(replyGetPlayerRank []models.OrgMatchTeamPl
}
return
"0"
}
func
(
e
*
OrgPlayer
)
GetPageWonderful
(
evaluateId
string
,
list
*
[]
cDto
.
Wonderful
,
wType
int
)
error
{
var
err
error
err
=
e
.
Orm
.
Table
(
"org_match_evaluate_wonderful as omew"
)
.
Select
(
"omew.id, omew.wonderful_url, omew.wonderful_title"
)
.
Scopes
(
cDto
.
PassDel
(
"omew"
),
)
.
Where
(
"match_evaluate_id=?"
,
evaluateId
)
.
Where
(
"type=?"
,
wType
)
.
Find
(
list
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchService GetPage error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
This diff is collapsed.
Click to expand it.
app/mobile/service/org_player_rank.go
View file @
2f542726
...
...
@@ -20,7 +20,7 @@ func (e *OrgPlayerRank) GetPage(c *dto.OrgPlayerRankGetPageReq, p *actions.DataP
var
err
error
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
Select
(
"o
l.league_name, omtp.player_name, omtp.player_id as id
, omtp.player_number,"
+
Select
(
"o
mtp.player_id as id, ol.league_name, omtp.player_name
, omtp.player_number,"
+
"sum(omtp.scoring)as scoring,"
+
"sum(omtp.rebound)as rebound,"
+
"sum(omtp.assist)as assist,"
+
...
...
@@ -39,7 +39,7 @@ func (e *OrgPlayerRank) GetPage(c *dto.OrgPlayerRankGetPageReq, p *actions.DataP
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
"omtp"
,
p
),
cDto
.
PassDel
(
"omtp"
),
cDto
.
SetWhere
(
"om
tp
"
,
"league_id"
,
c
.
LeagueId
),
cDto
.
SetWhere
(
"om"
,
"league_id"
,
c
.
LeagueId
),
)
.
Group
(
"omtp.player_id"
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
...
...
This diff is collapsed.
Click to expand it.
common/utils/common.go
View file @
2f542726
...
...
@@ -57,7 +57,8 @@ func UploadFile(f multipart.File, h *multipart.FileHeader) (string, error) {
yunfiletmp
:=
fmt
.
Sprintf
(
"%s/%s"
,
extConfig
.
ExtConfig
.
Upload
.
Dir
,
GetDate
())
fullFileName
=
fmt
.
Sprintf
(
"%s/%s%s"
,
yunfiletmp
,
guid
,
filepath
.
Ext
(
h
.
Filename
))
//fmt.Println(fullFileName)
if
err
=
bucket
.
PutObject
(
fullFileName
,
buf
);
err
!=
nil
{
option
:=
oss
.
ContentType
(
"image/jpg"
)
if
err
=
bucket
.
PutObject
(
fullFileName
,
buf
,
option
);
err
!=
nil
{
return
fullFileName
,
err
}
return
fullFileName
,
nil
...
...
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