...
|
...
|
@@ -819,8 +819,29 @@ func RankRangeMove(fromId int64, toId int64, relationId []int64, companyid int64 |
|
|
o.Rollback()
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if err = removeRanks(o, companyid, fromRankRange.RankTypeId, fromRankRange.Id, relationId); err != nil {
|
|
|
log.Error("更新rank数据失败:%s", err)
|
|
|
o.Rollback()
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
o.Commit()
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// func SetAutoCreateRank
|
|
|
//排行榜批量转移用户时 ,把当前进行的排行榜分数置为无效
|
|
|
func removeRanks(o orm.Ormer, companyId, rankTypeId, rankRangeId int64, relationIds []int64) (err error) {
|
|
|
var sqlRemoveRanks = fmt.Sprintf(`
|
|
|
update rank set enable_status=0,update_at=NOW()
|
|
|
where company_id=? and rank_type_id=? and rank_range_id=? and rank_period_id in
|
|
|
(
|
|
|
select id from rank_period where company_id=? and rank_type_id=? and status=1
|
|
|
) and relation_id in (%v)
|
|
|
`, utils.JoinInt64s(relationIds, ","))
|
|
|
if _, err = o.Raw(sqlRemoveRanks, companyId, rankTypeId, rankRangeId,
|
|
|
companyId, rankTypeId,
|
|
|
).Exec(); err != nil {
|
|
|
return
|
|
|
}
|
|
|
return
|
|
|
} |
...
|
...
|
|