parent
e25943ed9e
commit
d69e4f8f7b
@ -0,0 +1,35 @@
|
|||||||
|
package com.dsideal.aiSupport.Util.JiMeng;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class QueryTask extends JmCommon {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询异步任务结果
|
||||||
|
*
|
||||||
|
* @param taskId 任务ID
|
||||||
|
*/
|
||||||
|
public static JSONObject queryTaskResult(String taskId) throws Exception {
|
||||||
|
// 创建请求体
|
||||||
|
JSONObject req = new JSONObject();
|
||||||
|
// 将参数名从 tsk_id 改为 task_id
|
||||||
|
req.put("task_id", taskId);
|
||||||
|
req.put("req_key", "jimeng_vgfm_t2v_l20");
|
||||||
|
|
||||||
|
// 使用JmCommon中的doRequest方法发送请求
|
||||||
|
String responseBody = doRequest("POST", new HashMap<>(), req.toString().getBytes(), "CVSync2AsyncGetResult");
|
||||||
|
|
||||||
|
// 将响应结果转换为JSONObject并返回
|
||||||
|
return JSON.parseObject(responseBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
// 使用实际获取到的task_id
|
||||||
|
String taskId = "12748116377948882873";
|
||||||
|
JSONObject result = QueryTask.queryTaskResult(taskId);
|
||||||
|
System.out.println("查询结果: " + result);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue