ソースを参照

claude与gpt清次数

chenbiao 1 年間 前
コミット
164edcc3cb

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/chatgpt/impl/ChatGptAccountServiceImpl.java

@@ -130,7 +130,7 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
 
     @Override
     public void clearGptNum(Long relationId) throws Exception {
-        HttpRequest request = new HttpRequest("http://154.198.213.52:9611/cleanUserTokenLimit?relationId=" + relationId);
+        HttpRequest request = new HttpRequest("https://saas.galaxyva.com/cleanUserTokenLimit?relationId=" + relationId);
         HttpResponse execute = request.method(Method.GET).setConnectionTimeout(3000).timeout(3000).execute();
         String body = execute.body();
         JSONObject re = Jsons.parseObject(body, JSONObject.class);

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/claude/ClaudeService.java

@@ -33,4 +33,6 @@ public interface ClaudeService {
     Long carLimit(String carId);
 
 	void clearNum(String userToken) throws Exception;
+
+    void clearNumByRelationId(Long relationId) throws Exception;
 }

+ 14 - 0
netflix-service/src/main/java/com/cyksj/service/claude/impl/ClaudeServiceImpl.java

@@ -249,6 +249,20 @@ public class ClaudeServiceImpl implements ClaudeService {
         }
     }
 
+    @Override
+    public void clearNumByRelationId(Long relationId) throws Exception {
+        ClaudeUser claudeUser = claudeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeUser.class).eq(ClaudeUser::getRelationId, relationId));
+
+        HttpRequest request = new HttpRequest("http://147.79.20.183:9611/claude/cleanUserTokenLimit?userToken=" + claudeUser.getUserToken());
+        HttpResponse execute = request.method(Method.GET).setConnectionTimeout(3000).timeout(3000).execute();
+        String body = execute.body();
+        JSONObject re = Jsons.parseObject(body, JSONObject.class);
+        if (!body.contains("清除成功")) {
+            throw BusinessRuntimeException.getInstance(re.getStr("message"));
+        }
+    }
+
+
 
     /**
      * 获取车位信息

+ 12 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/WxCorpController.java

@@ -31,6 +31,7 @@ import com.cyksj.model.request.corp.CorpCommonReq;
 import com.cyksj.model.views.*;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.chatgpt.ChatGptAccountService;
+import com.cyksj.service.claude.ClaudeService;
 import com.cyksj.service.corp.CorpService;
 import com.cyksj.service.corp.CorpUserService;
 import com.cyksj.service.mange.CmsOrderDonService;
@@ -93,6 +94,8 @@ public class WxCorpController {
 
 	private final ChatGptAccountService chatGptAccountService;
 
+	private final ClaudeService claudeService;
+
 	private final static String CORP_UUID = "corp-uuid";
 
 	/**
@@ -531,4 +534,13 @@ public class WxCorpController {
 		chatGptAccountService.clearGptNum(relationId);
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
+
+	/**
+	 * 清除claude次数
+	 */
+	@PutMapping("/clear/claude/num")
+	public Result<String> clearClaudeNum(Long relationId) throws Exception {
+		claudeService.clearNumByRelationId(relationId);
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
 }