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
d597c7aa
Commit
d597c7aa
authored
3 years ago
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
League
parent
f7c10bb1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
119 additions
and
74 deletions
+119
-74
org_player_rank.go
app/mobile/apis/org_player_rank.go
+35
-1
org_player_rank.go
app/mobile/router/org_player_rank.go
+1
-0
org_league.go
app/mobile/service/dto/org_league.go
+27
-35
org_league.go
app/mobile/service/org_league.go
+56
-38
No files found.
app/mobile/apis/org_player_rank.go
View file @
d597c7aa
...
...
@@ -2,7 +2,6 @@ package apis
import
(
"fmt"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
_
"github.com/go-admin-team/go-admin-core/sdk/pkg/response"
...
...
@@ -89,3 +88,38 @@ func (e OrgPlayerRank) GetPageTeam(c *gin.Context) {
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
}
// GetPage <手机端>获取联赛列表
// @Summary <手机端>获取联赛列表
// @Description <手机端>获取联赛列表
// @Tags <手机端>联赛列表
// @Param data body dto.OrgLeagueGetPageReq true "data"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-player-rank/league [get]
// @Security Bearer
func
(
e
OrgPlayerRank
)
GetPageLeague
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgLeagueGetPageReq
{}
s
:=
service
.
OrgLeague
{}
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
.
OrgLeagueGetPageReply
,
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
),
1
,
999
,
"查询成功"
)
}
This diff is collapsed.
Click to expand it.
app/mobile/router/org_player_rank.go
View file @
d597c7aa
...
...
@@ -16,5 +16,6 @@ func registerOrgPlayerRankRouter(v1 *gin.RouterGroup) {
{
r
.
GET
(
""
,
api
.
GetPage
)
r
.
GET
(
"/team"
,
api
.
GetPageTeam
)
r
.
GET
(
"/league"
,
api
.
GetPageLeague
)
}
}
This diff is collapsed.
Click to expand it.
app/mobile/service/dto/org_league.go
View file @
d597c7aa
...
...
@@ -2,25 +2,16 @@ package dto
import
(
"go-admin/app/operate/models"
"go-admin/common/dto"
common
"go-admin/common/models"
"time"
)
type
OrgLeagueGetPageReq
struct
{
dto
.
Pagination
`search:"-"`
OrgLeagueOrder
PlayerId
string
`form:"playerId" json:"playerId" comment:""`
//
}
type
OrgLeagueOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:id;table:org_league"`
LeagueName
string
`form:"leagueNameOrder" search:"type:order;column:league_name;table:org_league"`
Status
string
`form:"statusOrder" search:"type:order;column:status;table:org_league"`
CreateBy
string
`form:"createByOrder" search:"type:order;column:create_by;table:org_league"`
UpdateBy
string
`form:"updateByOrder" search:"type:order;column:update_by;table:org_league"`
CreatedAt
time
.
Time
`form:"createdAtOrder" search:"type:order;column:created_at;table:org_league"`
UpdatedAt
time
.
Time
`form:"updatedAtOrder" search:"type:order;column:updated_at;table:org_league"`
DeletedAt
time
.
Time
`form:"deletedAtOrder" search:"type:order;column:deleted_at;table:org_league"`
type
OrgLeagueGetPageReply
struct
{
Id
string
`json:"id" comment:""`
//
LeagueName
string
`json:"leagueName" comment:"联赛级别"`
}
func
(
m
*
OrgLeagueGetPageReq
)
GetNeedSearch
()
interface
{}
{
...
...
@@ -36,7 +27,7 @@ type OrgLeagueInsertReq struct {
func
(
s
*
OrgLeagueInsertReq
)
Generate
(
model
*
models
.
OrgLeague
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
LeagueName
=
s
.
LeagueName
model
.
Status
=
s
.
Status
...
...
@@ -55,7 +46,7 @@ type OrgLeagueUpdateReq struct {
func
(
s
*
OrgLeagueUpdateReq
)
Generate
(
model
*
models
.
OrgLeague
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
LeagueName
=
s
.
LeagueName
model
.
Status
=
s
.
Status
...
...
@@ -69,6 +60,7 @@ func (s *OrgLeagueUpdateReq) GetId() interface{} {
type
OrgLeagueGetReq
struct
{
Id
int
`uri:"id"`
}
func
(
s
*
OrgLeagueGetReq
)
GetId
()
interface
{}
{
return
s
.
Id
}
...
...
This diff is collapsed.
Click to expand it.
app/mobile/service/org_league.go
View file @
d597c7aa
...
...
@@ -2,14 +2,12 @@ package service
import
(
"errors"
"github.com/go-admin-team/go-admin-core/sdk/service"
"gorm.io/gorm"
"go-admin/app/mobile/service/dto"
"go-admin/app/operate/models"
"go-admin/app/operate/service/dto"
"go-admin/common/actions"
cDto
"go-admin/common/dto"
)
type
OrgLeague
struct
{
...
...
@@ -17,17 +15,37 @@ type OrgLeague struct {
}
// GetPage 获取OrgLeague列表
func
(
e
*
OrgLeague
)
GetPage
(
c
*
dto
.
OrgLeagueGetPageReq
,
p
*
actions
.
DataPermission
,
list
*
[]
models
.
OrgLeague
,
count
*
int64
)
error
{
func
(
e
*
OrgLeague
)
GetPage
(
c
*
dto
.
OrgLeagueGetPageReq
,
p
*
actions
.
DataPermission
,
list
*
[]
dto
.
OrgLeagueGetPageReply
,
count
*
int64
)
error
{
var
err
error
var
data
models
.
OrgLeague
err
=
e
.
Orm
.
Model
(
&
data
)
.
Scopes
(
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
Select
(
"ol.id, ol.league_name"
)
.
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"
)
.
Where
(
"ol.status=?"
,
1
)
.
Where
(
"omtp.player_id=?"
,
c
.
PlayerId
)
.
Group
(
"om.league_id"
)
.
Find
(
list
)
.
Count
(
count
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgLeagueService GetPage error:%s
\r\n
"
,
err
)
return
err
}
return
nil
}
// GetPage 获取OrgLeague列表
func
(
e
*
OrgLeague
)
GetPageForOwn
(
c
*
dto
.
OrgLeagueGetPageReq
,
p
*
actions
.
DataPermission
,
list
*
[]
dto
.
OrgLeagueGetPageReply
,
count
*
int64
)
error
{
var
err
error
err
=
e
.
Orm
.
Table
(
"org_match_team_player as omtp"
)
.
Select
(
"ol.id, ol.league_name"
)
.
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"
)
.
Where
(
"ol.status=?"
,
1
)
.
Where
(
"omtp.player_id=?"
,
c
.
PlayerId
)
.
Group
(
"om.league_id"
)
.
Find
(
list
)
.
Count
(
count
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgLeagueService GetPage error:%s
\r\n
"
,
err
)
...
...
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