开通aiVip
This commit is contained in:
@@ -22,7 +22,7 @@ public class AiVipLog implements Serializable {
|
||||
private Integer type;
|
||||
|
||||
//可用助手,0全部(预留)
|
||||
private String available_assistant;
|
||||
private String availableAssistant;
|
||||
|
||||
//次数
|
||||
private int count;
|
||||
|
||||
@@ -169,7 +169,7 @@ public class BuyOrder implements Serializable {
|
||||
|
||||
private Integer vipBuyConfigId;
|
||||
|
||||
private Integer abroadBookId;//海外读书购买书籍id
|
||||
private Integer aiBuyConfigId;//ai会员配置表
|
||||
|
||||
private Integer trainingClassId;//培训班id
|
||||
|
||||
|
||||
@@ -4,4 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.AiVipLog;
|
||||
|
||||
public interface AiVipLogService extends IService<AiVipLog> {
|
||||
|
||||
void openAiVip(int aiBuyConfigId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,45 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.modules.common.dao.AiBuyConfigDao;
|
||||
import com.peanut.modules.common.dao.AiVipLogDao;
|
||||
import com.peanut.modules.common.entity.AiBuyConfig;
|
||||
import com.peanut.modules.common.entity.AiVipLog;
|
||||
import com.peanut.modules.common.service.AiVipLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@Service("commonAiVipLogService")
|
||||
public class AiVipLogServiceImpl extends ServiceImpl<AiVipLogDao, AiVipLog> implements AiVipLogService {
|
||||
|
||||
@Autowired
|
||||
private AiBuyConfigDao aiBuyConfigDao;
|
||||
|
||||
@Override
|
||||
public void openAiVip(int aiBuyConfigId) {
|
||||
AiBuyConfig config = aiBuyConfigDao.selectById(aiBuyConfigId);
|
||||
if (config != null) {
|
||||
AiVipLog aiVipLog = new AiVipLog();
|
||||
aiVipLog.setUserId(ShiroUtils.getUId());
|
||||
//1月度2季度
|
||||
aiVipLog.setType(config.getType());
|
||||
aiVipLog.setCount(config.getCount());
|
||||
aiVipLog.setSurplusCount(config.getCount());
|
||||
Date date = new Date();
|
||||
aiVipLog.setStartTime(date);
|
||||
if (config.getType()==1){
|
||||
aiVipLog.setEndTime(DateUtils.addDateMonths(date,1));
|
||||
}else {
|
||||
aiVipLog.setEndTime(DateUtils.addDateMonths(date,3));
|
||||
}
|
||||
this.save(aiVipLog);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user