Commit c88ea733 by 吕明尚

修改抖音验券

parent 3bf6045f
......@@ -379,15 +379,15 @@ public class TiktokServiceImpl implements TiktokService {
JSONObject sku = entries.getJSONObject("sku");
JSONObject amount = entries.getJSONObject("amount");
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
//查询领取记录表
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SConsumerCoupon::getCouponCode, entries.getStr("encrypted_code"));
queryWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
queryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
SConsumerCoupon unUsedCoupon = isConsumerCouponService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(unUsedCoupon)) {
throw new RuntimeException("该券已被领取");
}
// //查询领取记录表
// LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(SConsumerCoupon::getCouponCode, entries.getStr("encrypted_code"));
// queryWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
// queryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
// SConsumerCoupon unUsedCoupon = isConsumerCouponService.getOne(queryWrapper);
// if (ObjectUtils.isNotEmpty(unUsedCoupon)) {
// throw new RuntimeException("该券已被领取");
// }
TiktokCouponDto couponDto = new TiktokCouponDto();
couponDto.setVerifyToken(prepare.getStr("verify_token"));
couponDto.setPoiId(sStore.getTiktokPoiId());
......@@ -400,8 +400,8 @@ public class TiktokServiceImpl implements TiktokService {
couponDto.setEncryptedCodes(codes);
JSONObject verify = verify(couponDto);
JSONArray verifyResults = verify.getJSONArray("verify_results");
Object o1 = verifyResults.get(0);
JSONObject verifyResult = new JSONObject(o1);
verifyResults.forEach(item -> {
JSONObject verifyResult = new JSONObject(item);
String originCode = verifyResult.getStr("origin_code");
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(user.getId());
......@@ -467,6 +467,7 @@ public class TiktokServiceImpl implements TiktokService {
sConsumerCoupon.setSalePrice(sCoupon.getSalePrice());
}
isConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon);
});
} catch (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