|
@@ -2159,19 +2159,34 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 购买Midjourney课程 赠送Midjourney车票
|
|
|
|
|
|
|
+ * 购买Midjourney课程 赠送车票
|
|
|
*/
|
|
*/
|
|
|
private void sendMidjourneyTicketIfCourse(Long userId) {
|
|
private void sendMidjourneyTicketIfCourse(Long userId) {
|
|
|
- Optional.ofNullable(goodsDonSkuMapper.selectById(185))
|
|
|
|
|
- .ifPresent(sku -> {
|
|
|
|
|
- GroupsRelation relation = exchangeCodeService.getRelationNoOrder(sku, userId);
|
|
|
|
|
- if (relation.getExpiryTime() == null || relation.getStartTime() == null) {
|
|
|
|
|
- DateTime now = DateTime.now();
|
|
|
|
|
- relation.setStartTime(now);
|
|
|
|
|
- relation.setExpiryTime(DateUtil.offsetMonth(now, sku.getMonths() * 1));
|
|
|
|
|
- groupsRelationMapper.updateById(relation);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
|
|
+ .eq(SysConfig::getSysKey, Constant.MIDJOURNEY_TICKET_SKU_IDS).last("limit 1"));
|
|
|
|
|
+ if (config != null) {
|
|
|
|
|
+ String sysValue = config.getSysValue();
|
|
|
|
|
+ if (StrUtil.isNotBlank(sysValue)) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ //Midjourney车票、ChatGPT独立规格车票
|
|
|
|
|
+ List<Long> skuIds = Jsons.parseList(sysValue, Long.class);
|
|
|
|
|
+ skuIds.forEach(skuId->{
|
|
|
|
|
+ GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
|
|
|
|
|
+ if (sku != null && sku.getStatus()) {
|
|
|
|
|
+ GroupsRelation relation = exchangeCodeService.getRelationNoOrder(sku, userId);
|
|
|
|
|
+ if (relation.getExpiryTime() == null || relation.getStartTime() == null) {
|
|
|
|
|
+ DateTime now = DateTime.now();
|
|
|
|
|
+ relation.setStartTime(now);
|
|
|
|
|
+ relation.setExpiryTime(DateUtil.offsetMonth(now, sku.getMonths() * 1));
|
|
|
|
|
+ groupsRelationMapper.updateById(relation);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("购买midJourney课程赠送车票错误,errMsg:{}", StringUtil.getErrorText(e));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|