fix: validate explicit migrations and preserve large business ids

This commit is contained in:
Yvan
2026-11-06 07:00:05 +08:00
parent f6f2a4745e
commit 0f0ec2e6d7
53 changed files with 2653 additions and 1445 deletions
+10 -2
View File
@@ -119,7 +119,7 @@ func TestChannelHTTPListsMetricsOptionsAndAtomicCreation(t *testing.T) {
rootRow := func(data map[string]any) map[string]any {
for _, raw := range data["rows"].([]any) {
row := raw.(map[string]any)
if row["id"] == float64(100) && row["sourceDb"] == "lx" {
if row["id"] == "100" && row["sourceDb"] == "lx" {
return row
}
}
@@ -151,7 +151,7 @@ func TestChannelHTTPListsMetricsOptionsAndAtomicCreation(t *testing.T) {
list(8, "?lockStatus=-1", 1)
list(1, "?busierAccount=leaf", 2)
options := call(8, "GET", "/sw/promote/bindOptions?sourceDb=lx", "", 0).([]any)
if len(options) != 1 || options[0].(map[string]any)["platformBusierId"] != float64(14) {
if len(options) != 1 || options[0].(map[string]any)["platformBusierId"] != "14" {
t.Fatal("上级未获取下级正常绑定")
}
body := `{"sourceDb":"lx","platformBusierId":"14","account":"中文渠道","password":"demo123","registerType":1}`
@@ -193,6 +193,14 @@ func TestChannelHTTPListsMetricsOptionsAndAtomicCreation(t *testing.T) {
if game["gameName"] != "汇总游戏" || game["registerCount"] != float64(2) || game["payAmount"] != "70.00" {
t.Fatalf("游戏分布误用了原始注册/充值或错误金额口径: %+v", game)
}
if err := db.Exec("UPDATE tab_promote SET id=9007199254740993 WHERE source_db='lx' AND id=100").Error; err != nil {
t.Fatal(err)
}
large := list(8, "?keyword=main-channel", 1)["rows"].([]any)[0].(map[string]any)
if large["id"] != "9007199254740993" {
t.Fatalf("HTTP response rounded channel ID: %v", large["id"])
}
call(8, "GET", "/sw/promote/game-distribution?sourceDb=lx&promoteId="+large["id"].(string), "", 0)
if err := db.Exec("DROP TABLE tab_promote").Error; err != nil {
t.Fatal(err)
}