幸运礼物配置更改
This commit is contained in:
parent
e771d1d034
commit
fb745f89fc
@ -24,6 +24,7 @@ import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||
import com.red.circle.other.app.dto.clientobject.game.GameLuckyGiftMsgCO;
|
||||
import com.red.circle.other.app.dto.cmd.gift.GiveAwayGiftBatchCmd;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.infra.config.LuckyGiftApiConfig;
|
||||
import com.red.circle.other.infra.database.cache.entity.game.luckgift.GameLuckyGiftConfigCache;
|
||||
import com.red.circle.other.infra.database.cache.entity.game.luckgift.GameLuckyGiftInventoryCache;
|
||||
import com.red.circle.other.infra.database.cache.entity.game.luckgift.LuckyGiftInventoryTemplateCache;
|
||||
@ -94,22 +95,8 @@ public class GameLuckyGiftCommon {
|
||||
private final LuckyGiftProbabilityService luckyGiftProbabilityService;
|
||||
private final GameLuckyGiftRuleConfigService gameLuckyGiftRuleConfigService;
|
||||
private final LuckyGiftProbabilityDetailsService luckyGiftProbabilityDetailsService;
|
||||
private final LuckyGiftApiConfig luckyGiftApiConfig;
|
||||
|
||||
// 第三方幸运礼物API配置
|
||||
@Value("${lucky.gift.api.url:https://game-cn-test.jieyou.shop/lucky_gift/start_game}")
|
||||
private String luckyGiftApiUrl;
|
||||
|
||||
@Value("${lucky.gift.api.app_key:w0GoEN4hg6GEjaYeB6mSG6VHld0LhdqT}")
|
||||
private String luckyGiftApiAppKey;
|
||||
|
||||
@Value("${lucky.gift.api.app_id:9291621826}")
|
||||
private String luckyGiftApiAppId;
|
||||
|
||||
@Value("${lucky.gift.api.app_channel:likei}")
|
||||
private String luckyGiftApiAppChannel;
|
||||
|
||||
@Value("${lucky.gift.api.enabled:true}")
|
||||
private boolean luckyGiftApiEnabled;
|
||||
|
||||
/**
|
||||
* 发送幸运礼物抽奖mq.
|
||||
@ -682,8 +669,8 @@ public class GameLuckyGiftCommon {
|
||||
requestData.put("room_id", param.getRoomId().toString());
|
||||
requestData.put("user_id", param.getUserId().toString());
|
||||
requestData.put("order_id", orderIds);
|
||||
requestData.put("app_id", luckyGiftApiAppId);
|
||||
requestData.put("app_channel", luckyGiftApiAppChannel);
|
||||
requestData.put("app_id", luckyGiftApiConfig.getAppId());
|
||||
requestData.put("app_channel", luckyGiftApiConfig.getAppChannel());
|
||||
requestData.put("gift_id", param.getGiftId().intValue());
|
||||
requestData.put("gift_price", param.getGift().getGiftCandy().intValue());
|
||||
requestData.put("gift_num", param.getQuantity());
|
||||
@ -702,7 +689,7 @@ public class GameLuckyGiftCommon {
|
||||
|
||||
// 发送HTTP请求 - 使用Hutool的HttpUtil
|
||||
String requestBody = JSON.toJSONString(requestData);
|
||||
String response = HttpUtil.createPost(luckyGiftApiUrl)
|
||||
String response = HttpUtil.createPost(luckyGiftApiConfig.getUrl())
|
||||
.header("Content-Type", "application/json")
|
||||
.header("Accept", "application/json")
|
||||
.timeout(10000)
|
||||
@ -789,7 +776,7 @@ public class GameLuckyGiftCommon {
|
||||
signBuilder.append(key).append("=").append(valueStr);
|
||||
}
|
||||
}
|
||||
signBuilder.append("&app_key=").append(luckyGiftApiAppKey);
|
||||
signBuilder.append("&app_key=").append(luckyGiftApiConfig.getAppKey());
|
||||
|
||||
log.debug("签名原始字符串: {}", signBuilder.toString());
|
||||
|
||||
@ -878,7 +865,7 @@ public class GameLuckyGiftCommon {
|
||||
List<GameLuckyGiftInventoryCache> listInventory, GameLuckyGiftParam param) {
|
||||
|
||||
// 如果启用第三方API,则调用第三方接口
|
||||
if (luckyGiftApiEnabled) {
|
||||
if (luckyGiftApiConfig.isEnabled()) {
|
||||
return drawLuckyGiftWithThirdPartyApi(listInventory, param);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
package com.red.circle.other.infra.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 第三方幸运礼物API配置
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "lucky.gift.api")
|
||||
@RefreshScope
|
||||
public class LuckyGiftApiConfig {
|
||||
|
||||
/**
|
||||
* API地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 应用密钥
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 应用渠道
|
||||
*/
|
||||
private String appChannel;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private boolean enabled = true;
|
||||
|
||||
// Getter 和 Setter 方法
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getAppKey() {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
public void setAppKey(String appKey) {
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppChannel() {
|
||||
return appChannel;
|
||||
}
|
||||
|
||||
public void setAppChannel(String appChannel) {
|
||||
this.appChannel = appChannel;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LuckyGiftApiConfig{" +
|
||||
"url='" + url + '\'' +
|
||||
", appKey='" + "***" + '\'' + // 敏感信息脱敏
|
||||
", appId='" + appId + '\'' +
|
||||
", appChannel='" + appChannel + '\'' +
|
||||
", enabled=" + enabled +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import com.red.circle.other.infra.database.rds.entity.user.user.ArchiveDevice;
|
||||
import com.red.circle.other.inner.model.cmd.user.device.ArchiveDeviceQryCmd;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 封禁设备 服务类.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user