Initial commit: 添加项目代码

This commit is contained in:
2026-02-13 18:24:52 +08:00
commit 05d3cc539d
303 changed files with 97922 additions and 0 deletions

39
demo/DraftUrlTest.java Normal file
View File

@@ -0,0 +1,39 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
public class DraftUrlTest {
private static final ObjectMapper objectMapper = new ObjectMapper();
public static String extractDraftUrl(String jsonString) {
if (jsonString == null || jsonString.isEmpty()) {
return null;
}
try {
JsonNode rootNode = objectMapper.readTree(jsonString);
JsonNode outputNode = rootNode.get("Output");
if (outputNode == null || !outputNode.isObject()) {
return null;
}
JsonNode draftUrlNode = outputNode.get("output");
if (draftUrlNode == null || !draftUrlNode.isTextual()) {
return null;
}
String draftUrl = draftUrlNode.asText();
draftUrl = draftUrl.replaceAll("\\\"", "");
return draftUrl;
} catch (IOException e) {
return null;
}
}
public static void main(String[] args) {
String testJson = "{\"node_status\":\"0\",\"Output\":{\"output\":\"https://www.1818ai.com/api/v1/drafts/download_draft?draft_id=040ac6aa-a786-4fa5-8dee-506ba1d6c35d\"}}";
String draftUrl = extractDraftUrl(testJson);
System.out.println("提取的draft_url: " + draftUrl);
System.out.println("测试结果: " + (draftUrl != null ? "成功" : "失败"));
}
}