修改文件校验为POST请求

master
Diyu0904 2025-03-28 14:44:21 +08:00
parent 96141843ef
commit f6ed1d4982
9 changed files with 86 additions and 62 deletions

View File

@ -6,7 +6,6 @@ import com.mcwl.resource.domain.request.RequestDownload;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.impl.DownloadRecordServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -79,7 +78,7 @@ public class DownloadRecordController {
return downloadRecordService.deleteDownloadRecord(ids);
}
@ApiModelProperty(value = "根据文件名查询详情")
@ApiOperation(value = "根据文件名查询详情")
@PostMapping("/selectFileByName")
public R selectByFileName(@RequestBody RequestDownload requestDownload){

View File

@ -3,6 +3,7 @@ package com.mcwl.web.controller.system;
import com.alibaba.fastjson2.JSONObject;
import com.mcwl.common.annotation.Anonymous;
import com.mcwl.common.constant.Constants;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.constant.QueueConstants;
import com.mcwl.common.constant.RedisConstants;
import com.mcwl.common.core.domain.AjaxResult;
@ -60,13 +61,13 @@ public class SysLoginController
public AjaxResult code(@RequestParam String phone){
if (StringUtils.isEmpty(phone)){
return AjaxResult.error("请输入手机号");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请输入手机号");
}
//校验验证码是否存在
if (redisCache.hasKey(RedisConstants.CODE_PHONE+phone)){
return AjaxResult.error("请勿重复发送");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请勿重复发送");
}
//生成验证码

View File

@ -408,6 +408,20 @@
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- &lt;!&ndash; 微信公众号扫码登录需要 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.github.binarywang</groupId>-->
<!-- <artifactId>weixin-java-mp</artifactId>-->
<!-- <version>4.4.0</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; 微信公众号扫码登录需要 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.github.binarywang</groupId>-->
<!-- <artifactId>wx-java-mp-spring-boot-starter</artifactId>-->
<!-- <version>4.4.0</version>-->
<!-- </dependency>-->
</dependencies>
<repositories>

View File

@ -165,7 +165,8 @@ public class SecurityConfig {
"/personalCenter/selectByUserIdImage",
"/personalCenter/likeModel",
"/personalCenter/likeWorkFlow",
"/personalCenter/likeImage"
"/personalCenter/likeImage",
"/api/ucenter/wx/**"
).permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()

View File

@ -104,4 +104,7 @@ public class DownloadRecord {
@ApiModelProperty(value = "下载类型0模型 1工作流")
private Integer downloadType;
@ApiModelProperty(value = "触发词")
private String triggerWords;
}

View File

@ -135,6 +135,12 @@ public class ModelProduct extends BaseEntity {
@ApiModelProperty(value = "删除标志0代表存在 2代表删除")
private String delFlag;
/**
*
*/
@ApiModelProperty(value = "是否收费 0收费 1免费")
private Integer isFree;
/**
*
*/

View File

@ -2,18 +2,15 @@ package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.*;
import com.mcwl.resource.domain.DownloadRecord;
import com.mcwl.resource.domain.request.RequestDownload;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.*;
import com.mcwl.resource.service.DownloadRecordService;
import com.mcwl.system.init.DictInit;
import com.mcwl.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -59,43 +56,43 @@ public class DownloadRecordServiceImpl implements DownloadRecordService {
downloadRecord.setUserId(SecurityUtils.getUserId());
downloadRecord.setCreateTime(new Date());
//获取作品信息
if (downloadRecord.getProductType() == 0){
//查询文件/名称信息
ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId());
downloadRecord.setFileName(modelVersion.getFileName());
downloadRecord.setFileSize(modelVersion.getFileSize());
downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+"");
//根据版本查找封面信息
ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId());
downloadRecord.setCover(modelProduct.getSurfaceUrl());
downloadRecord.setProductName(modelProduct.getModelName());
//查询作者信息
SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId());
downloadRecord.setAuthorName(sysUser.getNickName());
}else {
//查询文件/名称信息
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(downloadRecord.getProductId());
downloadRecord.setFileName(workFlowVersion.getFileName());
downloadRecord.setFileSize(workFlowVersion.getFileSize());
//根据版本查找封面信息
WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId());
downloadRecord.setCover(workFlow.getCoverPath());
downloadRecord.setProductName(workFlow.getWorkflowName());
//查询作者信息
SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId());
downloadRecord.setAuthorName(sysUser.getNickName());
}
// //获取作品信息
// if (downloadRecord.getProductType() == 0){
//
// //查询文件/名称信息
// ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId());
// downloadRecord.setFileName(modelVersion.getFileName());
// downloadRecord.setFileSize(modelVersion.getFileSize());
// downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+"");
//
// //根据版本查找封面信息
// ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId());
// downloadRecord.setCover(modelProduct.getSurfaceUrl());
// downloadRecord.setProductName(modelProduct.getModelName());
//
// //查询作者信息
// SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId());
// downloadRecord.setAuthorName(sysUser.getNickName());
//
// }else {
//
// //查询文件/名称信息
// WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(downloadRecord.getProductId());
// downloadRecord.setFileName(workFlowVersion.getFileName());
// downloadRecord.setFileSize(workFlowVersion.getFileSize());
//
//
// //根据版本查找封面信息
// WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId());
// downloadRecord.setCover(workFlow.getCoverPath());
// downloadRecord.setProductName(workFlow.getWorkflowName());
//
//
// //查询作者信息
// SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId());
// downloadRecord.setAuthorName(sysUser.getNickName());
//
// }
downloadRecordMapper.insert(downloadRecord);
@ -172,12 +169,12 @@ public class DownloadRecordServiceImpl implements DownloadRecordService {
}
List<DownloadRecord> downloadRecords = downloadRecordMapper.selectList(wrapper);
if (requestDownload.getType() != 999){
//翻译底模
for (DownloadRecord downloadRecord : downloadRecords) {
downloadRecord.setModelVersionType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,downloadRecord.getModelVersionType()));
}
}
// if (requestDownload.getType() != 999){
// //翻译底模
// for (DownloadRecord downloadRecord : downloadRecords) {
// downloadRecord.setModelVersionType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,downloadRecord.getModelVersionType()));
// }
// }
return R.ok(downloadRecords);
}

