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