Commit c65e78f1 authored by haoyanbin's avatar haoyanbin

1

parent 3cc2b885
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -2,6 +2,7 @@ package apis ...@@ -2,6 +2,7 @@ package apis
import ( import (
"fmt" "fmt"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
cDto "go-admin/common/dto" cDto "go-admin/common/dto"
"strconv" "strconv"
...@@ -43,8 +44,14 @@ func (e OrgTeamPlayer) GetPage(c *gin.Context) { ...@@ -43,8 +44,14 @@ func (e OrgTeamPlayer) GetPage(c *gin.Context) {
} }
p := actions.GetPermissionFromContext(c) p := actions.GetPermissionFromContext(c)
sOrgTeamUser := service.OrgTeamUser{}
e.MakeContext(c).MakeOrm().MakeService(&sOrgTeamUser.Service)
_, teamId := sOrgTeamUser.GetTeamId(user.GetUserId(c))
list := make([]dto.OrgTeamPlayerGetPageReply, 0) list := make([]dto.OrgTeamPlayerGetPageReply, 0)
var count int64 var count int64
req.TeamId = teamId
err = s.GetPage(&req, p, &list, &count) err = s.GetPage(&req, p, &list, &count)
if err != nil { if err != nil {
...@@ -52,6 +59,10 @@ func (e OrgTeamPlayer) GetPage(c *gin.Context) { ...@@ -52,6 +59,10 @@ func (e OrgTeamPlayer) GetPage(c *gin.Context) {
return return
} }
for k, v := range list {
list[k].Rank = s.GetRankForGetPage(v.SeasonId, v.PlayerId)
}
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
} }
......
...@@ -52,6 +52,9 @@ func (e OrgTeamTeam) GetPage(c *gin.Context) { ...@@ -52,6 +52,9 @@ func (e OrgTeamTeam) GetPage(c *gin.Context) {
return return
} }
for k, v := range list {
list[k].Rank = s.GetRankForGetPage(v.SeasonId, v.TeamId)
}
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
} }
...@@ -61,6 +64,7 @@ func (e OrgTeamTeam) GetPage(c *gin.Context) { ...@@ -61,6 +64,7 @@ func (e OrgTeamTeam) GetPage(c *gin.Context) {
// @Tags <球队>球队表现 // @Tags <球队>球队表现
// @Param pageSize query int false "页条数" // @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码" // @Param pageIndex query int false "页码"
// @Param teamId query int false "球队id"
// @Success 200 {string} string "{"code": 200, "data": [...]}" // @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-team-team/get-match [get] // @Router /api/v1/org-team-team/get-match [get]
// @Security Bearer // @Security Bearer
......
File mode changed from 100644 to 100755
package apis
import (
"github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/common/utils"
extConfig "go-admin/config"
"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"
"go-admin/app/operate/service/dto"
)
type OrgUpload struct {
api.Api
}
// GetPage <俱乐部>获取俱乐部列表
// @Summary <俱乐部>获取俱乐部列表
// @Description <俱乐部>获取俱乐部列表
// @Tags <俱乐部>俱乐部
// @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码"
// @Param data body dto.OrgClubGetPageReq true "data"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org/upload [post]
// @Security Bearer
func (e OrgUpload) OrgUpload(c *gin.Context) {
//上传文件
f, h, err := c.Request.FormFile("file")
if err != nil {
e.OK("", "上传失败")
}
defer f.Close()
fullFileName, err := utils.UploadFile(f, h)
if err != nil {
e.OK("", "aliyun上传失败")
}
var reply dto.OrgUploadReply
reply.Url = extConfig.ExtConfig.Aliyunoss.Uploaddir + fullFileName
response.OK(c, reply, "上传")
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
package router
import (
"github.com/gin-gonic/gin"
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
"go-admin/app/operate/apis"
"go-admin/common/middleware"
)
func init() {
routerCheckRole = append(routerCheckRole, registerOrgUploadRouter)
}
// registerOrgClubRouter
func registerOrgUploadRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
api := apis.OrgUpload{}
r := v1.Group("/org").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
{
r.POST("/upload", api.OrgUpload)
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
type OrgTeamPlayerGetPageReq struct { type OrgTeamPlayerGetPageReq struct {
dto.Pagination `search:"-"` dto.Pagination `search:"-"`
TeamId string `form:"reamId" search:"-"` //联赛级别id
LeagueId string `form:"leagueId" search:"type:exact;column:league_id;table:om" comment:"联赛级别id"` //联赛级别id LeagueId string `form:"leagueId" search:"type:exact;column:league_id;table:om" comment:"联赛级别id"` //联赛级别id
DivisionId string `form:"divisionId" search:"type:exact;column:division_id;table:om" comment:"赛区id"` //赛区id DivisionId string `form:"divisionId" search:"type:exact;column:division_id;table:om" comment:"赛区id"` //赛区id
SeasonId string `form:"seasonId" search:"type:exact;column:season_id;table:om" comment:"赛季id"` //赛季id SeasonId string `form:"seasonId" search:"type:exact;column:season_id;table:om" comment:"赛季id"` //赛季id
...@@ -17,8 +18,10 @@ type OrgTeamPlayerGetPageReply struct { ...@@ -17,8 +18,10 @@ type OrgTeamPlayerGetPageReply struct {
Id string `json:"id"` Id string `json:"id"`
Rank string `json:"rank"` Rank string `json:"rank"`
LeagueName string `json:"leagueName"` LeagueName string `json:"leagueName"`
SeasonId string `json:"seasonId"`
SeasonName string `json:"seasonName"` SeasonName string `json:"seasonName"`
Rounds string `json:"rounds"` Rounds string `json:"rounds"`
PlayerId string `json:"playerId"`
PlayerName string `json:"playerName"` PlayerName string `json:"playerName"`
PlayerNumber string `json:"playerNumber" comment:"球衣号码"` PlayerNumber string `json:"playerNumber" comment:"球衣号码"`
Position string `json:"position" comment:"场上位置"` Position string `json:"position" comment:"场上位置"`
......
...@@ -19,6 +19,7 @@ type OrgTeamTeamGetPageReply struct { ...@@ -19,6 +19,7 @@ type OrgTeamTeamGetPageReply struct {
Rank string `json:"rank"` Rank string `json:"rank"`
LeagueName string `json:"leagueName"` LeagueName string `json:"leagueName"`
DivisionName string `json:"divisionName"` DivisionName string `json:"divisionName"`
SeasonId string `json:"seasonId"`
SeasonName string `json:"seasonName"` SeasonName string `json:"seasonName"`
Rounds string `json:"rounds"` Rounds string `json:"rounds"`
dto.TotalScoring dto.TotalScoring
...@@ -55,7 +56,7 @@ func (s *OrgTeamTeamGetReq) GetId() interface{} { ...@@ -55,7 +56,7 @@ func (s *OrgTeamTeamGetReq) GetId() interface{} {
} }
type GetPageMatchTeamTeamReq struct { type GetPageMatchTeamTeamReq struct {
TeamId int `form:"teamId" json:"teamId"` TeamId int `form:"id" json:"id"`
} }
type GetPageMatchTeamTeamReply struct { type GetPageMatchTeamTeamReply struct {
MatchInfo dto.PageMatchInfo `json:"matchInfo"` MatchInfo dto.PageMatchInfo `json:"matchInfo"`
......
File mode changed from 100644 to 100755
package dto
type OrgUploadReply struct {
Url string `json:"url"` //
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"errors" "errors"
"github.com/go-admin-team/go-admin-core/sdk/service" "github.com/go-admin-team/go-admin-core/sdk/service"
cDto "go-admin/common/dto" cDto "go-admin/common/dto"
"go-admin/common/utils"
"gorm.io/gorm" "gorm.io/gorm"
"sort" "sort"
"strconv" "strconv"
...@@ -22,7 +23,7 @@ func (e *OrgTeamPlayer) GetPage(c *dto.OrgTeamPlayerGetPageReq, p *actions.DataP ...@@ -22,7 +23,7 @@ func (e *OrgTeamPlayer) GetPage(c *dto.OrgTeamPlayerGetPageReq, p *actions.DataP
var err error var err error
err = e.Orm.Table("org_match_team_player as omtp"). err = e.Orm.Table("org_match_team_player as omtp").
Select("omtp.id, ol.league_name, os.season_name, om.rounds, omtp.player_name"). Select("omtp.id, omtp.player_id, ol.league_name, om.season_id, os.season_name, om.rounds, omtp.player_name").
Joins("left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"). 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_league as ol on ol.id = om.league_id").
Joins("left join org_season as os on os.id = om.season_id"). Joins("left join org_season as os on os.id = om.season_id").
...@@ -32,6 +33,7 @@ func (e *OrgTeamPlayer) GetPage(c *dto.OrgTeamPlayerGetPageReq, p *actions.DataP ...@@ -32,6 +33,7 @@ func (e *OrgTeamPlayer) GetPage(c *dto.OrgTeamPlayerGetPageReq, p *actions.DataP
actions.Permission("omtp", p), actions.Permission("omtp", p),
cDto.PassDel("omtp"), cDto.PassDel("omtp"),
). ).
//Where("omtp.team_id=?", 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 {
...@@ -314,3 +316,25 @@ func (e *OrgTeamPlayer) Get(d *dto.OrgMatchEvaluateGetReq, p *actions.DataPermis ...@@ -314,3 +316,25 @@ func (e *OrgTeamPlayer) Get(d *dto.OrgMatchEvaluateGetReq, p *actions.DataPermis
} }
return nil return nil
} }
func (e *OrgTeamPlayer) 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 *OrgTeamPlayer) 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"
}
...@@ -25,7 +25,7 @@ func (e *OrgTeamTeam) GetPage(c *dto.OrgTeamTeamGetPageReq, p *actions.DataPermi ...@@ -25,7 +25,7 @@ func (e *OrgTeamTeam) GetPage(c *dto.OrgTeamTeamGetPageReq, p *actions.DataPermi
var data models.OrgMatch var data models.OrgMatch
err = e.Orm.Table("org_match_team_player as omtp"). err = e.Orm.Table("org_match_team_player as omtp").
Select("omtp.team_id, ol.league_name, os.season_name, omtp.rounds,"+ Select("omtp.team_id, ol.league_name, om.season_id, os.season_name, omtp.rounds,"+
"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.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"). "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").
Joins("left join org_match as om on om.id = omtp.match_id and omtp.rounds = om.rounds"). Joins("left join org_match as om on om.id = omtp.match_id and omtp.rounds = om.rounds").
...@@ -223,7 +223,7 @@ func (e *OrgTeamTeam) statisticsRankingList(playerId string, seasonId string, sc ...@@ -223,7 +223,7 @@ func (e *OrgTeamTeam) statisticsRankingList(playerId string, seasonId string, sc
func (e *OrgTeamTeam) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -233,7 +233,7 @@ func (e *OrgTeamTeam) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamPla ...@@ -233,7 +233,7 @@ func (e *OrgTeamTeam) rankingScoring(replyGetPlayerRank []models.OrgMatchTeamPla
} }
func (e *OrgTeamTeam) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -243,7 +243,7 @@ func (e *OrgTeamTeam) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamPla ...@@ -243,7 +243,7 @@ func (e *OrgTeamTeam) rankingRebound(replyGetPlayerRank []models.OrgMatchTeamPla
} }
func (e *OrgTeamTeam) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -253,7 +253,7 @@ func (e *OrgTeamTeam) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPlay ...@@ -253,7 +253,7 @@ func (e *OrgTeamTeam) rankingAssist(replyGetPlayerRank []models.OrgMatchTeamPlay
} }
func (e *OrgTeamTeam) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -263,7 +263,7 @@ func (e *OrgTeamTeam) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPlaye ...@@ -263,7 +263,7 @@ func (e *OrgTeamTeam) rankingSteal(replyGetPlayerRank []models.OrgMatchTeamPlaye
} }
func (e *OrgTeamTeam) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -273,7 +273,7 @@ func (e *OrgTeamTeam) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTeamP ...@@ -273,7 +273,7 @@ func (e *OrgTeamTeam) rankingFreeThrow(replyGetPlayerRank []models.OrgMatchTeamP
} }
func (e *OrgTeamTeam) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -283,7 +283,7 @@ func (e *OrgTeamTeam) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTeamP ...@@ -283,7 +283,7 @@ func (e *OrgTeamTeam) rankingBlockShot(replyGetPlayerRank []models.OrgMatchTeamP
} }
func (e *OrgTeamTeam) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -293,7 +293,7 @@ func (e *OrgTeamTeam) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlayer ...@@ -293,7 +293,7 @@ func (e *OrgTeamTeam) rankingFoul(replyGetPlayerRank []models.OrgMatchTeamPlayer
} }
func (e *OrgTeamTeam) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -303,7 +303,7 @@ func (e *OrgTeamTeam) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatchTe ...@@ -303,7 +303,7 @@ func (e *OrgTeamTeam) rankingTwoPointShot(replyGetPlayerRank []models.OrgMatchTe
} }
func (e *OrgTeamTeam) rankingThreePointShot(replyGetPlayerRank []models.OrgMatchTeamPlayer, playerId string, scoring *cDto.TotalScoring) { func (e *OrgTeamTeam) 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.TeamId == playerId { if v.TeamId == playerId {
...@@ -358,3 +358,25 @@ func (e *OrgTeamTeam) Get(d *dto.OrgMatchEvaluateGetReq, p *actions.DataPermissi ...@@ -358,3 +358,25 @@ func (e *OrgTeamTeam) Get(d *dto.OrgMatchEvaluateGetReq, p *actions.DataPermissi
} }
return nil return nil
} }
func (e *OrgTeamTeam) GetRankForGetPage(seasonId string, teamId 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, teamId)
}
func (e *OrgTeamTeam) rankingForGetPage(replyGetPlayerRank []models.OrgMatchTeamPlayer, teamId 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.TeamId == teamId {
return strconv.Itoa(k + 1)
}
}
return "0"
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
package utils package utils
import ( import (
"bytes"
"fmt" "fmt"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
uuid "github.com/satori/go.uuid"
extConfig "go-admin/config"
"io"
"mime/multipart"
"path/filepath"
"strconv" "strconv"
"time"
) )
func StringToInt(data string) int { func StringToInt(data string) int {
...@@ -20,3 +28,58 @@ func StringToFloat(data string) float64 { ...@@ -20,3 +28,58 @@ func StringToFloat(data string) float64 {
reply, _ := strconv.ParseFloat(data, 64) reply, _ := strconv.ParseFloat(data, 64)
return reply return reply
} }
//上传文件
func UploadFile(f multipart.File, h *multipart.FileHeader) (string, error) {
fullFileName := ""
bucket, err := GetOssBucket()
if err != nil {
return fullFileName, err
}
uuidValue := uuid.NewV4()
guid := uuidValue.String()
buf := bytes.NewBuffer(nil)
_, err = io.Copy(buf, f)
if err != nil {
return fullFileName, err
}
//上传到阿里云oss
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 {
return fullFileName, err
}
return fullFileName, nil
}
func GetOssBucket() (*oss.Bucket, error) {
var Buckets *oss.Bucket
client, err := oss.New(extConfig.ExtConfig.Aliyunoss.Endpoint, extConfig.ExtConfig.Aliyunoss.Accessid, extConfig.ExtConfig.Aliyunoss.Accesskey)
if err != nil {
return nil, err
}
// 获取存储空间。
Buckets, err = client.Bucket(extConfig.ExtConfig.Aliyunoss.Bucket)
if err != nil {
return nil, err
}
return Buckets, nil
}
func GetDate() string {
year := time.Now().Format("2006")
month := time.Now().Format("01")
day := time.Now().Format("02")
return year + month + day
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -8,9 +8,25 @@ var ExtConfig Extend ...@@ -8,9 +8,25 @@ var ExtConfig Extend
// name: demo-name // name: demo-name
// 使用方法: config.ExtConfig......即可!! // 使用方法: config.ExtConfig......即可!!
type Extend struct { type Extend struct {
AMap AMap // 这里配置对应配置文件的结构即可 AMap AMap // 这里配置对应配置文件的结构即可
Aliyunoss Aliyunoss
Upload Upload
} }
type AMap struct { type AMap struct {
Key string Key string
} }
type Aliyunoss struct {
Accessid string
Accesskey string
Endpoint string
Bucket string
Uploaddir string
}
type Upload struct {
Dir string
Maxfilesize int
Imagetypes string
Sacceptfiletypes string
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -44,9 +44,7 @@ settings: ...@@ -44,9 +44,7 @@ settings:
dbname: dbc_nbya dbname: dbc_nbya
# 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径 # 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径
frontpath: ../go-admin-ui/src frontpath: ../go-admin-ui/src
extend: # 扩展项使用说明
demo:
name: data
cache: cache:
# redis: # redis:
# addr: 127.0.0.1:6379 # addr: 127.0.0.1:6379
...@@ -71,3 +69,16 @@ settings: ...@@ -71,3 +69,16 @@ settings:
# reclaimInterval: 1 # reclaimInterval: 1
locker: locker:
redis: redis:
extend:
aliyunoss:
accessid: "LTAIDfwPBC9AnsRt" # 阿里云的accessid
accesskey: "Z6FtUptrAk0Sl6H8vrVBGZLbBzXEpO" # 阿里云的accesskey
endpoint: "oss-cn-beijing.aliyuncs.com" # 阿里云的endpoint
bucket: "nbya" # 阿里云的 bucket名称
uploaddir: "https://dbc-static.oss-cn-beijing.aliyuncs.com/" # 所有上传文件都存在这个目录下面
upload:
dir: "nbya"
maxfilesize: 50000000
imagetypes: "(jpg|jpeg|png|pdf|gif|zip|rar)"
Sacceptfiletypes: IMAGE_TYPES
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -10,7 +10,6 @@ require ( ...@@ -10,7 +10,6 @@ require (
github.com/bytedance/go-tagexpr/v2 v2.7.12 github.com/bytedance/go-tagexpr/v2 v2.7.12
github.com/casbin/casbin/v2 v2.25.1 github.com/casbin/casbin/v2 v2.25.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/forgoer/openssl v1.1.1
github.com/gin-gonic/gin v1.7.3 github.com/gin-gonic/gin v1.7.3
github.com/go-admin-team/go-admin-core v1.3.8 github.com/go-admin-team/go-admin-core v1.3.8
github.com/go-admin-team/go-admin-core/sdk v1.3.9 github.com/go-admin-team/go-admin-core/sdk v1.3.9
...@@ -20,6 +19,7 @@ require ( ...@@ -20,6 +19,7 @@ require (
github.com/opentracing/opentracing-go v1.1.0 github.com/opentracing/opentracing-go v1.1.0
github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_golang v1.11.0
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/satori/go.uuid v1.2.0
github.com/shirou/gopsutil v3.21.5+incompatible github.com/shirou/gopsutil v3.21.5+incompatible
github.com/spf13/cast v1.3.1 github.com/spf13/cast v1.3.1
github.com/spf13/cobra v1.0.0 github.com/spf13/cobra v1.0.0
......
...@@ -175,8 +175,6 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL ...@@ -175,8 +175,6 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pFdJbAhRf7rh6YYMUdIQGyzne6zYL1tCUW8QV2B3UfY= github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pFdJbAhRf7rh6YYMUdIQGyzne6zYL1tCUW8QV2B3UfY=
github.com/forgoer/openssl v1.1.1 h1:eM5ohpXPVQPK8hRjstf1uHBUu9LMG/oObkSpq8wIw/o=
github.com/forgoer/openssl v1.1.1/go.mod h1:NMVFOzYeLVR7UiGTxsa+A21nrERTZ3Rv2JHDPcJpDyI=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc=
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment