json 解析异常捕获

This commit is contained in:
GYJ 2025-03-11 16:32:04 +08:00
parent 52cb628bf2
commit 6893425ac4
1 changed files with 7 additions and 2 deletions

View File

@ -162,8 +162,13 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
* 获取优惠券详细信息 目前仅返回 id 名称 剩余数量 赠送数量
*/
private List<ShopCoupon> getCoupons(String couponJson) {
Map<String, Integer> couponMap = JSONObject.parseObject(couponJson, new TypeReference<>() {
});
Map<String, Integer> couponMap;
try {
couponMap = JSONObject.parseObject(couponJson, new TypeReference<>() {});
} catch (Exception e) {
return new ArrayList<>();
}
if (couponMap.isEmpty()) {
return new ArrayList<>();
}