View File

@ -1,5 +1,6 @@
package com.mcwl.resource.service.impl;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.utils.StringUtils;
@ -33,7 +34,7 @@ public class FileServiceImpl implements FileService {
if (StringUtils.isEmpty(type)){
return AjaxResult.error("请输入type");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请输入type");
}
if (type.equals("model")) {
@ -41,7 +42,7 @@ public class FileServiceImpl implements FileService {
ModelVersion modelVersion = versionMapper.selectByEncryptionFileName(name);
if (modelVersion == null) {
return AjaxResult.error("文件不存在");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件不存在");
}
return AjaxResult.success(modelVersion);
@ -49,13 +50,13 @@ public class FileServiceImpl implements FileService {
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByFileName(name);
if (workFlowVersion == null) {
return AjaxResult.error("文件不存在");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件不存在");
}
return AjaxResult.success(workFlowVersion);
}
return AjaxResult.error("type不合法");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"type不合法");
}
@Override
@ -63,7 +64,7 @@ public class FileServiceImpl implements FileService {
if (StringUtils.isEmpty(type)){
return AjaxResult.error("请输入type");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请输入type");
}
if (type.equals("model")) {
@ -84,7 +85,7 @@ public class FileServiceImpl implements FileService {
return AjaxResult.success(1);
}
return AjaxResult.error("type不合法");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"type不合法");
}

View File

@ -3,6 +3,7 @@ package com.mcwl.system.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.mcwl.common.annotation.DataScope;
import com.mcwl.common.constant.CacheConstants;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.constant.UserConstants;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.entity.SysRole;
@ -639,7 +640,7 @@ public class SysUserServiceImpl implements ISysUserService
if (3<=s){
return AjaxResult.error("次数上限");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"次数上限");
}else {
//次数+1
s++;
@ -653,7 +654,7 @@ public class SysUserServiceImpl implements ISysUserService
//查看身份证是否唯一
SysUser user = userMapper.selectByIdCard(sysUser.getIdCard());
if (user != null){
return AjaxResult.error("该信息已绑定");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"该信息已绑定");
}
//校验
String s1 = VerifyCard.idCard(sysUser.getName(), sysUser.getIdCard());
@ -661,12 +662,13 @@ public class SysUserServiceImpl implements ISysUserService
Integer code = jsonObject.getInteger("code");
if (code != 200){
return AjaxResult.error(jsonObject.getString("msg"));
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,jsonObject.getString("msg"));
}
JSONObject data = jsonObject.getJSONObject("data");
String desc = data.getString("desc");
if (desc.equals("不一致")){
return AjaxResult.error("请填写正确信息");
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请填写正确信息");
}
log.info("实名认证校验的结果:{}",s1);
//修改数据库