作者 tangxvhui

赛季列表调整

@@ -89,15 +89,18 @@ func (c RankController) RankSeasonList() { @@ -89,15 +89,18 @@ func (c RankController) RankSeasonList() {
89 defer func() { 89 defer func() {
90 c.ResposeJson(msg) 90 c.ResposeJson(msg)
91 }() 91 }()
92 -  
93 - var param protocol.RequestPageInfo 92 + type Parameter struct {
  93 + protocol.RequestPageInfo
  94 + RankTypeId int64 `json:"rank_type_id"`
  95 + }
  96 + var param Parameter
94 if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil { 97 if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
95 log.Error("json 解析失败 err:%s", err) 98 log.Error("json 解析失败 err:%s", err)
96 msg = protocol.BadRequestParam("1") 99 msg = protocol.BadRequestParam("1")
97 return 100 return
98 } 101 }
99 companyid := c.GetCompanyId() 102 companyid := c.GetCompanyId()
100 - rspData, err := serverank.RankSeasonList(param.PageIndex, param.PageSize, companyid) 103 + rspData, err := serverank.RankSeasonList(param.PageIndex, param.PageSize, param.RankTypeId, companyid)
101 msg = protocol.NewReturnResponse(rspData, err) 104 msg = protocol.NewReturnResponse(rspData, err)
102 return 105 return
103 } 106 }
@@ -144,7 +144,7 @@ func AllowRank(id int64, companyid int64) error { @@ -144,7 +144,7 @@ func AllowRank(id int64, companyid int64) error {
144 } 144 }
145 145
146 //RankSeasonList ..获取赛季列表 146 //RankSeasonList ..获取赛季列表
147 -func RankSeasonList(pageindex int, pagesize int, companyid int64) (protocol.ResponseRankSeasonList, error) { 147 +func RankSeasonList(pageindex int, pagesize int, rankTypeId int64, companyid int64) (protocol.ResponseRankSeasonList, error) {
148 var ( 148 var (
149 err error 149 err error
150 listdata []protocol.RankSeasonItem 150 listdata []protocol.RankSeasonItem
@@ -157,10 +157,10 @@ func RankSeasonList(pageindex int, pagesize int, companyid int64) (protocol.Resp @@ -157,10 +157,10 @@ func RankSeasonList(pageindex int, pagesize int, companyid int64) (protocol.Resp
157 List: make([]protocol.RankSeasonItem, 0), 157 List: make([]protocol.RankSeasonItem, 0),
158 } 158 }
159 pageStart := (pageindex - 1) * pagesize 159 pageStart := (pageindex - 1) * pagesize
160 - datasql := `SELECT id,season_name,begin_time,end_time,status FROM rank_period WHERE company_id = ?` 160 + datasql := `SELECT id,season_name,begin_time,end_time,status FROM rank_period WHERE company_id = ? AND rank_type_id=? `
161 datasql = fmt.Sprintf("%s ORDER BY begin_time DESC limit %d,%d", datasql, pageStart, pagesize) 161 datasql = fmt.Sprintf("%s ORDER BY begin_time DESC limit %d,%d", datasql, pageStart, pagesize)
162 - countsql := `SELECT COUNT(*) FROM rank_period WHERE company_id = ?`  
163 - err = utils.ExecuteQueryOne(&cnt, countsql, companyid) 162 + countsql := `SELECT COUNT(*) FROM rank_period WHERE company_id = ? AND rank_type_id=? `
  163 + err = utils.ExecuteQueryOne(&cnt, countsql, companyid, rankTypeId)
164 if err != nil { 164 if err != nil {
165 log.Error("EXCUTE SQL ERR:%s", err) 165 log.Error("EXCUTE SQL ERR:%s", err)
166 return rspData, nil 166 return rspData, nil
@@ -168,7 +168,7 @@ func RankSeasonList(pageindex int, pagesize int, companyid int64) (protocol.Resp @@ -168,7 +168,7 @@ func RankSeasonList(pageindex int, pagesize int, companyid int64) (protocol.Resp
168 if cnt <= 0 { 168 if cnt <= 0 {
169 return rspData, nil 169 return rspData, nil
170 } 170 }
171 - err = utils.ExecuteQueryAll(&listdata, datasql, companyid) 171 + err = utils.ExecuteQueryAll(&listdata, datasql, companyid, rankTypeId)
172 if err != nil { 172 if err != nil {
173 log.Error("EXCUTE SQL ERR:%s", err) 173 log.Error("EXCUTE SQL ERR:%s", err)
174 return rspData, nil 174 return rspData, nil