diff --git a/blob b/blob new file mode 100644 index 0000000..5369411 Binary files /dev/null and b/blob differ diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelRechargeRecordController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelRechargeRecordController.java new file mode 100644 index 0000000..2cf5911 --- /dev/null +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelRechargeRecordController.java @@ -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 { + + +} diff --git a/mcwl-common/src/main/java/com/mcwl/common/enums/ResultCode.java b/mcwl-common/src/main/java/com/mcwl/common/enums/ResultCode.java index 9bd8a71..9304cd6 100644 --- a/mcwl-common/src/main/java/com/mcwl/common/enums/ResultCode.java +++ b/mcwl-common/src/main/java/com/mcwl/common/enums/ResultCode.java @@ -12,7 +12,9 @@ public enum ResultCode { SUCCESS(200),//成功 - FAIL(400),//失败 + FAIL(400),// + + FAIL_MSG(12202),//失败 FAIL_SIGN_IN(401),//登录失败 diff --git a/mcwl-framework/src/main/java/com/mcwl/framework/web/service/SysLoginService.java b/mcwl-framework/src/main/java/com/mcwl/framework/web/service/SysLoginService.java index 2f5923c..57b07ab 100644 --- a/mcwl-framework/src/main/java/com/mcwl/framework/web/service/SysLoginService.java +++ b/mcwl-framework/src/main/java/com/mcwl/framework/web/service/SysLoginService.java @@ -1,9 +1,6 @@ package com.mcwl.framework.web.service; -import com.mcwl.common.constant.CacheConstants; -import com.mcwl.common.constant.Constants; -import com.mcwl.common.constant.RedisConstants; -import com.mcwl.common.constant.UserConstants; +import com.mcwl.common.constant.*; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.domain.model.LoginUser; import com.mcwl.common.core.redis.RedisCache; @@ -240,13 +237,13 @@ public class SysLoginService System.out.println("验证码:"+cacheObject); if (cacheObject == null) { // 处理未找到验证码的情况 - throw new ErrorCodeException(ResultCode.FAIL,"验证码已过期或未发送"); + throw new ErrorCodeException(ResultCode.FAIL_MSG,"验证码已过期或未发送"); } String c = (String) cacheObject; if (!c.equals(code)){ //验证码错误 - throw new ErrorCodeException(ResultCode.FAIL,"验证码错误"); + throw new ErrorCodeException(ResultCode.FAIL_MSG,"验证码错误"); } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelRechargeRecord.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelRechargeRecord.java new file mode 100644 index 0000000..00b9fb0 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelRechargeRecord.java @@ -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; + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelRechargeRecordMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelRechargeRecordMapper.java new file mode 100644 index 0000000..bfa7f3f --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelRechargeRecordMapper.java @@ -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 { +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelRechargeRecordService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelRechargeRecordService.java new file mode 100644 index 0000000..95f27be --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelRechargeRecordService.java @@ -0,0 +1,10 @@ +package com.mcwl.resource.service; + +/** + * @author DaiZibo + * @date 2025/3/28 + * @apiNote + */ + +public interface ModelRechargeRecordService { +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelRechargeRecordServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelRechargeRecordServiceImpl.java new file mode 100644 index 0000000..c0c4110 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelRechargeRecordServiceImpl.java @@ -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; + + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java index 5e055d5..80489f8 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java @@ -8,6 +8,7 @@ import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.Collect; +import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.mapper.ModelMapper; import com.mcwl.resource.mapper.ModelVersionMapper; @@ -40,6 +41,8 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo private ModelMapper modelMapper; + + @Autowired private ModelVersionMapper modelVersionMapper; @@ -138,6 +141,13 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo return R.fail(HttpStatus.SHOW_ERROR_MSG,"此文件不可下载"); } + //校验是否购收费/购买 + ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId()); + if (modelProduct.getIsFree() == 0){ + + + } + if (modelVersion.getIsEncrypt() == 1){ if (StringUtils.isEmpty(modelVersion.getEncryptionFilePath())){