fix: improve baishun catalog sync and room filtering

This commit is contained in:
hy001 2026-04-15 23:14:04 +08:00
parent d00216ebbc
commit 0364a608f5

View File

@ -28,6 +28,7 @@ const (
baishunVendorType = "BAISHUN"
baishunLaunchModeRemote = "H5_REMOTE"
baishunLaunchModeLocalZip = "H5_ZIP_LOCAL"
baishunGameListTypeGame = 2
baishunCatalogEnabled = "ENABLED"
baishunRoomStateIdle = "IDLE"
baishunRoomStatePlaying = "PLAYING"
@ -886,7 +887,7 @@ func (s *BaishunService) listRoomGames(ctx context.Context, sysOrigin, roomID, c
Joins("JOIN sys_game_list_vendor_ext ext ON ext.game_list_config_id = cfg.id AND ext.enabled = 1").
Joins("LEFT JOIN baishun_game_catalog cat ON cat.sys_origin = cfg.sys_origin AND CAST(cat.vendor_game_id AS CHAR) = ext.vendor_game_id").
Where("cfg.sys_origin = ? AND cfg.is_showcase = 1 AND ext.vendor_type = ?", sysOrigin, baishunVendorType)
if strings.TrimSpace(category) != "" {
if strings.TrimSpace(category) != "" && !strings.EqualFold(strings.TrimSpace(category), "CHAT_ROOM") {
query = query.Where("cfg.category = ?", category)
}
if strings.TrimSpace(roomID) != "" {
@ -1013,6 +1014,7 @@ func (s *BaishunService) fetchPlatformGames(ctx context.Context) ([]baishunPlatf
timestamp := time.Now().Unix()
nonce := s.randomNonce()
payload := map[string]any{
"game_list_type": baishunGameListTypeGame,
"app_channel": s.cfg.BaishunAppChannel,
"app_id": s.cfg.BaishunAppID,
"signature": s.signBAISHUN(timestamp, nonce),