增加狗台修复
This commit is contained in:
parent
fa564ef985
commit
42b3a4b595
@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
const adminTimeLayout = "2006-01-02 15:04:05"
|
||||
const baishunRoomCategory = "CHAT_ROOM"
|
||||
|
||||
type adminGameRow struct {
|
||||
ID int64
|
||||
@ -177,7 +178,7 @@ func (s *BaishunService) SaveAdminGame(ctx context.Context, req SaveAdminBaishun
|
||||
if name == "" {
|
||||
return nil, NewAppError(http.StatusBadRequest, "name_required", "name is required")
|
||||
}
|
||||
category := defaultIfBlank(strings.TrimSpace(req.Category), "OTHER")
|
||||
category := defaultIfBlank(strings.TrimSpace(req.Category), baishunRoomCategory)
|
||||
cover := defaultIfBlank(strings.TrimSpace(req.Cover), defaultIfBlank(catalog.Cover, catalog.PreviewURL))
|
||||
clientOrigin := defaultIfBlank(strings.TrimSpace(req.ClientOrigin), "COMMON")
|
||||
gameCode := defaultIfBlank(strings.TrimSpace(req.GameCode), strconv.Itoa(req.VendorGameID))
|
||||
@ -643,7 +644,7 @@ func (s *BaishunService) importCatalogGamesTx(tx *gorm.DB, sysOrigin string, pro
|
||||
GameOrigin: baishunVendorType,
|
||||
GameID: defaultIfBlank(catalog.InternalGameID, fmt.Sprintf("bs_%d", catalog.VendorGameID)),
|
||||
Name: catalog.Name,
|
||||
Category: "OTHER",
|
||||
Category: baishunRoomCategory,
|
||||
GameCode: vendorGameID,
|
||||
Cover: defaultIfBlank(catalog.Cover, catalog.PreviewURL),
|
||||
Showcase: true,
|
||||
|
||||
@ -134,6 +134,13 @@ func TestImportAndListRoomGamesUseActiveProfile(t *testing.T) {
|
||||
} else if resp.Imported != 1 {
|
||||
t.Fatalf("prod imported = %d, want 1", resp.Imported)
|
||||
}
|
||||
var prodConfig model.SysGameListConfig
|
||||
if err := db.Where("sys_origin = ? AND game_origin = ? AND game_id = ?", "LIKEI", baishunVendorType, "bs_9001").First(&prodConfig).Error; err != nil {
|
||||
t.Fatalf("load imported prod config: %v", err)
|
||||
}
|
||||
if prodConfig.Category != baishunRoomCategory {
|
||||
t.Fatalf("imported prod category = %q, want %q", prodConfig.Category, baishunRoomCategory)
|
||||
}
|
||||
if resp, err := service.ImportCatalogGames(ctx, "LIKEI", baishunProfileTest, []int{9001}); err != nil {
|
||||
t.Fatalf("import test catalog: %v", err)
|
||||
} else if resp.Imported != 1 {
|
||||
|
||||
@ -15,6 +15,8 @@ CREATE TABLE IF NOT EXISTS baishun_provider_config (
|
||||
ss_token_ttl_seconds INT NOT NULL DEFAULT 86400,
|
||||
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
create_user BIGINT DEFAULT NULL,
|
||||
update_user BIGINT DEFAULT NULL,
|
||||
UNIQUE KEY uk_baishun_provider_sys_origin_profile (sys_origin, profile),
|
||||
KEY idx_baishun_provider_app (app_id, app_channel),
|
||||
KEY idx_baishun_provider_active (sys_origin, active, update_time)
|
||||
|
||||
29
migrations/012_baishun_provider_audit_columns.sql
Normal file
29
migrations/012_baishun_provider_audit_columns.sql
Normal file
@ -0,0 +1,29 @@
|
||||
SET @current_schema := DATABASE();
|
||||
|
||||
SET @add_provider_create_user_sql := IF(
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_schema = @current_schema
|
||||
AND table_name = 'baishun_provider_config'
|
||||
AND column_name = 'create_user'
|
||||
),
|
||||
'ALTER TABLE `baishun_provider_config` ADD COLUMN `create_user` bigint DEFAULT NULL AFTER `update_time`',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE add_provider_create_user_stmt FROM @add_provider_create_user_sql;
|
||||
EXECUTE add_provider_create_user_stmt;
|
||||
DEALLOCATE PREPARE add_provider_create_user_stmt;
|
||||
|
||||
SET @add_provider_update_user_sql := IF(
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_schema = @current_schema
|
||||
AND table_name = 'baishun_provider_config'
|
||||
AND column_name = 'update_user'
|
||||
),
|
||||
'ALTER TABLE `baishun_provider_config` ADD COLUMN `update_user` bigint DEFAULT NULL AFTER `create_user`',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE add_provider_update_user_stmt FROM @add_provider_update_user_sql;
|
||||
EXECUTE add_provider_update_user_stmt;
|
||||
DEALLOCATE PREPARE add_provider_update_user_stmt;
|
||||
8
migrations/013_baishun_chat_room_category.sql
Normal file
8
migrations/013_baishun_chat_room_category.sql
Normal file
@ -0,0 +1,8 @@
|
||||
UPDATE `sys_game_list_config` cfg
|
||||
JOIN `sys_game_list_vendor_ext` ext
|
||||
ON ext.game_list_config_id = cfg.id
|
||||
AND ext.vendor_type = 'BAISHUN'
|
||||
SET cfg.category = 'CHAT_ROOM'
|
||||
WHERE cfg.game_origin = 'BAISHUN'
|
||||
AND COALESCE(cfg.category, '') <> 'CHAT_ROOM'
|
||||
AND COALESCE(cfg.game_mode, '') LIKE '%2%';
|
||||
Loading…
x
Reference in New Issue
Block a user