zoujiajian 3 anni fa
parent
commit
c3bbcb1dbc

+ 6 - 5
netflix-service/src/main/java/com/cyksj/service/exchange/impl/ExchangeCodeServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.cyksj.common.I18nMessageUtil;
 import com.cyksj.common.annotation.NoSubmit;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.snowflake.Sequence;
@@ -117,14 +118,14 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
 	@NoSubmit
 	public Result<String> getTicketByExchangeCode(ExchangeCodeTicket exchangeCodeTicket, Long userId) {
 		if (StrUtil.isEmpty(exchangeCodeTicket.getCode())) {
-			throw BusinessRuntimeException.getInstance("兑换码有误,请使用正确的兑换码");
+			throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("ex_code_error"));
 		}
 		ExchangeCode exchangeCode = this.getOne(Wrappers.lambdaQuery(ExchangeCode.class).eq(ExchangeCode::getCode, exchangeCodeTicket.getCode()).last("limit 1"));
 		if (exchangeCode == null) {
-			throw BusinessRuntimeException.getInstance("兑换码有误,请使用正确的兑换码");
+			throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("ex_code_error"));
 		}
 		if (exchangeCode.getUseStatus()) {
-			throw BusinessRuntimeException.getInstance("该兑换码已使用");
+			throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("ex_code_used"));
 		}
 		//兑换成功
 		exchangeCode.setUseStatus(true);
@@ -132,12 +133,12 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
 		exchangeCode.setUseTime(DateTime.now());
 		int update = exchangeCodeMapper.update(exchangeCode, Wrappers.lambdaQuery(ExchangeCode.class).eq(ExchangeCode::getId, exchangeCode.getId()).eq(ExchangeCode::getUseStatus, false));
 		if (update != 1) {
-			throw BusinessRuntimeException.getInstance("该兑换码已使用");
+			throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("ex_code_used"));
 		}
 		//生成车票订单
 		getGroupTripsTicket(goodsDonSkuMapper.selectById(exchangeCode.getSkuId()), userId);
 		log.info("用户:{}通过兑换码:{}兑换成功", userId, exchangeCodeTicket.getCode());
-		return GatewayResponse.SUCCESS.newBuilder().toResult("兑换成功");
+		return GatewayResponse.SUCCESS.newBuilder().toResult(I18nMessageUtil.getI18nMsg("ex_code_success"));
 	}
 
 	/**

+ 3 - 0
netflix-web/src/main/resources/i18n/yhlx.properties

@@ -1,2 +1,5 @@
 default_msg=国际化信息返回异常
+ex_code_error=兑换码错误
+ex_code_success=兑换成功
+ex_code_used=该兑换码已使用
 login=登录

+ 3 - 0
netflix-web/src/main/resources/i18n/yhlx_en_US.properties

@@ -1,2 +1,5 @@
 default_msg=Internationalization information returned exception
+ex_code_error=redemption code is wrong
+ex_code_success=Successful exchange
+ex_code_used=this redemption code has already been used
 login=login

+ 3 - 0
netflix-web/src/main/resources/i18n/yhlx_zh_CN.properties

@@ -1,2 +1,5 @@
 default_msg=国际化信息返回异常
+ex_code_error=兑换码错误
+ex_code_success=兑换成功
+ex_code_used=该兑换码已使用
 login=登录