作者 tangxvhui

bug 修复

@@ -227,9 +227,17 @@ func (c RankController) RankRangeList() { @@ -227,9 +227,17 @@ func (c RankController) RankRangeList() {
227 defer func() { 227 defer func() {
228 c.ResposeJson(msg) 228 c.ResposeJson(msg)
229 }() 229 }()
230 - 230 + type Parameter struct {
  231 + RankTypeId int64 `json:"rank_type_id"`
  232 + }
  233 + var param Parameter
  234 + if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
  235 + log.Error("json 解析失败 err:%s", err)
  236 + msg = protocol.BadRequestParam("1")
  237 + return
  238 + }
231 companyid := c.GetCompanyId() 239 companyid := c.GetCompanyId()
232 - rspData := serverank.GetRankRangeList(companyid) 240 + rspData := serverank.GetRankRangeList(companyid, param.RankTypeId)
233 msg = protocol.NewReturnResponse(rspData, nil) 241 msg = protocol.NewReturnResponse(rspData, nil)
234 return 242 return
235 } 243 }
@@ -248,13 +248,13 @@ func EditRankPeriod(id int64, beginTime int64, endTime int64, name string, compa @@ -248,13 +248,13 @@ func EditRankPeriod(id int64, beginTime int64, endTime int64, name string, compa
248 } 248 }
249 249
250 //获取赛季参与人列表 250 //获取赛季参与人列表
251 -func GetRankRangeList(companyid int64) []protocol.RankRangeItem { 251 +func GetRankRangeList(companyid int64, rankTypeId int64) []protocol.RankRangeItem {
252 var ( 252 var (
253 err error 253 err error
254 rspData = make([]protocol.RankRangeItem, 0) 254 rspData = make([]protocol.RankRangeItem, 0)
255 ) 255 )
256 - datasql := `SELECT a.id ,a.name,a.type,a.status FROM rank_range AS a WHERE company_id=?`  
257 - err = utils.ExecuteQueryAll(&rspData, datasql, companyid) 256 + datasql := `SELECT a.id ,a.name,a.type,a.status FROM rank_range AS a WHERE company_id=? AND rank_type_id=?`
  257 + err = utils.ExecuteQueryAll(&rspData, datasql, companyid, rankTypeId)
258 if err != nil { 258 if err != nil {
259 log.Error("获取参与人列表失败:%s", err) 259 log.Error("获取参与人列表失败:%s", err)
260 } 260 }
@@ -277,6 +277,9 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank @@ -277,6 +277,9 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank
277 relationIds = append(relationIds, rankRangeData[i].RelationId) 277 relationIds = append(relationIds, rankRangeData[i].RelationId)
278 } 278 }
279 datalist := make([]protocol.RankRangeRelation, 0) 279 datalist := make([]protocol.RankRangeRelation, 0)
  280 + if len(relationIds) == 0 {
  281 + return datalist
  282 + }
280 switch rangeType { 283 switch rangeType {
281 case models.RANK_RANGE_TYPE_DEPARTMENT: 284 case models.RANK_RANGE_TYPE_DEPARTMENT:
282 //员工 285 //员工