From a5ae4efedbd5f8829887e8251fffd55c02d00ddc Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 13 一月 2026 11:18:45 +0800
Subject: [PATCH] 修改支付信息
---
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TSysInspectionController.java | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TSysInspectionController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TSysInspectionController.java
index 3743f5c..7434b62 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TSysInspectionController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TSysInspectionController.java
@@ -10,9 +10,11 @@
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.model.TSysAppUser;
import com.ruoyi.system.model.TSysInspection;
+import com.ruoyi.system.model.TSysOtherConfig;
import com.ruoyi.system.query.TSysInspectionQuery;
import com.ruoyi.system.service.TSysAppUserService;
import com.ruoyi.system.service.TSysInspectionService;
+import com.ruoyi.system.service.TSysOtherConfigService;
import com.ruoyi.system.utils.util.AIUtil;
import com.ruoyi.system.vo.TSysInspectionVO;
import io.swagger.annotations.Api;
@@ -40,13 +42,15 @@
private final TSysInspectionService sysInspectionService;
private final TokenService tokenService;
private final TSysAppUserService sysAppUserService;
+ private final TSysOtherConfigService sysOtherConfigService;
private final AIUtil aiUtil;
private final RedisCache redisCache;
@Autowired
- public TSysInspectionController(TSysInspectionService sysInspectionService, TokenService tokenService, TSysAppUserService sysAppUserService, AIUtil aiUtil, RedisCache redisCache) {
+ public TSysInspectionController(TSysInspectionService sysInspectionService, TokenService tokenService, TSysAppUserService sysAppUserService, TSysOtherConfigService sysOtherConfigService, AIUtil aiUtil, RedisCache redisCache) {
this.sysInspectionService = sysInspectionService;
this.tokenService = tokenService;
this.sysAppUserService = sysAppUserService;
+ this.sysOtherConfigService = sysOtherConfigService;
this.aiUtil = aiUtil;
this.redisCache = redisCache;
}
@@ -67,7 +71,24 @@
@ApiOperation(value = "查看用户检测信息管理详情")
@GetMapping(value = "/getDetailById")
public R<TSysInspection> getDetailById(@RequestParam String id) {
- return R.ok(sysInspectionService.getById(id));
+ // 查询用户信息
+ String userId = tokenService.getLoginUserApplet().getUserId();
+ TSysAppUser sysAppUser = sysAppUserService.getById(userId);
+ // 匹配免费次数
+ TSysOtherConfig sysOtherConfig = sysOtherConfigService.getById(1);
+ TSysInspection sysInspection = sysInspectionService.getById(id);
+ if(sysInspection.getIsPay() == 0 && sysInspection.getInspectionType() == 2){
+ // 匹配免费次数
+ if(Objects.equals(sysAppUser.getUseAiFreeCount(), sysOtherConfig.getAiFreeCount())){
+ return R.fail("您已使用完免费次数");
+ }
+ // 检测免费次数
+ sysAppUser.setUseAiFreeCount(sysAppUser.getUseAiFreeCount() + 1);
+ sysAppUserService.updateById(sysAppUser);
+ sysInspection.setIsPay(1);
+ sysInspectionService.updateById(sysInspection);
+ }
+ return R.ok(sysInspection);
}
/**
--
Gitblit v1.7.1