服务发布(nacos版)

This commit is contained in:
2025-05-25 20:38:36 +08:00
parent 28b5ca1dfc
commit 60a71a121c
3 changed files with 33 additions and 21 deletions

View File

@ -12,7 +12,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Tag(name ="服务发布相关接口")
@RestController
@ -33,17 +36,15 @@ public class publishController {
public OptResult<List<ServicePublishVO>> save(@RequestBody ServicePublishDTO servicePublishDTO) {
log.info("模型发布请求:{}", servicePublishDTO);
publishService.save(servicePublishDTO);
Long modelId = servicePublishDTO.getModelId();
String key = "Model_" + modelId;
//todo 调用模型部署
try {
// 新增传递apiUrl参数
nacosServiceUtil.registerService(
servicePublishDTO.getModelId().toString(),
servicePublishDTO.getIp(),
8080
8080,
servicePublishDTO.getApiUrl()
);
log.info("Nacos服务注册成功");
} catch (Exception e) {