|
|
@ -1,6 +1,7 @@ |
|
|
package com.example.demo.controller.coin; |
|
|
package com.example.demo.controller.coin; |
|
|
|
|
|
|
|
|
import com.example.demo.config.interfac.Log; |
|
|
import com.example.demo.config.interfac.Log; |
|
|
|
|
|
import com.example.demo.domain.vo.coin.AreaInfo; |
|
|
import com.example.demo.domain.vo.coin.Page; |
|
|
import com.example.demo.domain.vo.coin.Page; |
|
|
import com.example.demo.domain.vo.coin.RechargeActivity; |
|
|
import com.example.demo.domain.vo.coin.RechargeActivity; |
|
|
import com.example.demo.domain.vo.coin.Result; |
|
|
import com.example.demo.domain.vo.coin.Result; |
|
|
@ -264,6 +265,53 @@ public class RechargeActivityCenterController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
* 根据活动 ID 查询归属地 |
|
|
|
|
|
* |
|
|
|
|
|
* @param activity 充值活动请求参数(包含活动 ID) |
|
|
|
|
|
* @return 查询结果(成功返回归属地信息,失败返回错误信息) |
|
|
|
|
|
* @throws NullPointerException 当活动 ID 为空时抛出 |
|
|
|
|
|
* @throws IllegalArgumentException 当活动 ID 无效时抛出 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Log("查询活动归属地") |
|
|
|
|
|
@PostMapping("/queryActivityArea") |
|
|
|
|
|
public Result queryActivityArea(@RequestBody RechargeActivity activity, @RequestHeader(defaultValue = "zh_CN") String lang) { |
|
|
|
|
|
try { |
|
|
|
|
|
// 解析语言代码 |
|
|
|
|
|
String languageCode = parseLanguageCode(lang); |
|
|
|
|
|
|
|
|
|
|
|
if (activity.getId() == null) { |
|
|
|
|
|
String errorMsg = languageTranslationUtil.translate("查询失败:活动 ID 不能为空", lang); |
|
|
|
|
|
return Result.error(errorMsg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AreaInfo result = rechargeActivityCenterService.queryActivityAreaById(activity.getId()); |
|
|
|
|
|
|
|
|
|
|
|
// 如果 area 为 "0",直接返回 |
|
|
|
|
|
if ("0".equals(result.getArea())) { |
|
|
|
|
|
return Result.success(result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 对返回结果进行多语言转换 |
|
|
|
|
|
if (result.getArea() != null && !result.getArea().isEmpty()) { |
|
|
|
|
|
result.setArea(languageTranslationUtil.translate(result.getArea(), lang)); |
|
|
|
|
|
} |
|
|
|
|
|
if (result.getAreaName() != null && !result.getAreaName().isEmpty()) { |
|
|
|
|
|
result.setAreaName(languageTranslationUtil.translate(result.getAreaName(), lang)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Result.success(result); |
|
|
|
|
|
} catch (NullPointerException e) { |
|
|
|
|
|
log.error("查询活动归属地失败:空指针异常", e); |
|
|
|
|
|
String errorMsg = languageTranslationUtil.translate("查询失败:数据为空", lang); |
|
|
|
|
|
return Result.error(errorMsg); |
|
|
|
|
|
} catch (IllegalArgumentException e) { |
|
|
|
|
|
log.error("查询活动归属地失败:参数异常", e); |
|
|
|
|
|
String errorMsg = languageTranslationUtil.translate("查询失败:" + e.getMessage(), lang); |
|
|
|
|
|
return Result.error(errorMsg); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
* 转换充值活动的多语言字段 |
|
|
* 转换充值活动的多语言字段 |
|
|
*/ |
|
|
*/ |
|
|
private void translateRechargeActivities(com.github.pagehelper.PageInfo<RechargeActivity> pageInfo, String lang) { |
|
|
private void translateRechargeActivities(com.github.pagehelper.PageInfo<RechargeActivity> pageInfo, String lang) { |
|
|
|