diff --git a/app/.env b/app/.env index e5d7545b4..9a047de58 100644 --- a/app/.env +++ b/app/.env @@ -11,9 +11,9 @@ zn_username=%E8%87%AA%E5%8A%A8%E5%8C%96_Robot client_name=ShuFuAI -# java_api_base=http://47.111.163.154:18080 -java_api_base=http://127.0.0.1:18080 -# java_api_base=http://121.196.149.225:18080 +# java_api_base=http://api.aishufu.top:18080/ +java_api_base=http://api.aishufu.top:18080/ +# java_api_base=http://api.aishufu.top:18080/ # 与 Java 后端共享的 JWT 签名密钥,必须与 backend-java 的 AIIMAGE_JWT_SECRET 完全一致 AIIMAGE_JWT_SECRET=please-change-this-secret-please-rotate-at-least-32-bytes diff --git a/app/.env copy b/app/.env copy index 26fc410dc..a1d3266b8 100644 --- a/app/.env copy +++ b/app/.env copy @@ -9,7 +9,7 @@ proxy_mode=2 client_name=ShuFuAI -java_api_base=http://127.0.0.1:18080 -# java_api_base=http://47.111.163.154:18080 +java_api_base=http://api.aishufu.top:18080/ +# java_api_base=http://api.aishufu.top:18080/ diff --git a/app/.env.example b/app/.env.example index dee2b56d4..6be76ce57 100644 --- a/app/.env.example +++ b/app/.env.example @@ -11,9 +11,9 @@ zn_username=%E8%87%AA%E5%8A%A8%E5%8C%96_Robot client_name=ShuFuAI -java_api_base=http://47.111.163.154:18080 -# java_api_base=http://127.0.0.1:18080 -# java_api_base=http://47.111.163.154:18080 +java_api_base=http://api.aishufu.top:18080/ +# java_api_base=http://api.aishufu.top:18080/ +# java_api_base=http://api.aishufu.top:18080/ # 与 Java 后端共享的 JWT 签名密钥,必须与 backend-java 的 AIIMAGE_JWT_SECRET 完全一致 AIIMAGE_JWT_SECRET=please-change-this-secret-please-rotate-at-least-32-bytes diff --git a/app/config.py b/app/config.py index 754e6a9d9..86a8d2f63 100644 --- a/app/config.py +++ b/app/config.py @@ -22,7 +22,7 @@ proxy_url = os.getenv("proxy_url") proxy_mode = int(os.getenv("proxy_mode",1)) client_name=os.getenv("client_name") + ".exe" -JAVA_API_BASE = os.getenv("java_api_base", "http://127.0.0.1:18080") +JAVA_API_BASE = os.getenv("java_api_base", "http://api.aishufu.top:18080/").rstrip("/") # 紫鸟浏览器配置 from urllib.parse import unquote @@ -32,7 +32,7 @@ ZN_USERNAME = unquote(ZN_USERNAME) ZN_PASSWORD = os.getenv("zn_password", "#20zsg25") # 删除品牌API配置 -DELETE_BRAND_API_BASE = os.getenv("DELETE_BRAND_API_BASE", JAVA_API_BASE) +DELETE_BRAND_API_BASE = os.getenv("DELETE_BRAND_API_BASE", JAVA_API_BASE).rstrip("/") cache_path = "./user_data" diff --git a/backend-java/src/main/java/com/nanri/aiimage/modules/appearancepatent/service/AppearancePatentTaskService.java b/backend-java/src/main/java/com/nanri/aiimage/modules/appearancepatent/service/AppearancePatentTaskService.java index 344a6b51f..e55585d90 100644 --- a/backend-java/src/main/java/com/nanri/aiimage/modules/appearancepatent/service/AppearancePatentTaskService.java +++ b/backend-java/src/main/java/com/nanri/aiimage/modules/appearancepatent/service/AppearancePatentTaskService.java @@ -126,7 +126,6 @@ public class AppearancePatentTaskService { "价格", "标题维度(商标)", "外观维度(外观设计专利)", - "专利维度(发明/实用新型专利)", "结论", "状态", "评分" @@ -3216,6 +3215,7 @@ public class AppearancePatentTaskService { List resultHeaders = new ArrayList<>(RESULT_HEADERS); resultHeaders.add(4, "标题"); resultHeaders.add(5, "图片链接"); + resultHeaders.add(6, "sku"); Row header = sheet.createRow(0); for (int i = 0; i < resultHeaders.size(); i++) { Cell cell = header.createCell(i); @@ -3239,9 +3239,9 @@ public class AppearancePatentTaskService { row.createCell(col++).setCellValue(firstNonBlank(parsedRow.getPrice(), "")); row.createCell(col++).setCellValue(resultRow == null ? firstNonBlank(parsedRow.getTitle(), "") : firstNonBlank(resultRow.getTitle(), parsedRow.getTitle())); row.createCell(col++).setCellValue(resultRow == null ? firstNonBlank(parsedRow.getUrl(), "") : firstNonBlank(resultRow.getUrl(), parsedRow.getUrl())); + row.createCell(col++).setCellValue(resultRow == null ? firstNonBlank(parsedRow.getSku(), "") : firstNonBlank(resultRow.getSku(), parsedRow.getSku())); row.createCell(col++).setCellValue(resultRow == null ? missingReason : userFacingCozeCellValue(resultRow, resultRow.getTitleRisk())); row.createCell(col++).setCellValue(resultRow == null ? missingReason : userFacingCozeCellValue(resultRow, resultRow.getAppearanceRisk())); - row.createCell(col++).setCellValue(resultRow == null ? missingReason : userFacingCozeCellValue(resultRow, resultRow.getPatentRisk())); row.createCell(col++).setCellValue(resultRow == null ? "未送检" : userFacingConclusion(resultRow)); row.createCell(col++).setCellValue(resultRow == null ? "" : userFacingStatus(resultRow)); row.createCell(col).setCellValue(resultRow == null ? "" : firstNonBlank(resultRow.getScore(), "")); diff --git a/backend-java/src/main/java/com/nanri/aiimage/modules/similarasin/service/SimilarAsinTaskService.java b/backend-java/src/main/java/com/nanri/aiimage/modules/similarasin/service/SimilarAsinTaskService.java index 3f462cecc..c05527f98 100644 --- a/backend-java/src/main/java/com/nanri/aiimage/modules/similarasin/service/SimilarAsinTaskService.java +++ b/backend-java/src/main/java/com/nanri/aiimage/modules/similarasin/service/SimilarAsinTaskService.java @@ -696,7 +696,7 @@ public class SimilarAsinTaskService { scope.setCreatedAt(LocalDateTime.now()); } scope.setChunkTotal(chunkTotal); - scope.setReceivedChunkCount(countChunks(taskId, scopeHash)); + scope.setReceivedChunkCount(resolveReceivedChunkProgress(taskId, scopeHash, scope.getChunkTotal())); scope.setLastChunkAt(LocalDateTime.now()); scope.setLastError(request.getError()); scope.setCompleted(Boolean.TRUE.equals(request.getDone()) ? 1 : 0); @@ -1199,7 +1199,7 @@ public class SimilarAsinTaskService { if (chunkTotal != null) { scope.setChunkTotal(chunkTotal); } - scope.setReceivedChunkCount(countChunks(taskId, scopeHash)); + scope.setReceivedChunkCount(resolveReceivedChunkProgress(taskId, scopeHash, scope.getChunkTotal())); scope.setLastChunkAt(now); scope.setLastError(error); scope.setCompleted(completed ? 1 : 0); @@ -4822,6 +4822,36 @@ public class SimilarAsinTaskService { return count == null ? 0 : count.intValue(); } + private int resolveReceivedChunkProgress(Long taskId, String scopeHash, Integer chunkTotal) { + int receivedCount = countChunks(taskId, scopeHash); + Integer maxChunkIndex = taskChunkMapper.selectObjs(new LambdaQueryWrapper() + .select(TaskChunkEntity::getChunkIndex) + .eq(TaskChunkEntity::getTaskId, taskId) + .eq(TaskChunkEntity::getModuleType, MODULE_TYPE) + .eq(TaskChunkEntity::getScopeHash, scopeHash) + .orderByDesc(TaskChunkEntity::getChunkIndex) + .last("limit 1")) + .stream() + .filter(Objects::nonNull) + .map(value -> { + if (value instanceof Number number) { + return number.intValue(); + } + try { + return Integer.parseInt(value.toString()); + } catch (Exception ignored) { + return 0; + } + }) + .findFirst() + .orElse(0); + int current = Math.max(receivedCount, maxChunkIndex == null ? 0 : maxChunkIndex); + if (chunkTotal != null && chunkTotal > 0) { + current = Math.min(current, chunkTotal); + } + return Math.max(0, current); + } + private SimilarAsinTaskItemVo toTaskItem(FileTaskEntity task) { SimilarAsinTaskItemVo vo = new SimilarAsinTaskItemVo(); vo.setId(task.getId()); @@ -4938,7 +4968,7 @@ public class SimilarAsinTaskService { PythonUploadProgress progress = resolvePythonUploadProgress(taskId); int total = progress.total() > 0 ? progress.total() : Math.max(1, progress.current() + 1); int current = Math.max(0, Math.min(progress.current(), total)); - int percent = current <= 0 ? 1 : Math.min(95, (int) Math.floor(current * 100.0 / total)); + int percent = current <= 0 ? 1 : Math.min(95, (int) Math.ceil(current * 100.0 / total)); vo.setFileProgressCurrent(current); vo.setFileProgressTotal(total); vo.setFileProgressPercent(percent); @@ -4987,6 +5017,7 @@ public class SimilarAsinTaskService { } int stateTotal = state.getChunkTotal() == null ? 0 : state.getChunkTotal(); int stateCurrent = state.getReceivedChunkCount() == null ? 0 : state.getReceivedChunkCount(); + stateCurrent = Math.max(stateCurrent, resolveReceivedChunkProgress(taskId, state.getScopeHash(), stateTotal)); if (stateTotal > total || total <= 0 && stateCurrent > current) { total = stateTotal; current = stateCurrent; @@ -5010,6 +5041,9 @@ public class SimilarAsinTaskService { } String scopeHash = firstNonBlank(chunk.getScopeHash(), ""); receivedByScope.merge(scopeHash, 1, Integer::sum); + if (chunk.getChunkIndex() != null && chunk.getChunkIndex() > 0) { + receivedByScope.merge(scopeHash, chunk.getChunkIndex(), Math::max); + } if (chunk.getChunkTotal() != null && chunk.getChunkTotal() > 0) { totalByScope.merge(scopeHash, chunk.getChunkTotal(), Math::max); } diff --git a/backend/blueprints/admin_api.py b/backend/blueprints/admin_api.py index dac2b5343..5cc8f78ef 100644 --- a/backend/blueprints/admin_api.py +++ b/backend/blueprints/admin_api.py @@ -43,7 +43,7 @@ try: from config import bucket_path, backend_java_base_url except ImportError: bucket_path = os.environ.get('BUCKET_PATH', 'nanri-image/') - backend_java_base_url = os.environ.get('BACKEND_JAVA_BASE_URL', 'http://127.0.0.1:18080').rstrip('/') + backend_java_base_url = os.environ.get('BACKEND_JAVA_BASE_URL', 'http://api.aishufu.top:18080/').rstrip('/') admin_api = Blueprint('admin_api', __name__, url_prefix='/api/admin') _backend_java_session_local = threading.local() diff --git a/backend/config.py b/backend/config.py index 1058a2e77..b09e517e1 100644 --- a/backend/config.py +++ b/backend/config.py @@ -59,8 +59,8 @@ file_url_pre = f"https://{bucket}.oss-cn-hangzhou.aliyuncs.com/" backend_java_base_url, backend_java_base_url_source = _get_env( "java_api_base", "BACKEND_JAVA_BASE_URL", - default="http://127.0.0.1:18080", - # default="http://47.111.163.154:18080", + default="http://api.aishufu.top:18080/", + # default="http://api.aishufu.top:18080/", ) backend_java_base_url = backend_java_base_url.rstrip("/") os.environ["OSS_ACCESS_KEY_ID"] = accessKeyId diff --git a/frontend-vue/vite.config.ts b/frontend-vue/vite.config.ts index 06c2f6ab7..0f195247f 100644 --- a/frontend-vue/vite.config.ts +++ b/frontend-vue/vite.config.ts @@ -30,7 +30,7 @@ export default defineConfig({ port: 5173, proxy: { '/newApi/api': { - target: 'http://127.0.0.1:18080', + target: 'http://api.aishufu.top:18080/', changeOrigin: true, rewrite: (path) => path.replace(/^\/newApi/, ''), },