作者 tangxvhui

bug 修复

... ... @@ -227,9 +227,17 @@ func (c RankController) RankRangeList() {
defer func() {
c.ResposeJson(msg)
}()
type Parameter struct {
RankTypeId int64 `json:"rank_type_id"`
}
var param Parameter
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
log.Error("json 解析失败 err:%s", err)
msg = protocol.BadRequestParam("1")
return
}
companyid := c.GetCompanyId()
rspData := serverank.GetRankRangeList(companyid)
rspData := serverank.GetRankRangeList(companyid, param.RankTypeId)
msg = protocol.NewReturnResponse(rspData, nil)
return
}
... ...
... ... @@ -248,13 +248,13 @@ func EditRankPeriod(id int64, beginTime int64, endTime int64, name string, compa
}
//获取赛季参与人列表
func GetRankRangeList(companyid int64) []protocol.RankRangeItem {
func GetRankRangeList(companyid int64, rankTypeId int64) []protocol.RankRangeItem {
var (
err error
rspData = make([]protocol.RankRangeItem, 0)
)
datasql := `SELECT a.id ,a.name,a.type,a.status FROM rank_range AS a WHERE company_id=?`
err = utils.ExecuteQueryAll(&rspData, datasql, companyid)
datasql := `SELECT a.id ,a.name,a.type,a.status FROM rank_range AS a WHERE company_id=? AND rank_type_id=?`
err = utils.ExecuteQueryAll(&rspData, datasql, companyid, rankTypeId)
if err != nil {
log.Error("获取参与人列表失败:%s", err)
}
... ... @@ -277,6 +277,9 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank
relationIds = append(relationIds, rankRangeData[i].RelationId)
}
datalist := make([]protocol.RankRangeRelation, 0)
if len(relationIds) == 0 {
return datalist
}
switch rangeType {
case models.RANK_RANGE_TYPE_DEPARTMENT:
//员工
... ...