|
|
@@ -82,6 +82,7 @@ func ResetServiceAwardDividendRelation(ch *rabbit.Channel, engine *xorm.Engine, |
|
|
|
CreateAt: v.CreateAt, |
|
|
|
}, md.ServiceAwardDividendRoutKeyForRelation) |
|
|
|
} |
|
|
|
page++ |
|
|
|
} |
|
|
|
|
|
|
|
//3、进行数据清理 |
|
|
@@ -94,11 +95,12 @@ func ResetServiceAwardDividendRelation(ch *rabbit.Channel, engine *xorm.Engine, |
|
|
|
}() |
|
|
|
session.Begin() |
|
|
|
|
|
|
|
sql1 := "DROP TABLE `service_award_dividend_relation_1`" //删除备份表 |
|
|
|
sql2 := "DROP TABLE `service_award_dividend_relation_tmp`" //删除临时表 |
|
|
|
sql3 := "CREATE TABLE `service_award_dividend_relation_tmp` LIKE `service_award_dividend_relation`" //复制表结构 |
|
|
|
sql4 := "ALTER TABLE `service_award_dividend_relation` RENAME TO `service_award_dividend_relation_1`;" //将现有表重命名 -> 备份表 |
|
|
|
sql5 := "ALTER TABLE `service_award_dividend_relation_tmp` RENAME TO `service_award_dividend_relation`;" //将临时表重命名 -> 现有表 |
|
|
|
sql1 := "DROP TABLE `service_award_dividend_relation_1`" //删除备份表 |
|
|
|
sql2 := "DROP TABLE `service_award_dividend_relation_tmp`" //删除临时表 |
|
|
|
sql3 := "CREATE TABLE `service_award_dividend_relation_tmp` LIKE `service_award_dividend_relation`" //复制表结构 |
|
|
|
sql4 := "ALTER TABLE `service_award_dividend_relation` RENAME TO `service_award_dividend_relation_1`" //将现有表重命名 -> 备份表 |
|
|
|
sql5 := "ALTER TABLE `service_award_dividend_relation_tmp` RENAME TO `service_award_dividend_relation`" //将临时表重命名 -> 现有表 |
|
|
|
sql6 := "UPDATE `service_award_dividend_basic` SET `is_refresh_allocation` = 2" //将"是否重排"开关关闭 |
|
|
|
_, err = db.ExecuteOriginalSqlBySession(engine.NewSession(), sql1) |
|
|
|
if err != nil { |
|
|
|
_ = session.Rollback() |
|
|
@@ -131,6 +133,13 @@ func ResetServiceAwardDividendRelation(ch *rabbit.Channel, engine *xorm.Engine, |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) |
|
|
|
_, err = db.ExecuteOriginalSqlBySession(engine.NewSession(), sql6) |
|
|
|
if err != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
err = session.Commit() |
|
|
|
if err != nil { |
|
|
|
_ = session.Rollback() |
|
|
|