parent
085e852f19
commit
50e410eb54
|
@ -0,0 +1,20 @@
|
||||||
|
package com.mcwl.web.controller.resource;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品购买记录
|
||||||
|
* @author DaiZibo
|
||||||
|
* @date 2025/3/28
|
||||||
|
* @apiNote
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Api(tags = "商品购买记录")
|
||||||
|
@RequestMapping("/modelRechargeRecord")
|
||||||
|
@RestController
|
||||||
|
public class ModelRechargeRecordController {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -12,7 +12,9 @@ public enum ResultCode {
|
||||||
|
|
||||||
SUCCESS(200),//成功
|
SUCCESS(200),//成功
|
||||||
|
|
||||||
FAIL(400),//失败
|
FAIL(400),//
|
||||||
|
|
||||||
|
FAIL_MSG(12202),//失败
|
||||||
|
|
||||||
FAIL_SIGN_IN(401),//登录失败
|
FAIL_SIGN_IN(401),//登录失败
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package com.mcwl.framework.web.service;
|
package com.mcwl.framework.web.service;
|
||||||
|
|
||||||
import com.mcwl.common.constant.CacheConstants;
|
import com.mcwl.common.constant.*;
|
||||||
import com.mcwl.common.constant.Constants;
|
|
||||||
import com.mcwl.common.constant.RedisConstants;
|
|
||||||
import com.mcwl.common.constant.UserConstants;
|
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
import com.mcwl.common.core.domain.model.LoginUser;
|
import com.mcwl.common.core.domain.model.LoginUser;
|
||||||
import com.mcwl.common.core.redis.RedisCache;
|
import com.mcwl.common.core.redis.RedisCache;
|
||||||
|
@ -240,13 +237,13 @@ public class SysLoginService
|
||||||
System.out.println("验证码:"+cacheObject);
|
System.out.println("验证码:"+cacheObject);
|
||||||
if (cacheObject == null) {
|
if (cacheObject == null) {
|
||||||
// 处理未找到验证码的情况
|
// 处理未找到验证码的情况
|
||||||
throw new ErrorCodeException(ResultCode.FAIL,"验证码已过期或未发送");
|
throw new ErrorCodeException(ResultCode.FAIL_MSG,"验证码已过期或未发送");
|
||||||
}
|
}
|
||||||
|
|
||||||
String c = (String) cacheObject;
|
String c = (String) cacheObject;
|
||||||
if (!c.equals(code)){
|
if (!c.equals(code)){
|
||||||
//验证码错误
|
//验证码错误
|
||||||
throw new ErrorCodeException(ResultCode.FAIL,"验证码错误");
|
throw new ErrorCodeException(ResultCode.FAIL_MSG,"验证码错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.mcwl.resource.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品 购买记录表
|
||||||
|
*
|
||||||
|
* @author DaiZibo
|
||||||
|
* @date 2025/3/28
|
||||||
|
* @apiNote
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class ModelRechargeRecord {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
private Integer productType;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.mcwl.resource.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.mcwl.resource.domain.ModelRechargeRecord;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DaiZibo
|
||||||
|
* @date 2025/3/28
|
||||||
|
* @apiNote
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ModelRechargeRecordMapper extends BaseMapper<ModelRechargeRecord> {
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.mcwl.resource.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DaiZibo
|
||||||
|
* @date 2025/3/28
|
||||||
|
* @apiNote
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface ModelRechargeRecordService {
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
|
import com.mcwl.resource.mapper.ModelRechargeRecordMapper;
|
||||||
|
import com.mcwl.resource.service.ModelRechargeRecordService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品购买记录
|
||||||
|
*
|
||||||
|
* @author DaiZibo
|
||||||
|
* @date 2025/3/28
|
||||||
|
* @apiNote
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ModelRechargeRecordServiceImpl implements ModelRechargeRecordService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ModelRechargeRecordMapper rechargeRecordMapper;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import com.mcwl.common.core.domain.R;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
import com.mcwl.common.utils.StringUtils;
|
||||||
import com.mcwl.resource.domain.Collect;
|
import com.mcwl.resource.domain.Collect;
|
||||||
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
import com.mcwl.resource.domain.ModelVersion;
|
import com.mcwl.resource.domain.ModelVersion;
|
||||||
import com.mcwl.resource.mapper.ModelMapper;
|
import com.mcwl.resource.mapper.ModelMapper;
|
||||||
import com.mcwl.resource.mapper.ModelVersionMapper;
|
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||||
|
@ -40,6 +41,8 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
|
||||||
private ModelMapper modelMapper;
|
private ModelMapper modelMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelVersionMapper modelVersionMapper;
|
private ModelVersionMapper modelVersionMapper;
|
||||||
|
|
||||||
|
@ -138,6 +141,13 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"此文件不可下载");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG,"此文件不可下载");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//校验是否购收费/购买
|
||||||
|
ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId());
|
||||||
|
if (modelProduct.getIsFree() == 0){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (modelVersion.getIsEncrypt() == 1){
|
if (modelVersion.getIsEncrypt() == 1){
|
||||||
if (StringUtils.isEmpty(modelVersion.getEncryptionFilePath())){
|
if (StringUtils.isEmpty(modelVersion.getEncryptionFilePath())){
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue