作者 tangxvhui

调试

@@ -101,7 +101,7 @@ func (c RankController) RankSeasonList() { @@ -101,7 +101,7 @@ func (c RankController) RankSeasonList() {
101 } 101 }
102 companyid := c.GetCompanyId() 102 companyid := c.GetCompanyId()
103 rspData, err := serverank.RankSeasonList(param.PageIndex, param.PageSize, param.RankTypeId, companyid) 103 rspData, err := serverank.RankSeasonList(param.PageIndex, param.PageSize, param.RankTypeId, companyid)
104 - msg = protocol.NewReturnResponse(rspData, err) 104 + msg = protocol.NewPageDataResponse(rspData, err)
105 return 105 return
106 } 106 }
107 107
@@ -145,11 +145,15 @@ func (c RankController) RankSeasonAdd() { @@ -145,11 +145,15 @@ func (c RankController) RankSeasonAdd() {
145 return 145 return
146 } 146 }
147 endTime = t2.Unix() + 86399 //60*60*24-1 147 endTime = t2.Unix() + 86399 //60*60*24-1
148 - // ok := serverank.RankPeriodCheckTime(param.RankTypeId, beginTime, endTime, 0)  
149 - // if !ok {  
150 - // msg = protocol.BadRequestParam("10101")  
151 - // return  
152 - // } 148 + if beginTime < endTime {
  149 + msg = protocol.BadRequestParam("1")
  150 + return
  151 + }
  152 + ok := serverank.RankPeriodCheckTime(param.RankTypeId, beginTime, endTime, 0)
  153 + if !ok {
  154 + msg = protocol.BadRequestParam("10101")
  155 + return
  156 + }
153 companyid := c.GetCompanyId() 157 companyid := c.GetCompanyId()
154 err = serverank.AddRankPeriod(param.RankTypeId, beginTime, endTime, param.Name, companyid) 158 err = serverank.AddRankPeriod(param.RankTypeId, beginTime, endTime, param.Name, companyid)
155 msg = protocol.NewReturnResponse(nil, err) 159 msg = protocol.NewReturnResponse(nil, err)
@@ -198,11 +202,15 @@ func (c RankController) RankSeasonEdit() { @@ -198,11 +202,15 @@ func (c RankController) RankSeasonEdit() {
198 } 202 }
199 203
200 endTime = t2.Unix() + 86399 //60*60*24-1 204 endTime = t2.Unix() + 86399 //60*60*24-1
201 - // ok := serverank.RankPeriodCheckTime(param.RankTypeId, beginTime, endTime, param.Id)  
202 - // if !ok {  
203 - // msg = protocol.BadRequestParam("10101")  
204 - // return  
205 - // } 205 + if beginTime < endTime {
  206 + msg = protocol.BadRequestParam("1")
  207 + return
  208 + }
  209 + ok := serverank.RankPeriodCheckTime(param.RankTypeId, beginTime, endTime, param.Id)
  210 + if !ok {
  211 + msg = protocol.BadRequestParam("10101")
  212 + return
  213 + }
206 companyid := c.GetCompanyId() 214 companyid := c.GetCompanyId()
207 fmt.Println(beginTime, endTime) 215 fmt.Println(beginTime, endTime)
208 err = serverank.EditRankPeriod(param.Id, beginTime, endTime, param.Name, companyid) 216 err = serverank.EditRankPeriod(param.Id, beginTime, endTime, param.Name, companyid)
@@ -199,7 +199,7 @@ func AddRankPeriod(rankTypeId int64, beginTime int64, endTime int64, name string @@ -199,7 +199,7 @@ func AddRankPeriod(rankTypeId int64, beginTime int64, endTime int64, name string
199 199
200 //RankPeriodCheckTime 设置赛季时检查时间范围的合法性 200 //RankPeriodCheckTime 设置赛季时检查时间范围的合法性
201 func RankPeriodCheckTime(rankTypeId int64, beginTime int64, endTime int64, idNot int64) bool { 201 func RankPeriodCheckTime(rankTypeId int64, beginTime int64, endTime int64, idNot int64) bool {
202 - sql := `SELECT 1 FROM rank_period 202 + sql := `SELECT count(*) FROM rank_period
203 WHERE rank_type_id = %d 203 WHERE rank_type_id = %d
204 AND id <> %d 204 AND id <> %d
205 AND 205 AND