feat: support baishun app name in golang bridge
This commit is contained in:
parent
ca828818cf
commit
f396a19298
@ -22,6 +22,7 @@ type Config struct {
|
||||
JavaWalletBaseURL string
|
||||
BaishunPlatformBaseURL string
|
||||
BaishunAppID int64
|
||||
BaishunAppName string
|
||||
BaishunAppChannel string
|
||||
BaishunAppKey string
|
||||
BaishunGSP int
|
||||
@ -48,6 +49,7 @@ func Load() Config {
|
||||
JavaWalletBaseURL: getEnv("GAME_JAVA_WALLET_BASE_URL", "http://127.0.0.1:2300"),
|
||||
BaishunPlatformBaseURL: getEnv("BAISHUN_PLATFORM_BASE_URL", ""),
|
||||
BaishunAppID: getEnvInt64("BAISHUN_APP_ID", 0),
|
||||
BaishunAppName: getEnv("BAISHUN_APP_NAME", ""),
|
||||
BaishunAppChannel: getEnv("BAISHUN_APP_CHANNEL", ""),
|
||||
BaishunAppKey: getEnv("BAISHUN_APP_KEY", ""),
|
||||
BaishunGSP: getEnvInt("BAISHUN_GSP", 101),
|
||||
|
||||
@ -118,6 +118,7 @@ type BaishunGameConfig struct {
|
||||
}
|
||||
|
||||
type BaishunBridgeConfig struct {
|
||||
AppName string `json:"appName"`
|
||||
AppChannel string `json:"appChannel"`
|
||||
AppID int64 `json:"appId"`
|
||||
UserID string `json:"userId"`
|
||||
@ -435,6 +436,7 @@ func (s *BaishunService) LaunchGame(ctx context.Context, user AuthUser, req Bais
|
||||
SafeHeight: row.safeHeight(),
|
||||
},
|
||||
BridgeConfig: BaishunBridgeConfig{
|
||||
AppName: s.cfg.BaishunAppName,
|
||||
AppChannel: defaultIfBlank(s.cfg.BaishunAppChannel, "skychat"),
|
||||
AppID: s.cfg.BaishunAppID,
|
||||
UserID: strconv.FormatInt(user.UserID, 10),
|
||||
@ -1017,6 +1019,9 @@ func (s *BaishunService) fetchPlatformGames(ctx context.Context) ([]baishunPlatf
|
||||
"signature_nonce": nonce,
|
||||
"timestamp": timestamp,
|
||||
}
|
||||
if strings.TrimSpace(s.cfg.BaishunAppName) != "" {
|
||||
payload["app_name"] = s.cfg.BaishunAppName
|
||||
}
|
||||
body, _ := json.Marshal(payload)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, strings.TrimRight(s.cfg.BaishunPlatformBaseURL, "/")+"/v1/api/gamelist", bytes.NewReader(body))
|
||||
if err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user