代码-升级nacos client
This commit is contained in:
@@ -4,12 +4,11 @@ import com.accompany.core.config.SysConfNacosConfig;
|
||||
import com.accompany.core.model.SysConf;
|
||||
import com.accompany.core.service.SysConfService;
|
||||
import com.accompany.core.util.BeanUtils;
|
||||
import com.alibaba.nacos.api.annotation.NacosInjected;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
@@ -25,8 +24,8 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class SysConfAdminService extends SysConfService {
|
||||
|
||||
@Autowired
|
||||
private NacosConfigProperties nacosConfigProperties;
|
||||
@NacosInjected
|
||||
private ConfigService nacosConfigService;
|
||||
|
||||
private static final String SYS_CONF_DATA_ID = "sysconf.yml";
|
||||
private static final String GROUP = "DEFAULT_GROUP";
|
||||
@@ -103,7 +102,6 @@ public class SysConfAdminService extends SysConfService {
|
||||
//构造约定的yaml格式,推送到nacos。保证SysConfNacosConfig.data能读到数据
|
||||
Yaml yaml = new Yaml();
|
||||
String content = yaml.dump(ImmutableMap.of(SysConfNacosConfig.PREFIX, ImmutableMap.of("data", maps)));
|
||||
ConfigService configService = nacosConfigProperties.configServiceInstance();
|
||||
configService.publishConfig(SYS_CONF_DATA_ID, GROUP, content);
|
||||
nacosConfigService.publishConfig(SYS_CONF_DATA_ID, GROUP, content);
|
||||
}
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@
|
||||
r.uid,
|
||||
pi.`desc` as partitionDesc
|
||||
from room as r
|
||||
left join partition_info as pi on pi.partition_id = r.id
|
||||
left join partition_info as pi on r.partition_id = pi.id
|
||||
where r.uid in
|
||||
<foreach collection="uidList" item="uid" open="(" separator="," close=")">
|
||||
#{uid}
|
||||
|
@@ -13,8 +13,17 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
application:
|
||||
@@ -32,8 +41,19 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
application:
|
||||
@@ -51,5 +71,16 @@ spring:
|
||||
namespace: 0c9bf047-19ca-4969-bf5d-bbc1f86b501a
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
@@ -13,8 +13,17 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
@@ -30,8 +39,19 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
@@ -47,5 +67,16 @@ spring:
|
||||
namespace: 0c9bf047-19ca-4969-bf5d-bbc1f86b501a
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
@@ -50,6 +50,6 @@ public class ApplicationConstant {
|
||||
*/
|
||||
public static final List<String> PUBLIC_PARAMTER_NAMES = List.of("pub_sign", "pub_uid", "pub_ticket",
|
||||
"appVersion", "appVersionCode", "channel", "deviceId", "ispType", "model", "netType", "os", "osVersion", "app", "ticket", "client", "deviceId",
|
||||
"androidId", "channel", "lang", "mcc", "oaid", "oaidMd5", "Accept-Language", "h5_token");
|
||||
"androidId", "channel", "lang", "mcc", "oaid", "oaidMd5");
|
||||
|
||||
}
|
||||
|
@@ -19,8 +19,6 @@ public enum OperateType {
|
||||
|
||||
IN,
|
||||
|
||||
LEFT_LIKE,
|
||||
|
||||
JSON;
|
||||
LEFT_LIKE;
|
||||
|
||||
}
|
||||
|
@@ -20,26 +20,14 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-nacos-config</artifactId>
|
||||
<version>${nacos.config.version}</version>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
<version>${redisson.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-data-25</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-data-20</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@@ -8,14 +8,12 @@ package com.accompany.common.constant;
|
||||
*/
|
||||
public enum AppEnum {
|
||||
|
||||
peko("peko", "peko", "beta.api.pekolive.com", "beta.img.pekolive.com", "beta.api.pekolive.com", "peko"),
|
||||
pekoEnterprise("pekoEnterprise", "beta.api.pekolive.com", "peko企业包", "beta.img.pekolive.com", "beta.api.pekolive.com", "peko"),
|
||||
youmi("youmi", "peko ios马甲包", "beta.api.molistar.xyz", "beta.img.pekolive.com", "beta.api.molistar.xyz", "molistar"),
|
||||
molistar("molistar", "peko google马甲包", "beta.api.molistar.xyz", "img.molistar.xyz", "beta.api.molistar.xyz", "molistar"),
|
||||
youmi("youmi", "molistar ios马甲包", "api.hfighting.com", "image.molistar.xyz", "api.hfighting.com", "molistar"),
|
||||
molistar("molistar", "molistar google马甲包", "api.molistar.xyz", "image.molistar.xyz", "api.molistar.xyz", "molistar"),
|
||||
;
|
||||
|
||||
public static AppEnum getCurApp(){
|
||||
return AppEnum.peko;
|
||||
return AppEnum.molistar;
|
||||
}
|
||||
|
||||
private String value;
|
||||
|
@@ -1250,13 +1250,10 @@ public enum RedisKey {
|
||||
//红包雨列表
|
||||
red_envelope_rain_list,
|
||||
|
||||
//小游戏sstoken
|
||||
baishun_ss_token,
|
||||
|
||||
;
|
||||
|
||||
public String getKey() {
|
||||
return ("peko_" + name()).toLowerCase();
|
||||
return ("molistar_" + name()).toLowerCase();
|
||||
}
|
||||
|
||||
public String getKey(String suffix) {
|
||||
@@ -1287,7 +1284,7 @@ public enum RedisKey {
|
||||
}
|
||||
|
||||
public static String getCacheSign() {
|
||||
return "peko_";
|
||||
return "molistar_";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -37,32 +37,35 @@ public class BusiResult<T> {
|
||||
}
|
||||
|
||||
public BusiResult(BusiStatus status, T data) {
|
||||
if (status == null) {
|
||||
status = BusiStatus.SERVERBUSY;
|
||||
if (status != null) {
|
||||
this.code = status.value();
|
||||
this.codeName = status.name();
|
||||
this.message = status.getReasonPhrase();
|
||||
} else {
|
||||
this.code = BusiStatus.SERVERBUSY.value();
|
||||
}
|
||||
this.code = status.value();
|
||||
this.codeName = status.name();
|
||||
this.message = status.getReasonPhrase();
|
||||
this.data = data;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public BusiResult(BusiStatus status, String message) {
|
||||
if (status == null) {
|
||||
status = BusiStatus.SERVERBUSY;
|
||||
if (status != null) {
|
||||
this.code = status.value();
|
||||
this.codeName = status.name();
|
||||
} else {
|
||||
this.code = BusiStatus.SERVERBUSY.value();
|
||||
}
|
||||
this.code = status.value();
|
||||
this.codeName = status.name();
|
||||
this.message = message;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public BusiResult(BusiStatus status, String message, T data) {
|
||||
if (status == null) {
|
||||
status = BusiStatus.SERVERBUSY;
|
||||
if (status != null) {
|
||||
this.code = status.value();
|
||||
this.codeName = status.name();
|
||||
} else {
|
||||
this.code = BusiStatus.SERVERBUSY.value();
|
||||
}
|
||||
this.code = status.value();
|
||||
this.codeName = status.name();
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
@@ -73,12 +76,13 @@ public class BusiResult<T> {
|
||||
}
|
||||
|
||||
public void setBusiResult(BusiStatus status) {
|
||||
if (status == null) {
|
||||
status = BusiStatus.SERVERBUSY;
|
||||
if (status != null) {
|
||||
this.code = status.value();
|
||||
this.codeName = status.name();
|
||||
this.message = status.getReasonPhrase();
|
||||
} else {
|
||||
this.code = 500;
|
||||
}
|
||||
this.code = status.value();
|
||||
this.codeName = status.name();
|
||||
this.message = status.getReasonPhrase();
|
||||
}
|
||||
|
||||
public static <T> BusiResult<T> success() {
|
||||
|
@@ -152,10 +152,6 @@ public enum BillObjTypeEnum {
|
||||
|
||||
VIP_RETURN_PROFIT((byte) 109, "VIP等級獎勵", BillTypeEnum.IN, CurrencyEnum.DIAMOND),
|
||||
|
||||
MINI_GAME_IN((byte) 110, "小遊戲收入", BillTypeEnum.IN, CurrencyEnum.DIAMOND),
|
||||
|
||||
MINI_GAME_OUT((byte) 111, "小遊戲支出", BillTypeEnum.OUT, CurrencyEnum.DIAMOND),
|
||||
|
||||
;
|
||||
|
||||
BillObjTypeEnum(byte value, String desc, BillTypeEnum type, CurrencyEnum currency) {
|
||||
|
@@ -43,7 +43,7 @@ public class MessageSourceI18nSerialize extends JsonSerializer<String> implement
|
||||
MessageSource messageSource = SpringContextHolder.getBean(MessageSource.class);
|
||||
Environment environment = SpringContextHolder.getBean(Environment.class);
|
||||
String applicationName = environment.getProperty("spring.application.name");
|
||||
if (StrUtil.isBlank(applicationName)){
|
||||
if (StrUtil.isBlank(applicationName)) {
|
||||
jsonGenerator.writeString(str);
|
||||
} else if (Constant.ApplicationName.ADMIN.equals(applicationName)) {
|
||||
if (BusiStatus.class.getSimpleName().equals(className)) {
|
||||
|
@@ -5,11 +5,11 @@ import com.accompany.common.utils.StringUtils;
|
||||
import com.accompany.core.base.SpringContextHolder;
|
||||
import com.accompany.core.config.I18nMessageNacosAutoConfig;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.api.annotation.NacosInjected;
|
||||
import com.alibaba.nacos.api.config.ConfigService;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.alibaba.nacos.NacosConfigProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -33,8 +33,8 @@ import java.util.concurrent.TimeUnit;
|
||||
@Slf4j
|
||||
public class MessageI18nNacosService {
|
||||
|
||||
@Autowired
|
||||
private NacosConfigProperties nacosConfigProperties;
|
||||
@NacosInjected
|
||||
private ConfigService nacosConfigService;
|
||||
|
||||
@Autowired
|
||||
private I18nMessageNacosAutoConfig i18nMessageNacosAutoConfig;
|
||||
@@ -72,13 +72,11 @@ public class MessageI18nNacosService {
|
||||
public String getMessageByKey(String key, String messageId) {
|
||||
Properties props = null;
|
||||
try {
|
||||
// 创建Nacos配置服务实例
|
||||
ConfigService configService = nacosConfigProperties.configServiceInstance();
|
||||
// 获取配置文件内容
|
||||
if (StringUtils.isBlank(messageId)) {
|
||||
messageId = MESSAGES_CONF_DATA_ID;
|
||||
}
|
||||
String content = configService.getConfig(messageId, GROUP, 5000);
|
||||
String content = nacosConfigService.getConfig(messageId, GROUP, 5000);
|
||||
|
||||
// 将Properties格式的配置文件内容转换为Properties对象
|
||||
props = new Properties();
|
||||
@@ -123,8 +121,7 @@ public class MessageI18nNacosService {
|
||||
@SneakyThrows
|
||||
public boolean saveOrUpdateProperties(String key, String value, String messageId) {
|
||||
// 创建Nacos配置服务实例
|
||||
ConfigService configService = nacosConfigProperties.configServiceInstance();
|
||||
String content = configService.getConfig(messageId, GROUP, 5000);
|
||||
String content = nacosConfigService.getConfig(messageId, GROUP, 5000);
|
||||
Properties properties = new Properties();
|
||||
properties.load(new StringReader(content));
|
||||
// 修改属性值
|
||||
@@ -132,7 +129,7 @@ public class MessageI18nNacosService {
|
||||
String newContent = propertiesToString(properties);
|
||||
i18nMessageNacosAutoConfig.saveAsFileWriter(messageId, newContent);
|
||||
// 更新配置
|
||||
return configService.publishConfig(
|
||||
return nacosConfigService.publishConfig(
|
||||
messageId,
|
||||
GROUP,
|
||||
newContent);
|
||||
|
@@ -1,27 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 16:16
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunBalanceInfo {
|
||||
|
||||
/**
|
||||
* 货币名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 货币类型定义,和传给H5前端 的⼀致
|
||||
*/
|
||||
private Integer currency_type;
|
||||
|
||||
/**
|
||||
* 货币余额
|
||||
*/
|
||||
private Double currency_amount;
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 11:03
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunBaseReq {
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private Long app_id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String user_id;
|
||||
|
||||
|
||||
/**
|
||||
* 签名
|
||||
*/
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* nonce
|
||||
*/
|
||||
private String signature_nonce;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private Long timestamp;
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 15:17
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class BaiShunBaseResp<T> {
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private Integer code = 0;
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message = "succeed";
|
||||
|
||||
/**
|
||||
* 唯一ID
|
||||
*/
|
||||
private String unique_id = UUID.randomUUID().toString();
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
public BaiShunBaseResp(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@@ -1,68 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 11:13
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunChangeBalanceReq extends BaiShunBaseReq {
|
||||
|
||||
/**
|
||||
* TOKEN
|
||||
*/
|
||||
private String ss_token;
|
||||
|
||||
/**
|
||||
* 变更的游戏币,负值减少, 正值增加
|
||||
*/
|
||||
private Integer currency_diff;
|
||||
|
||||
/**
|
||||
* 游戏 id, BAISHUN 提供的⼩游戏 ID
|
||||
*/
|
||||
private Integer game_id;
|
||||
|
||||
/**
|
||||
* 房间 ID,透传 getConfig 返回的 roomid
|
||||
*/
|
||||
private String room_id;
|
||||
|
||||
/**
|
||||
* ⼀局的 id
|
||||
*/
|
||||
private String game_round_id;
|
||||
|
||||
/**
|
||||
* 订单 ID,唯⼀
|
||||
*/
|
||||
private String order_id;
|
||||
|
||||
/**
|
||||
* 变化的时间戳
|
||||
*/
|
||||
private Long change_time_at;
|
||||
|
||||
/**
|
||||
* 变化原因,"bet","result", "refund", "buyin", "buyout" "buyin": 捕⻥买⼊,"buyout":捕⻥带出,如果捕⻥游戏是代 ⼊带出模式
|
||||
* 该接⼝只在买⼊,带出时候调⽤
|
||||
*/
|
||||
private String diff_msg;
|
||||
|
||||
/**
|
||||
* 扩展字段
|
||||
*/
|
||||
private String extend;
|
||||
|
||||
/**
|
||||
* 定义扩展字段中消息的类型
|
||||
*/
|
||||
private String msg_type;
|
||||
|
||||
/**
|
||||
* 货币类型,app定义
|
||||
*/
|
||||
private Integer currency_type;
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 17:01
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunChangeBalanceResp {
|
||||
|
||||
/**
|
||||
* 剩余总值
|
||||
*/
|
||||
private Double currency_balance;
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 10:03
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunGameConfigDto {
|
||||
|
||||
/**
|
||||
* 场馆级别,默认为 0 0:场馆列表 1:初级场 2:中级场 3:⾼级场 (⽬前仅 slots 游戏⽀持:1 :弥勒佛 2 :USA 3 :777)
|
||||
*/
|
||||
private Integer sceneMode;
|
||||
|
||||
/**
|
||||
* 货币图标(外⽹可访问 URL,60*60 ⼤⼩)
|
||||
*/
|
||||
private String currencyIcon;
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 17:03
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunGameInfoResp {
|
||||
|
||||
/**
|
||||
* 游戏 ID
|
||||
*/
|
||||
private Long game_id;
|
||||
|
||||
/**
|
||||
* 游戏名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 游戏 icon 加载地址
|
||||
*/
|
||||
private String preview_url;
|
||||
|
||||
/**
|
||||
* 游戏版本
|
||||
*/
|
||||
private String game_version;
|
||||
|
||||
/**
|
||||
* 游戏包加载地址
|
||||
*/
|
||||
private String download_url;
|
||||
|
||||
/**
|
||||
* 游戏⽀持的模式, 2:秀场 3:游戏场
|
||||
*/
|
||||
private List<Integer> game_mode;
|
||||
|
||||
/**
|
||||
* 1 竖屏,2 横屏
|
||||
*/
|
||||
private Integer game_orientation;
|
||||
|
||||
/**
|
||||
* 游戏的安全⾼ (游戏有效 UI ⾼度)
|
||||
*/
|
||||
private Integer safe_height;
|
||||
|
||||
/**
|
||||
* ⽀持的场馆列表
|
||||
*/
|
||||
private List<Integer> venue_level;
|
||||
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 14:04
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunGameListReq extends BaiShunBaseReq {
|
||||
|
||||
/**
|
||||
* 游戏列表类型,2 游戏, 3 秀场
|
||||
*/
|
||||
private Integer game_list_type;
|
||||
|
||||
/**
|
||||
* 渠道名称,由 BAISHUN 后台配置
|
||||
*/
|
||||
private String app_channel;
|
||||
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 09:57
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunGetConfigDto {
|
||||
|
||||
/**
|
||||
* 商⼾渠道(BAISHUN 提供,商⼾后台可查看)
|
||||
*/
|
||||
private String appChannel;
|
||||
|
||||
/**
|
||||
* 商⼾ id(BAISHUN 提供,商⼾后台可查看)
|
||||
*/
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 商⼾⽣成的认证令牌(⽤于游戏服务器获取⽤⼾信 息)
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 游戏场景 2:半屏(秀场) 3: 全屏(游戏场)
|
||||
*/
|
||||
private String gameMode;
|
||||
|
||||
/**
|
||||
* 游戏配置
|
||||
*/
|
||||
private BaiShunGameConfigDto gameConfig;
|
||||
|
||||
/**
|
||||
* 游戏正式服务器节点 101:新加坡(阿⾥云) 201:迪拜(AWS) 301:硅⾕ (阿⾥云) 401:法兰克福(阿⾥云)
|
||||
*/
|
||||
private Integer gsp;
|
||||
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 10:55
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunGetSSTokenReq extends BaiShunBaseReq {
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 11:06
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunGetUserInfoReq extends BaiShunBaseReq {
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
private String ss_token;
|
||||
|
||||
/**
|
||||
* 客户端IP
|
||||
*/
|
||||
private String client_ip;
|
||||
|
||||
/**
|
||||
* 游戏ID
|
||||
*/
|
||||
private Integer game_id;
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 16:12
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunGetUserInfoResp {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String user_id;
|
||||
|
||||
/**
|
||||
* ⽤⼾的昵称,⽤⼾在游戏中显⽰
|
||||
*/
|
||||
private String user_name;
|
||||
|
||||
/**
|
||||
* ⽤⼾的头像加载地址,⽤⼾在游戏中 显⽰
|
||||
*/
|
||||
private String user_avatar;
|
||||
|
||||
/**
|
||||
* ⽤⼾的游戏币
|
||||
*/
|
||||
private Double balance;
|
||||
|
||||
/**
|
||||
* ⽤⼾游戏币信息数组,对多币种平台
|
||||
*/
|
||||
private List<BaiShunBalanceInfo> balance_list;
|
||||
|
||||
/**
|
||||
* 1:普通⽤⼾,2:⽩名单⽤⼾,3:⿊名单 ⽤⼾
|
||||
*/
|
||||
private Integer user_type;
|
||||
|
||||
/**
|
||||
* 该值⼤于等于0,user_type 在⾮0条 件下,转变为普通⽤⼾的输赢游戏币 数量
|
||||
*/
|
||||
private Integer release_cond;
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 11:34
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunOneGameInfoReq extends BaiShunBaseReq {
|
||||
|
||||
/**
|
||||
* 渠道名称,由BAISHUN后台配置
|
||||
*/
|
||||
private String app_channel;
|
||||
|
||||
/**
|
||||
* 游戏ID,由BAISHUN游戏服定义
|
||||
*/
|
||||
private String game_id;
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 16:10
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunSSTokenResp {
|
||||
|
||||
/**
|
||||
* 指定 user_id 调⽤app 服务器接⼝的 ⻓期令牌。
|
||||
*/
|
||||
private String ss_token;
|
||||
|
||||
/**
|
||||
* ss_token 的过期时间,时间戳,毫秒
|
||||
*/
|
||||
private Long expire_date;
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.accompany.business.dto.miniGame.baishun;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 11:11
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class BaiShunUpdateSSTokenReq extends BaiShunBaseReq {
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
private String ss_token;
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
package com.accompany.business.enums.game;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 15:37
|
||||
* @description:
|
||||
*/
|
||||
public enum BaiShunMsgTypeEnum {
|
||||
|
||||
//机器⼈下注
|
||||
robot_bet,
|
||||
|
||||
//机器⼈结算
|
||||
robot_result,
|
||||
|
||||
//真⼈收分(已上线)
|
||||
user_cash_out,
|
||||
|
||||
//top5(已经上线)
|
||||
crash_top_5,
|
||||
|
||||
//机器⼈结算
|
||||
crash_robot_result,
|
||||
|
||||
//真⼈头奖(已经上线)
|
||||
top_jackpot,
|
||||
|
||||
//机器⼈头奖
|
||||
robot_top_jackpot,
|
||||
|
||||
//参与扣除
|
||||
bet,
|
||||
|
||||
//结算奖励
|
||||
result,
|
||||
|
||||
//⽪肤购买
|
||||
skin,
|
||||
|
||||
//赠送礼物
|
||||
gift,
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package com.accompany.business.enums.game;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 14:27
|
||||
* @description:
|
||||
*/
|
||||
public enum BaiShunUserTypeEnum {
|
||||
|
||||
NONE,
|
||||
|
||||
//普通用户
|
||||
NORMAL,
|
||||
|
||||
//白名单用户
|
||||
WHITE,
|
||||
|
||||
//黑名单用户
|
||||
BLACK;
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package com.accompany.business.enums.game;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 18:25
|
||||
* @description:
|
||||
*/
|
||||
public enum MiniGameTypeEnum {
|
||||
|
||||
SUD,
|
||||
|
||||
BAISHUN,
|
||||
;
|
||||
|
||||
}
|
@@ -17,8 +17,5 @@ public enum ResourceCodeEnum {
|
||||
FIND_LOVE,
|
||||
|
||||
//航海冒险
|
||||
NAUTICAL_ADVENTURE,
|
||||
|
||||
//游戏
|
||||
BAISHUN;
|
||||
NAUTICAL_ADVENTURE;
|
||||
}
|
||||
|
@@ -10,57 +10,57 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* 小游戏
|
||||
*
|
||||
* @author
|
||||
*
|
||||
* @author
|
||||
* @email xxx@gtland.cn
|
||||
* @date 2021-12-06 18:32:36
|
||||
*/
|
||||
@Data
|
||||
@TableName("mini_game")
|
||||
public class MiniGame implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 第三方游戏id
|
||||
*/
|
||||
@TableId(value = "mg_id")
|
||||
private Long mgId;
|
||||
/**
|
||||
* 游戏id字符串(避免js丢失精度问题)
|
||||
*/
|
||||
private String mgIdStr;
|
||||
/**
|
||||
* 游戏名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@ReplaceAppDomain
|
||||
private String pic;
|
||||
/**
|
||||
* 是否展示
|
||||
*/
|
||||
private Boolean isShow;
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer seq;
|
||||
/**
|
||||
* 游戏房麦位数量
|
||||
*/
|
||||
private Integer micNum;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 第三方游戏id
|
||||
*/
|
||||
@TableId(value = "mg_id")
|
||||
private Long mgId;
|
||||
/**
|
||||
* 游戏id字符串(避免js丢失精度问题)
|
||||
*/
|
||||
private String mgIdStr;
|
||||
/**
|
||||
* 游戏名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@ReplaceAppDomain
|
||||
private String pic;
|
||||
/**
|
||||
* 是否展示
|
||||
*/
|
||||
private Boolean isShow;
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer seq;
|
||||
/**
|
||||
* 游戏房麦位数量
|
||||
*/
|
||||
private Integer micNum;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
@@ -1,56 +0,0 @@
|
||||
package com.accompany.business.model.miniGame;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 16:18
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@TableName("mini_game_record")
|
||||
public class MiniGameRecord {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@ApiModelProperty("订单ID")
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 轮次ID
|
||||
*/
|
||||
@ApiModelProperty("轮次ID")
|
||||
private String roundId;
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
@ApiModelProperty("数据")
|
||||
private String resultJson;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@ApiModelProperty("开始时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@ApiModelProperty("结束时间")
|
||||
private Date updateTime;
|
||||
}
|
@@ -155,21 +155,6 @@ public class RoomVo implements Comparable<RoomVo> {
|
||||
*/
|
||||
private Integer mgMicNum;
|
||||
|
||||
/**
|
||||
* 游戏类型
|
||||
*/
|
||||
private String gameType;
|
||||
|
||||
/**
|
||||
* 游戏配置
|
||||
*/
|
||||
private String configJson;
|
||||
|
||||
/**
|
||||
* 游戏链接
|
||||
*/
|
||||
private String gameUrl;
|
||||
|
||||
/**
|
||||
* 是否需要重新选择小游戏,原有小游戏玩法不在最新配置里面时需要重新选择
|
||||
*/
|
||||
@@ -848,28 +833,4 @@ public class RoomVo implements Comparable<RoomVo> {
|
||||
public void setRedEnvelopeType(Integer redEnvelopeType) {
|
||||
this.redEnvelopeType = redEnvelopeType;
|
||||
}
|
||||
|
||||
public String getGameType() {
|
||||
return gameType;
|
||||
}
|
||||
|
||||
public void setGameType(String gameType) {
|
||||
this.gameType = gameType;
|
||||
}
|
||||
|
||||
public String getConfigJson() {
|
||||
return configJson;
|
||||
}
|
||||
|
||||
public void setConfigJson(String configJson) {
|
||||
this.configJson = configJson;
|
||||
}
|
||||
|
||||
public String getGameUrl() {
|
||||
return gameUrl;
|
||||
}
|
||||
|
||||
public void setGameUrl(String gameUrl) {
|
||||
this.gameUrl = gameUrl;
|
||||
}
|
||||
}
|
||||
|
@@ -1,36 +0,0 @@
|
||||
package com.accompany.business.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 11:36
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "baishun")
|
||||
public class BaiShunMiniGameConfig {
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 应用key
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 商⼾渠道(BAISHUN 提供,商⼾后台可查看)
|
||||
*/
|
||||
private String appChannel;
|
||||
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domain;
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
package com.accompany.business.mybatismapper.miniGame;
|
||||
|
||||
import com.accompany.business.model.miniGame.MiniGameRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 16:29
|
||||
* @description:
|
||||
*/
|
||||
public interface MiniGameRecordMapper extends BaseMapper<MiniGameRecord> {
|
||||
}
|
@@ -605,12 +605,16 @@ public class SendSysMsgService extends BaseService {
|
||||
}
|
||||
|
||||
public void sendFloatingMessageForRoom(FloatingMessageTemplate message) {
|
||||
Integer partitionId = message.getPartitionId();
|
||||
long count = this.roomQueryService.countValidRooms();
|
||||
long times = count % BATCH_SIZE == 0 ? (count / BATCH_SIZE) : (count / BATCH_SIZE) + 1;
|
||||
for (int i = 0; i < times; i++) {
|
||||
Integer index = i * BATCH_SIZE;
|
||||
List<Room> validRooms = this.roomQueryService.listValidRooms(index, BATCH_SIZE);
|
||||
for (Room room : validRooms) {
|
||||
if (partitionId != null && room.getPartitionId() != null && !partitionId.equals(room.getPartitionId())) {
|
||||
continue;
|
||||
}
|
||||
taskExecutor.execute(() -> {
|
||||
try {
|
||||
sendFloatingMessageForRoom(room.getRoomId(), room.getUid(), message);
|
||||
|
@@ -1,61 +0,0 @@
|
||||
package com.accompany.business.service.miniGame;
|
||||
|
||||
import com.accompany.business.dto.miniGame.baishun.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 18:29
|
||||
* @description:
|
||||
*/
|
||||
public interface MiniGameForBaiShunService {
|
||||
|
||||
/**
|
||||
* 校验
|
||||
* @param req
|
||||
*/
|
||||
void check(BaiShunBaseReq req);
|
||||
|
||||
/**
|
||||
* 获取SSToken
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
BaiShunSSTokenResp getSsToken(BaiShunGetSSTokenReq req);
|
||||
|
||||
/**
|
||||
* 查询app用户信息
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
BaiShunGetUserInfoResp getUserInfo(BaiShunGetUserInfoReq req);
|
||||
|
||||
/**
|
||||
* ss_token更新
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
BaiShunSSTokenResp updateSsToken(BaiShunUpdateSSTokenReq req);
|
||||
|
||||
/**
|
||||
* 货币修改
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
BaiShunChangeBalanceResp changeBalance(BaiShunChangeBalanceReq req);
|
||||
|
||||
/**
|
||||
* 获取游戏信息
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
BaiShunGameInfoResp oneGameInfo(BaiShunOneGameInfoReq req);
|
||||
|
||||
/**
|
||||
* 获取游戏信息列表
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
List<BaiShunGameInfoResp> gameList(BaiShunGameListReq req);
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
package com.accompany.business.service.miniGame;
|
||||
|
||||
import com.accompany.business.model.miniGame.MiniGameRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 16:30
|
||||
* @description:
|
||||
*/
|
||||
public interface MiniGameRecordService extends IService<MiniGameRecord> {
|
||||
}
|
@@ -1,267 +0,0 @@
|
||||
package com.accompany.business.service.miniGame.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.accompany.business.config.BaiShunMiniGameConfig;
|
||||
import com.accompany.business.dto.miniGame.baishun.*;
|
||||
import com.accompany.business.model.UserPurse;
|
||||
import com.accompany.business.model.miniGame.MiniGameRecord;
|
||||
import com.accompany.business.model.miniGame.MiniGameRound;
|
||||
import com.accompany.business.service.miniGame.MiniGameForBaiShunService;
|
||||
import com.accompany.business.service.miniGame.MiniGameRecordService;
|
||||
import com.accompany.business.service.miniGame.MiniGameRoundService;
|
||||
import com.accompany.business.service.purse.UserPurseService;
|
||||
import com.accompany.business.service.record.BillRecordService;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.enumeration.BillObjTypeEnum;
|
||||
import com.accompany.core.enumeration.CurrencyEnum;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.accompany.core.service.common.JedisService;
|
||||
import com.accompany.core.service.user.UsersBaseService;
|
||||
import com.accompany.core.util.MD5;
|
||||
import com.accompany.core.util.OkHttpUtils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 18:31
|
||||
* @description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MiniGameForBaiShunServiceImpl implements MiniGameForBaiShunService {
|
||||
|
||||
private static final String ONE_GAME_INFO = "/v1/api/one_game_info";
|
||||
|
||||
private static final String GAME_LIST = "/v1/api/gamelist";
|
||||
|
||||
@Autowired
|
||||
private BaiShunMiniGameConfig baiShunMiniGameConfig;
|
||||
|
||||
@Autowired
|
||||
private UsersBaseService usersBaseService;
|
||||
|
||||
@Autowired
|
||||
private UserPurseService userPurseService;
|
||||
|
||||
@Autowired
|
||||
private MiniGameRoundService miniGameRoundService;
|
||||
|
||||
@Autowired
|
||||
private MiniGameRecordService miniGameRecordService;
|
||||
|
||||
@Autowired
|
||||
private BillRecordService billRecordService;
|
||||
|
||||
@Autowired
|
||||
private JedisService jedisService;
|
||||
|
||||
public void check(BaiShunBaseReq req) {
|
||||
String appKey = baiShunMiniGameConfig.getAppKey();
|
||||
String signature = req.getSignature();
|
||||
String signatureNonce = req.getSignature_nonce();
|
||||
Long timestamp = req.getTimestamp();
|
||||
String encryptStr = MD5.getMD5(signatureNonce + appKey + timestamp);
|
||||
log.info("signature : {}, encryptStr : {}", signature, encryptStr);
|
||||
if (!(StrUtil.isNotEmpty(signature) && signature.equals(encryptStr))) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaiShunSSTokenResp getSsToken(BaiShunGetSSTokenReq req) {
|
||||
return getToken(req.getApp_id().toString(), req.getUser_id());
|
||||
}
|
||||
|
||||
private BaiShunSSTokenResp getToken(String appId, String uidStr) {
|
||||
if (StrUtil.isEmpty(uidStr)) {
|
||||
return new BaiShunSSTokenResp();
|
||||
}
|
||||
Long uid = Long.valueOf(uidStr);
|
||||
Users users = usersBaseService.getUsersByUid(uid);
|
||||
if (users == null) {
|
||||
return new BaiShunSSTokenResp();
|
||||
}
|
||||
String redisKey = RedisKey.baishun_ss_token.getKey(appId, uidStr);
|
||||
String ssToken = jedisService.get(redisKey);
|
||||
if (StrUtil.isEmpty(ssToken)) {
|
||||
ssToken = UUID.randomUUID().toString();
|
||||
jedisService.setex(redisKey, 7 * 60 * 60, ssToken);
|
||||
}
|
||||
Integer expireTime = jedisService.ttl(redisKey);
|
||||
BaiShunSSTokenResp token = new BaiShunSSTokenResp();
|
||||
token.setSs_token(ssToken);
|
||||
token.setExpire_date((long) expireTime);
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaiShunGetUserInfoResp getUserInfo(BaiShunGetUserInfoReq req) {
|
||||
BaiShunGetUserInfoResp userInfo = new BaiShunGetUserInfoResp();
|
||||
String uidStr = req.getUser_id();
|
||||
if (StrUtil.isEmpty(uidStr)) {
|
||||
return userInfo;
|
||||
}
|
||||
Long uid = Long.valueOf(uidStr);
|
||||
Users users = usersBaseService.getUsersByUid(uid);
|
||||
if (users == null) {
|
||||
return userInfo;
|
||||
}
|
||||
userInfo.setUser_id(uidStr);
|
||||
userInfo.setUser_name(users.getNick());
|
||||
userInfo.setUser_avatar(users.getAvatar());
|
||||
UserPurse userPurse = userPurseService.getById(uid);
|
||||
if (userPurse != null) {
|
||||
userInfo.setBalance(userPurse.getDiamonds());
|
||||
}
|
||||
CurrencyEnum currency = CurrencyEnum.DIAMOND;
|
||||
BaiShunBalanceInfo balanceInfo = new BaiShunBalanceInfo();
|
||||
balanceInfo.setName(currency.getDesc());
|
||||
balanceInfo.setCurrency_type((int) currency.getValue());
|
||||
balanceInfo.setCurrency_amount(userInfo.getBalance());
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaiShunSSTokenResp updateSsToken(BaiShunUpdateSSTokenReq req) {
|
||||
return getToken(req.getApp_id().toString(), req.getUser_id());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public BaiShunChangeBalanceResp changeBalance(BaiShunChangeBalanceReq req) {
|
||||
Date now = new Date();
|
||||
Long appId = req.getApp_id();
|
||||
String uidStr = req.getUser_id();
|
||||
String redisKey = RedisKey.baishun_ss_token.getKey(appId.toString(), uidStr);
|
||||
if (!jedisService.exits(redisKey)) {
|
||||
throw new ServiceException(BusiStatus.INVALID_REQUEST);
|
||||
}
|
||||
Long uid = Long.valueOf(uidStr);
|
||||
String roomUidStr = req.getRoom_id();
|
||||
Integer gameId = req.getGame_id();
|
||||
String gameRoundId = req.getGame_round_id();
|
||||
Long changeTimeAt = req.getChange_time_at();
|
||||
//处理未结束的轮次
|
||||
List<MiniGameRound> miniGameRounds = miniGameRoundService.list(Wrappers.<MiniGameRound>lambdaQuery().eq(MiniGameRound::getState, Constant.MiniGameRoundState.gaming).eq(MiniGameRound::getRoomUid, Long.valueOf(roomUidStr)).eq(MiniGameRound::getLeaderUid, uid).eq(MiniGameRound::getMgId, gameId.longValue()).ne(MiniGameRound::getRoundId, gameRoundId));
|
||||
if (CollectionUtil.isNotEmpty(miniGameRounds)) {
|
||||
for (MiniGameRound miniGameRound : miniGameRounds) {
|
||||
Integer battleStartAt = miniGameRound.getBattleStartAt();
|
||||
miniGameRound.setBattleEndAt(changeTimeAt.intValue());
|
||||
miniGameRound.setBattleDuration((int) (changeTimeAt - battleStartAt));
|
||||
miniGameRound.setState(Constant.MiniGameRoundState.game_end);
|
||||
miniGameRound.setUpdateTime(now);
|
||||
miniGameRoundService.updateById(miniGameRound);
|
||||
}
|
||||
}
|
||||
//新增轮次
|
||||
int count = miniGameRoundService.count(Wrappers.<MiniGameRound>lambdaQuery().eq(MiniGameRound::getRoomUid, Long.valueOf(roomUidStr)).eq(MiniGameRound::getLeaderUid, uid).eq(MiniGameRound::getMgId, gameId.longValue()).eq(MiniGameRound::getRoundId, gameRoundId));
|
||||
if (count == 0) {
|
||||
MiniGameRound miniGameRound = new MiniGameRound();
|
||||
miniGameRound.setRoomUid(Long.valueOf(roomUidStr));
|
||||
miniGameRound.setLeaderUid(uid);
|
||||
miniGameRound.setRoundId(gameRoundId);
|
||||
miniGameRound.setMgId(gameId.longValue());
|
||||
miniGameRound.setMode(gameId);
|
||||
miniGameRound.setState(Constant.MiniGameRoundState.gaming);
|
||||
miniGameRound.setBattleStartAt(changeTimeAt.intValue());
|
||||
miniGameRound.setCreateTime(now);
|
||||
miniGameRoundService.save(miniGameRound);
|
||||
}
|
||||
String orderId = req.getOrder_id();
|
||||
//保留记录
|
||||
MiniGameRecord record = new MiniGameRecord();
|
||||
record.setOrderId(orderId);
|
||||
record.setRoundId(gameRoundId);
|
||||
record.setResultJson(JSONObject.toJSONString(req));
|
||||
record.setCreateTime(now);
|
||||
record.setUpdateTime(now);
|
||||
miniGameRecordService.save(record);
|
||||
//金币变化
|
||||
Integer currencyDiff = req.getCurrency_diff();
|
||||
double diamondNum = Math.abs(currencyDiff);
|
||||
//钱包
|
||||
UserPurse userPurse = userPurseService.queryUserPurse(uid);
|
||||
if (currencyDiff > 0) {
|
||||
double currentDiamonds = userPurse.getDiamonds();
|
||||
//增加钱包
|
||||
if (!userPurseService.addDiamond(uid, diamondNum, BillObjTypeEnum.MINI_GAME_IN.getDesc())) {
|
||||
log.error("[小游戏增加] {} 当前钱包金币数 {} ,增加金币数 {} 不成功", uid, currentDiamonds, diamondNum);
|
||||
throw new ServiceException(BusiStatus.SERVERBUSY);
|
||||
}
|
||||
//添加账单记录
|
||||
billRecordService.insertGeneralBillRecord(uid, uid, record.getId().toString(), BillObjTypeEnum.MINI_GAME_IN, diamondNum);
|
||||
} else {
|
||||
double currentDiamonds = userPurse.getDiamonds();
|
||||
if (Double.compare(currentDiamonds, diamondNum) < 0) {
|
||||
throw new ServiceException(BusiStatus.DIAMONDNUMNOTENOUGH);
|
||||
}
|
||||
//扣减钱包
|
||||
if (!userPurseService.subDiamond(uid, diamondNum, BillObjTypeEnum.MINI_GAME_OUT.getDesc())) {
|
||||
userPurse = userPurseService.queryUserPurse(uid);
|
||||
currentDiamonds = userPurse.getDiamonds();
|
||||
if (Double.compare(currentDiamonds, diamondNum) < 0) {
|
||||
log.error("[小游戏扣减] {} 钱包金币数 {} 少于需要扣金币数 {}", uid, currentDiamonds, diamondNum);
|
||||
throw new ServiceException(BusiStatus.DIAMONDNUMNOTENOUGH);
|
||||
}
|
||||
log.error("[小游戏扣减] {} 当前钱包金币数 {} ,扣金币数 {} 不成功", uid, currentDiamonds, diamondNum);
|
||||
throw new ServiceException(BusiStatus.SERVERBUSY);
|
||||
}
|
||||
//添加账单记录
|
||||
billRecordService.insertGeneralBillRecord(uid, uid, record.getId().toString(), BillObjTypeEnum.MINI_GAME_OUT, diamondNum);
|
||||
}
|
||||
//查询当前金币
|
||||
userPurse = userPurseService.queryUserPurse(uid);
|
||||
BaiShunChangeBalanceResp changeBalance = new BaiShunChangeBalanceResp();
|
||||
changeBalance.setCurrency_balance(userPurse.getDiamonds());
|
||||
return changeBalance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaiShunGameInfoResp oneGameInfo(BaiShunOneGameInfoReq req) {
|
||||
String url = baiShunMiniGameConfig.getDomain() + ONE_GAME_INFO;
|
||||
String result = OkHttpUtils.postWithBody(url, req);
|
||||
log.info("url : {}, result : {}", url, result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
Integer code = jsonObject.getInteger("code");
|
||||
if (code != null) {
|
||||
throw new ServiceException(BusiStatus.SERVERBUSY);
|
||||
}
|
||||
String data = jsonObject.getString("data");
|
||||
if (StrUtil.isEmpty(data)) {
|
||||
return new BaiShunGameInfoResp();
|
||||
}
|
||||
return JSONObject.parseObject(data, BaiShunGameInfoResp.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaiShunGameInfoResp> gameList(BaiShunGameListReq req) {
|
||||
String url = baiShunMiniGameConfig.getDomain() + GAME_LIST;
|
||||
String result = OkHttpUtils.postWithBody(url, req);
|
||||
log.info("url : {}, result : {}", url, result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
Integer code = jsonObject.getInteger("code");
|
||||
if (code != null) {
|
||||
throw new ServiceException(BusiStatus.SERVERBUSY);
|
||||
}
|
||||
String data = jsonObject.getString("data");
|
||||
if (StrUtil.isEmpty(data)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return JSONArray.parseArray(data, BaiShunGameInfoResp.class);
|
||||
}
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package com.accompany.business.service.miniGame.impl;
|
||||
|
||||
import com.accompany.business.model.miniGame.MiniGameRecord;
|
||||
import com.accompany.business.mybatismapper.miniGame.MiniGameRecordMapper;
|
||||
import com.accompany.business.service.miniGame.MiniGameRecordService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/29 16:30
|
||||
* @description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MiniGameRecordServiceImpl extends ServiceImpl<MiniGameRecordMapper, MiniGameRecord> implements MiniGameRecordService {
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package com.accompany.business.service.miniGame.impl;
|
||||
|
||||
import com.accompany.business.config.BaiShunMiniGameConfig;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.accompany.business.model.miniGame.MiniGame;
|
||||
import com.accompany.business.mybatismapper.miniGame.MiniGameMapper;
|
||||
import com.accompany.business.service.miniGame.MiniGameService;
|
||||
@@ -8,13 +8,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小游戏
|
||||
*
|
||||
* @author
|
||||
* @author
|
||||
* @email xxx@gtland.cn
|
||||
* @date 2021-12-06 18:32:36
|
||||
*/
|
||||
@@ -24,9 +25,6 @@ public class MiniGameServiceImpl extends ServiceImpl<MiniGameMapper, MiniGame> i
|
||||
@Autowired
|
||||
private MiniGameMapper miniGameMapper;
|
||||
|
||||
@Autowired
|
||||
private BaiShunMiniGameConfig baiShunMiniGameConfig;
|
||||
|
||||
public MiniGame queryMiniGameByMgId(Long mgId) {
|
||||
QueryWrapper<MiniGame> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(MiniGame::getMgId, mgId);
|
||||
@@ -54,8 +52,7 @@ public class MiniGameServiceImpl extends ServiceImpl<MiniGameMapper, MiniGame> i
|
||||
public List<MiniGame> miniGameAllList() {
|
||||
QueryWrapper<MiniGame> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().orderByAsc(MiniGame::getSeq);
|
||||
List<MiniGame> miniGames = this.getBaseMapper().selectList(queryWrapper);
|
||||
return miniGames;
|
||||
return this.getBaseMapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -152,7 +152,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
if (ruleValue == null || StrUtil.isEmpty(ruleValue.toString())) {
|
||||
continue;
|
||||
}
|
||||
if (ruleValue.toString().contains(StrUtil.DOT) && !ruleValue.toString().startsWith(StrUtil.DELIM_START) && !ruleValue.toString().startsWith(StrUtil.DELIM_END)) {
|
||||
if (ruleValue.toString().contains(StrUtil.DOT)) {
|
||||
ruleValue = AppVersionUtil.getAppVersion(ruleValue.toString());
|
||||
}
|
||||
Optional<ResourceRule> any = rules.stream().filter(v -> v.getRuleCode().equals(key)).findAny();
|
||||
@@ -161,16 +161,9 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
String kind = rule.getRuleKind();
|
||||
String description = rule.getDescription();
|
||||
String fieldName = StrUtil.toCamelCase(key.toLowerCase());
|
||||
|
||||
Object targetValue = null;
|
||||
try {
|
||||
Field field = clazz.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
targetValue = field.get(context);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
continue;
|
||||
}
|
||||
Field field = clazz.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
Object targetValue = field.get(context);
|
||||
log.info("fieldName : {}, ruleValue : {}, targetValue : {}", fieldName, ruleValue, targetValue);
|
||||
if (targetValue == null) {
|
||||
continue;
|
||||
|
@@ -402,7 +402,7 @@ public class RoomService extends BaseService {
|
||||
*/
|
||||
public RoomVo queryRoomByUid(Long uid, Long intoUid, Long pubUid, DeviceInfo deviceInfo) throws Exception {
|
||||
Users me = usersService.getUsersByUid(uid);
|
||||
if (null == me) {
|
||||
if (null == me){
|
||||
throw new ServiceException(BusiStatus.USERNOTEXISTS);
|
||||
}
|
||||
|
||||
@@ -415,11 +415,9 @@ public class RoomService extends BaseService {
|
||||
return roomVo;
|
||||
}
|
||||
|
||||
if (!PartitionUtil.inPartition(me.getPartitionId(), room.getPartitionId())) {
|
||||
if (!PartitionUtil.inPartition(me.getPartitionId(), room.getPartitionId())){
|
||||
throw new ServiceException(BusiStatus.PARTITION_ERROR);
|
||||
}
|
||||
//个播版本检查
|
||||
singleBroadcastVersionCheck(room, appVersion);
|
||||
//房间没有关闭再次进房只调get接口,在此处再次写入room_running 缓存
|
||||
if (uid.equals(pubUid) && room.getValid()) {
|
||||
String json = jedisService.hget(RedisKey.room_running.getKey(), uid.toString());
|
||||
@@ -2832,11 +2830,9 @@ public class RoomService extends BaseService {
|
||||
MiniGame miniGame = miniGameService.queryMiniGameByMgId(miniGameSwitchRecord.getMgId());
|
||||
|
||||
roomVo.setMgId(miniGameSwitchRecord.getMgId());
|
||||
if (miniGame != null) {
|
||||
roomVo.setMgName(miniGame.getName());
|
||||
roomVo.setMgMicNum(miniGame.getMicNum());
|
||||
roomVo.setMgState(miniGameRoom.getState());
|
||||
}
|
||||
roomVo.setMgName(miniGame.getName());
|
||||
roomVo.setMgMicNum(miniGame.getMicNum());
|
||||
roomVo.setMgState(miniGameRoom.getState());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
<result column="push_status" property="pushStatus" jdbcType="TINYINT"/>
|
||||
<result column="ignore_version" property="ignoreVersion" jdbcType="VARCHAR"/>
|
||||
<result column="ignore_channel" property="ignoreChannel" jdbcType="VARCHAR"/>
|
||||
<result column="partition_id" property="partitionId" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@@ -85,7 +86,7 @@
|
||||
<sql id="Base_Column_List">
|
||||
record_id, from_accid, to_obj_type, msg_type, to_accids, to_erban_nos, title, web_url,
|
||||
pic_url, skip_type, skip_uri, msg_desc, admin_id, crate_time, app_id, push_time, push_status, ignore_version,
|
||||
ignore_channel
|
||||
ignore_channel, partition_id
|
||||
</sql>
|
||||
<select id="selectByExample" resultMap="BaseResultMap"
|
||||
parameterType="com.accompany.business.model.MsgPushRecordExample">
|
||||
@@ -125,13 +126,14 @@
|
||||
to_accids, to_erban_nos, title,
|
||||
web_url, pic_url, skip_type,
|
||||
skip_uri, msg_desc, admin_id,
|
||||
crate_time, app_id, push_time, push_status, ignore_version, ignore_channel)
|
||||
crate_time, app_id, push_time, push_status, ignore_version, ignore_channel, partition_id)
|
||||
values (#{fromAccid,jdbcType=BIGINT}, #{toObjType,jdbcType=TINYINT}, #{msgType,jdbcType=TINYINT},
|
||||
#{toAccids,jdbcType=VARCHAR}, #{toErbanNos,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
|
||||
#{webUrl,jdbcType=VARCHAR}, #{picUrl,jdbcType=VARCHAR}, #{skipType,jdbcType=TINYINT},
|
||||
#{skipUri,jdbcType=VARCHAR}, #{msgDesc,jdbcType=VARCHAR}, #{adminId,jdbcType=VARCHAR},
|
||||
#{crateTime,jdbcType=TIMESTAMP}, #{appId,jdbcType=VARCHAR}, #{pushTime,jdbcType=TIMESTAMP},
|
||||
#{pushStatus,jdbcType=TINYINT}, #{ignoreVersion,jdbcType=VARCHAR},#{ignoreChannel,jdbcType=VARCHAR})
|
||||
#{pushStatus,jdbcType=TINYINT}, #{ignoreVersion,jdbcType=VARCHAR},#{ignoreChannel,jdbcType=VARCHAR},
|
||||
#{partitionId,jdbcType=INTEGER})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.accompany.business.model.MsgPushRecord" keyColumn="record_id"
|
||||
keyProperty="recordId" useGeneratedKeys="true">
|
||||
@@ -191,6 +193,9 @@
|
||||
<if test="ignoreChannel != null">
|
||||
ignore_channel,
|
||||
</if>
|
||||
<if test="partitionId != null">
|
||||
partition_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="fromAccid != null">
|
||||
@@ -247,6 +252,9 @@
|
||||
<if test="ignoreChannel != null">
|
||||
#{ignoreChannel,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="partitionId != null">
|
||||
#{partitionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.accompany.business.model.MsgPushRecordExample"
|
||||
@@ -316,6 +324,9 @@
|
||||
<if test="record.ignoreChannel != null">
|
||||
ignore_channel = #{record.ignoreChannel,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.partitionId != null">
|
||||
partition_id = #{record.partitionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
@@ -341,7 +352,8 @@
|
||||
push_time = #{record.pushTime,jdbcType=TIMESTAMP},
|
||||
push_status = #{record.pushStatus,jdbcType=TINYINT},
|
||||
ignore_version = #{record.ignoreVersion,jdbcType=VARCHAR},
|
||||
ignore_channel = #{record.ignoreChannel,jdbcType=VARCHAR}
|
||||
ignore_channel = #{record.ignoreChannel,jdbcType=VARCHAR},
|
||||
partition_id = #{record.partitionId,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
@@ -403,6 +415,9 @@
|
||||
<if test="ignoreChannel != null">
|
||||
ignore_channel = #{ignoreChannel,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="partitionId != null">
|
||||
partition_id = #{partitionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where record_id = #{recordId,jdbcType=INTEGER}
|
||||
</update>
|
||||
@@ -425,7 +440,8 @@
|
||||
push_time = #{pushTime,jdbcType=TIMESTAMP},
|
||||
push_status = #{pushStatus,jdbcType=TINYINT},
|
||||
ignore_version = #{ignoreVersion,jdbcType=VARCHAR},
|
||||
ignore_channel = #{ignoreChannel,jdbcType=VARCHAR}
|
||||
ignore_channel = #{ignoreChannel,jdbcType=VARCHAR},
|
||||
partition_id = #{partitionId,jdbcType=INTEGER}
|
||||
where record_id = #{recordId,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
@@ -48,15 +48,14 @@ public class WebMVCConfig implements WebMvcConfigurer {
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(getSecurityInterceptor()).addPathPatterns("/**")
|
||||
.excludePathPatterns("/")
|
||||
.excludePathPatterns("/favicon.ico")
|
||||
.excludePathPatterns("/receive/**")
|
||||
.excludePathPatterns("/ios/pay/callback/**")
|
||||
.excludePathPatterns("/yidun/callback/**")
|
||||
.excludePathPatterns("/certification/callback/**")
|
||||
.excludePathPatterns("/payment/mycard/**")
|
||||
.excludePathPatterns("/payment/payermax/callback/**");
|
||||
// registry.addInterceptor(getSecurityInterceptor()).addPathPatterns("/**")
|
||||
// .excludePathPatterns("/")
|
||||
// .excludePathPatterns("/receive/**")
|
||||
// .excludePathPatterns("/ios/pay/callback/**")
|
||||
// .excludePathPatterns("/yidun/callback/**")
|
||||
// .excludePathPatterns("/certification/callback/**")
|
||||
// .excludePathPatterns("/payment/mycard/**")
|
||||
// .excludePathPatterns("/payment/payermax/callback/**");
|
||||
registry.addInterceptor(getLoginInterceptor()).addPathPatterns("/**");
|
||||
registry.addInterceptor(getAppVersionInterceptor());
|
||||
registry.addInterceptor(getModelHallAuthInterceptor());
|
||||
|
@@ -47,7 +47,7 @@ public class ExceptionController {
|
||||
if (status != null) {
|
||||
return new BusiResult<>(status, StringUtils.isNotBlank(exception.getMessage()) ? exception.getMessage() : status.getMessage(), null);
|
||||
} else {
|
||||
return new BusiResult<>(BusiStatus.SERVERERROR, exception.getMessage(), null);
|
||||
return new BusiResult<>(null, exception.getMessage());
|
||||
}
|
||||
} else if (exception instanceof AdminServiceException) {
|
||||
AdminServiceException apiException = (AdminServiceException) exception;
|
||||
|
@@ -124,7 +124,9 @@ public class HomeController extends BaseController {
|
||||
@GetMapping(value = "/tab/homeV2")
|
||||
public BusiResult<List<TopRoomTabHomeVo>> getRoomTabHomeListV2(@RequestParam(defaultValue = "1") Integer tabId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "30") Integer pageSize) throws Exception {
|
||||
@RequestParam(defaultValue = "50") Integer pageSize) throws Exception {
|
||||
//兼容iOS分页问题,固定50
|
||||
pageSize = 50;
|
||||
List<TopRoomTabHomeVo> list = homeService.getRoomTabHomeListV2(tabId, pageNum, pageSize, this.getUid(), getDeviceInfo(request));
|
||||
return new BusiResult<>(list);
|
||||
}
|
||||
|
@@ -1,107 +0,0 @@
|
||||
package com.accompany.business.controller.miniGame;
|
||||
|
||||
import com.accompany.business.dto.miniGame.baishun.*;
|
||||
import com.accompany.business.service.miniGame.MiniGameForBaiShunService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2024/4/28 10:53
|
||||
* @description:
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "BAISHUN小游戏接入", value = "BAISHUN小游戏接入")
|
||||
@RequestMapping(value = "/miniGame/baiShun")
|
||||
public class MiniGameForBaiShunController {
|
||||
|
||||
@Autowired
|
||||
private MiniGameForBaiShunService miniGameForBaiShunService;
|
||||
|
||||
/**
|
||||
* 获取SSToken
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取SSToken")
|
||||
@PostMapping("getSsToken")
|
||||
public BaiShunBaseResp<BaiShunSSTokenResp> getSsToken(@RequestBody BaiShunGetSSTokenReq req) {
|
||||
log.info("getSsToken req : {}", JSONObject.toJSONString(req));
|
||||
miniGameForBaiShunService.check(req);
|
||||
return new BaiShunBaseResp<>(miniGameForBaiShunService.getSsToken(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询app用户信息
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询app用户信息")
|
||||
@PostMapping("getUserInfo")
|
||||
public BaiShunBaseResp<BaiShunGetUserInfoResp> getUserInfo(@RequestBody BaiShunGetUserInfoReq req) {
|
||||
log.info("getUserInfo req : {}", JSONObject.toJSONString(req));
|
||||
miniGameForBaiShunService.check(req);
|
||||
return new BaiShunBaseResp<>(miniGameForBaiShunService.getUserInfo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* ss_token更新
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("ss_token更新")
|
||||
@PostMapping("updateSsToken")
|
||||
public BaiShunBaseResp<BaiShunSSTokenResp> updateSsToken(@RequestBody BaiShunUpdateSSTokenReq req) {
|
||||
log.info("updateSsToken req : {}", JSONObject.toJSONString(req));
|
||||
miniGameForBaiShunService.check(req);
|
||||
return new BaiShunBaseResp<>(miniGameForBaiShunService.updateSsToken(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改货币
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("修改货币")
|
||||
@PostMapping("changeBalance")
|
||||
public BaiShunBaseResp<BaiShunChangeBalanceResp> changeBalance(@RequestBody BaiShunChangeBalanceReq req) {
|
||||
log.info("changeBalance req : {}", JSONObject.toJSONString(req));
|
||||
miniGameForBaiShunService.check(req);
|
||||
return new BaiShunBaseResp<>(miniGameForBaiShunService.changeBalance(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个游戏信息
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取单个游戏信息")
|
||||
@PostMapping("oneGameInfo")
|
||||
public BaiShunBaseResp<BaiShunGameInfoResp> oneGameInfo(@RequestBody BaiShunOneGameInfoReq req) {
|
||||
log.info("oneGameInfo req : {}", JSONObject.toJSONString(req));
|
||||
return new BaiShunBaseResp<>(miniGameForBaiShunService.oneGameInfo(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏信息列表
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取游戏信息列表")
|
||||
@PostMapping("gameList")
|
||||
public BaiShunBaseResp<List<BaiShunGameInfoResp>> gameList(@RequestBody BaiShunGameListReq req) {
|
||||
log.info("gameList req : {}", JSONObject.toJSONString(req));
|
||||
return new BaiShunBaseResp<>(miniGameForBaiShunService.gameList(req));
|
||||
}
|
||||
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
package com.accompany.business.interceptor;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.accompany.common.constant.ApplicationConstant;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.core.service.common.JedisService;
|
||||
@@ -17,7 +16,10 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
@@ -13,8 +13,17 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
application:
|
||||
@@ -32,8 +41,19 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
application:
|
||||
@@ -51,5 +71,16 @@ spring:
|
||||
namespace: 0c9bf047-19ca-4969-bf5d-bbc1f86b501a
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
@@ -34,7 +34,6 @@
|
||||
<junit.version>4.12</junit.version>
|
||||
<apache.commons.version>3.12.0</apache.commons.version>
|
||||
<qiniu.version>7.14.0</qiniu.version>
|
||||
<nacos.config.version>0.2.2.RELEASE</nacos.config.version>
|
||||
<okhttp.version>4.12.0</okhttp.version>
|
||||
<swagger3.version>3.0.0</swagger3.version>
|
||||
<aliyun-log-log4j2-appender.version>0.1.10</aliyun-log-log4j2-appender.version>
|
||||
@@ -99,22 +98,6 @@
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
@@ -129,12 +112,6 @@
|
||||
<version>${spring-cloud-starter-bootstrap.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
<version>${nacos.config.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||
|
@@ -13,8 +13,17 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
application:
|
||||
@@ -32,8 +41,19 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
application:
|
||||
@@ -51,5 +71,16 @@ spring:
|
||||
namespace: 0c9bf047-19ca-4969-bf5d-bbc1f86b501a
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
||||
|
@@ -13,8 +13,17 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
@@ -30,8 +39,19 @@ spring:
|
||||
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
@@ -47,5 +67,16 @@ spring:
|
||||
namespace: 0c9bf047-19ca-4969-bf5d-bbc1f86b501a
|
||||
name: ${spring.application.name}
|
||||
file-extension: yml
|
||||
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml,threadpool.yml
|
||||
shared-configs:
|
||||
- data-id: application.yml
|
||||
refresh: true
|
||||
- data-id: thirdpart.yml
|
||||
refresh: true
|
||||
- data-id: pay.yml
|
||||
refresh: true
|
||||
- data-id: sysconf.yml
|
||||
refresh: true
|
||||
- data-id: threadpool.yml
|
||||
refresh: true
|
||||
- data-id: database.yml
|
||||
refresh: true
|
Reference in New Issue
Block a user