Commit c88ea733 by 吕明尚

修改抖音验券

parent 3bf6045f
...@@ -379,15 +379,15 @@ public class TiktokServiceImpl implements TiktokService { ...@@ -379,15 +379,15 @@ public class TiktokServiceImpl implements TiktokService {
JSONObject sku = entries.getJSONObject("sku"); JSONObject sku = entries.getJSONObject("sku");
JSONObject amount = entries.getJSONObject("amount"); JSONObject amount = entries.getJSONObject("amount");
SConsumer user = FrontTokenComponent.getWxSConsumerEntry(); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
//查询领取记录表 // //查询领取记录表
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SConsumerCoupon::getCouponCode, entries.getStr("encrypted_code")); // queryWrapper.eq(SConsumerCoupon::getCouponCode, entries.getStr("encrypted_code"));
queryWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode()); // queryWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
queryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex()); // queryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
SConsumerCoupon unUsedCoupon = isConsumerCouponService.getOne(queryWrapper); // SConsumerCoupon unUsedCoupon = isConsumerCouponService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(unUsedCoupon)) { // if (ObjectUtils.isNotEmpty(unUsedCoupon)) {
throw new RuntimeException("该券已被领取"); // throw new RuntimeException("该券已被领取");
} // }
TiktokCouponDto couponDto = new TiktokCouponDto(); TiktokCouponDto couponDto = new TiktokCouponDto();
couponDto.setVerifyToken(prepare.getStr("verify_token")); couponDto.setVerifyToken(prepare.getStr("verify_token"));
couponDto.setPoiId(sStore.getTiktokPoiId()); couponDto.setPoiId(sStore.getTiktokPoiId());
...@@ -400,8 +400,8 @@ public class TiktokServiceImpl implements TiktokService { ...@@ -400,8 +400,8 @@ public class TiktokServiceImpl implements TiktokService {
couponDto.setEncryptedCodes(codes); couponDto.setEncryptedCodes(codes);
JSONObject verify = verify(couponDto); JSONObject verify = verify(couponDto);
JSONArray verifyResults = verify.getJSONArray("verify_results"); JSONArray verifyResults = verify.getJSONArray("verify_results");
Object o1 = verifyResults.get(0); verifyResults.forEach(item -> {
JSONObject verifyResult = new JSONObject(o1); JSONObject verifyResult = new JSONObject(item);
String originCode = verifyResult.getStr("origin_code"); String originCode = verifyResult.getStr("origin_code");
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon(); SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(user.getId()); sConsumerCoupon.setConsumerId(user.getId());
...@@ -467,6 +467,7 @@ public class TiktokServiceImpl implements TiktokService { ...@@ -467,6 +467,7 @@ public class TiktokServiceImpl implements TiktokService {
sConsumerCoupon.setSalePrice(sCoupon.getSalePrice()); sConsumerCoupon.setSalePrice(sCoupon.getSalePrice());
} }
isConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon); isConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon);
});
} catch (RuntimeException e) { } catch (RuntimeException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment