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
1c1a2b4e
Commit
1c1a2b4e
authored
3 years ago
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teammatch
parent
ce2dca93
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
1 deletion
+70
-1
org_team_match.go
app/operate/apis/org_team_match.go
+26
-0
org_team_user.go
app/operate/apis/org_team_user.go
+7
-0
org_team_match.go
app/operate/service/dto/org_team_match.go
+2
-0
org_team.go
app/operate/service/org_team.go
+22
-0
org_team_match.go
app/operate/service/org_team_match.go
+1
-1
match.go
common/dto/match.go
+12
-0
No files found.
app/operate/apis/org_team_match.go
View file @
1c1a2b4e
...
@@ -20,6 +20,13 @@ type OrgTeamMatch struct {
...
@@ -20,6 +20,13 @@ type OrgTeamMatch struct {
api
.
Api
api
.
Api
}
}
func
(
e
OrgTeamMatch
)
getTeamIds
(
c
*
gin
.
Context
,
clubId
string
)
string
{
sOrgTeam
:=
service
.
OrgTeam
{}
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgTeam
.
Service
)
_
,
teamId
:=
sOrgTeam
.
GetTeamIds
(
clubId
)
return
teamId
}
func
(
e
OrgTeamMatch
)
getTeamId
(
c
*
gin
.
Context
)
string
{
func
(
e
OrgTeamMatch
)
getTeamId
(
c
*
gin
.
Context
)
string
{
sOrgTeamUser
:=
service
.
OrgTeamUser
{}
sOrgTeamUser
:=
service
.
OrgTeamUser
{}
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgTeamUser
.
Service
)
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgTeamUser
.
Service
)
...
@@ -27,6 +34,13 @@ func (e OrgTeamMatch) getTeamId(c *gin.Context) string {
...
@@ -27,6 +34,13 @@ func (e OrgTeamMatch) getTeamId(c *gin.Context) string {
return
teamId
return
teamId
}
}
func
(
e
OrgTeamMatch
)
getClubId
(
c
*
gin
.
Context
)
string
{
sOrgTeamUser
:=
service
.
OrgClubUser
{}
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgTeamUser
.
Service
)
_
,
teamId
:=
sOrgTeamUser
.
GetClubId
(
user
.
GetUserId
(
c
))
return
teamId
}
// GetPage <球队>获取比赛列表
// GetPage <球队>获取比赛列表
// @Summary <球队>获取比赛列表
// @Summary <球队>获取比赛列表
// @Description <球队>获取比赛列表
// @Description <球队>获取比赛列表
...
@@ -56,6 +70,18 @@ func (e OrgTeamMatch) GetPage(c *gin.Context) {
...
@@ -56,6 +70,18 @@ func (e OrgTeamMatch) GetPage(c *gin.Context) {
var
count
int64
var
count
int64
fmt
.
Println
(
user
.
GetUserId
(
c
))
fmt
.
Println
(
user
.
GetUserId
(
c
))
req
.
TeamId
=
e
.
getTeamId
(
c
)
req
.
TeamId
=
e
.
getTeamId
(
c
)
if
req
.
TeamId
==
""
{
req
.
ClubId
=
e
.
getClubId
(
c
)
if
req
.
ClubId
==
""
{
e
.
Error
(
111
,
err
,
"数据有误"
)
return
}
req
.
TeamIds
=
e
.
getTeamIds
(
c
,
req
.
ClubId
)
if
req
.
TeamIds
==
""
{
e
.
Error
(
111
,
err
,
"数据有误"
)
return
}
}
err
=
s
.
GetPage
(
&
req
,
p
,
&
list
,
&
count
)
err
=
s
.
GetPage
(
&
req
,
p
,
&
list
,
&
count
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
app/operate/apis/org_team_user.go
View file @
1c1a2b4e
...
@@ -20,6 +20,13 @@ type OrgTeamUser struct {
...
@@ -20,6 +20,13 @@ type OrgTeamUser struct {
api
.
Api
api
.
Api
}
}
func
(
e
OrgTeamUser
)
getTeamIds
(
c
*
gin
.
Context
,
clubId
string
)
string
{
sOrgTeam
:=
service
.
OrgTeam
{}
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgTeam
.
Service
)
_
,
teamId
:=
sOrgTeam
.
GetTeamIds
(
clubId
)
return
teamId
}
func
(
e
OrgTeamUser
)
getClubId
(
c
*
gin
.
Context
)
string
{
func
(
e
OrgTeamUser
)
getClubId
(
c
*
gin
.
Context
)
string
{
sOrgTeamUser
:=
service
.
OrgClubUser
{}
sOrgTeamUser
:=
service
.
OrgClubUser
{}
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgTeamUser
.
Service
)
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgTeamUser
.
Service
)
...
...
This diff is collapsed.
Click to expand it.
app/operate/service/dto/org_team_match.go
View file @
1c1a2b4e
...
@@ -8,6 +8,8 @@ import (
...
@@ -8,6 +8,8 @@ import (
type
OrgTeamMatchGetPageReq
struct
{
type
OrgTeamMatchGetPageReq
struct
{
dto
.
Pagination
`search:"-"`
dto
.
Pagination
`search:"-"`
ClubId
string
`form:"clubId" search:"-"`
TeamIds
string
`form:"teamIds" search:"-"`
TeamId
string
`form:"teamId" search:"-"`
TeamId
string
`form:"teamId" search:"-"`
LeagueId
string
`form:"leagueId" search:"type:exact;column:league_id;table:om" comment:""`
LeagueId
string
`form:"leagueId" search:"type:exact;column:league_id;table:om" comment:""`
DivisionId
string
`form:"divisionId" search:"type:exact;column:division_id;table:om" comment:""`
DivisionId
string
`form:"divisionId" search:"type:exact;column:division_id;table:om" comment:""`
...
...
This diff is collapsed.
Click to expand it.
app/operate/service/org_team.go
View file @
1c1a2b4e
...
@@ -2,6 +2,8 @@ package service
...
@@ -2,6 +2,8 @@ package service
import
(
import
(
"errors"
"errors"
"strconv"
"strings"
"github.com/go-admin-team/go-admin-core/sdk/service"
"github.com/go-admin-team/go-admin-core/sdk/service"
"gorm.io/gorm"
"gorm.io/gorm"
...
@@ -159,3 +161,23 @@ func (e *OrgTeam) InsertTeamDept(teamId int, deptId int) error {
...
@@ -159,3 +161,23 @@ func (e *OrgTeam) InsertTeamDept(teamId int, deptId int) error {
}
}
return
nil
return
nil
}
}
// 根据userId获取teamId
func
(
e
*
OrgTeam
)
GetTeamIds
(
clubId
string
)
(
error
,
string
)
{
data
:=
make
([]
models
.
OrgTeam
,
0
)
err
:=
e
.
Orm
.
Table
(
"org_team"
)
.
Select
(
"id"
)
.
Where
(
"club_id=?"
,
clubId
)
.
Find
(
&
data
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"db error:%s"
,
err
)
return
err
,
""
}
teamIds
:=
""
for
_
,
v
:=
range
data
{
teamIds
+=
strconv
.
Itoa
(
v
.
Id
)
+
","
}
teamIds
=
strings
.
Trim
(
teamIds
,
","
)
return
nil
,
teamIds
}
This diff is collapsed.
Click to expand it.
app/operate/service/org_team_match.go
View file @
1c1a2b4e
...
@@ -35,8 +35,8 @@ func (e *OrgTeamMatch) GetPage(c *dto.OrgTeamMatchGetPageReq, p *actions.DataPer
...
@@ -35,8 +35,8 @@ func (e *OrgTeamMatch) GetPage(c *dto.OrgTeamMatchGetPageReq, p *actions.DataPer
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
data
.
TableName
(),
p
),
actions
.
Permission
(
data
.
TableName
(),
p
),
cDto
.
PassDel
(
"om"
),
cDto
.
PassDel
(
"om"
),
cDto
.
SetWhereForMatch
(
c
.
TeamId
,
c
.
TeamIds
),
)
.
)
.
Where
(
"team_a_id = ? or team_b_id = ?"
,
c
.
TeamId
,
c
.
TeamId
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Count
(
count
)
.
Error
Count
(
count
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
common/dto/match.go
View file @
1c1a2b4e
...
@@ -106,3 +106,15 @@ func SetWhereNotIn(tableName string, fieldName string, fieldValue string) func(d
...
@@ -106,3 +106,15 @@ func SetWhereNotIn(tableName string, fieldName string, fieldValue string) func(d
return
db
.
Where
(
tableName
+
"."
+
fieldName
+
" not in ("
+
fieldValue
+
")"
)
return
db
.
Where
(
tableName
+
"."
+
fieldName
+
" not in ("
+
fieldValue
+
")"
)
}
}
}
}
func
SetWhereForMatch
(
teamId
string
,
teamIds
string
)
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
return
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
if
teamIds
==
""
&&
teamId
==
""
{
return
db
}
if
teamId
==
""
{
return
db
.
Where
(
"team_a_id in (?) or team_b_id in (?)"
,
teamIds
,
teamIds
)
}
return
db
.
Where
(
"team_a_id = ? or team_b_id = ?"
,
teamId
,
teamId
)
}
}
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