1
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.web.controller.jarvis;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @version 1.0
|
||||
* @create 2025/8/15 10:53
|
||||
* @description:京东指令类
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/jarvis/jdorder")
|
||||
public class JDOrderController {
|
||||
|
||||
private final static String skey = "2192057370ef8140c201079969c956a3";
|
||||
private final static String requestUrl = "http://192.168.8.88:6666/jd/";
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/generatePromotionContent")
|
||||
public String generatePromotionContent(String promotionContent) {
|
||||
System.out.println(promotionContent);
|
||||
String result = "";
|
||||
try {
|
||||
String url = requestUrl+ "generatePromotionContent";
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("skey", skey);
|
||||
param.put("promotionContent", promotionContent);
|
||||
result = HttpUtils.sendJsonPost(url, param.toJSONString());
|
||||
System.out.println(result);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,17 @@ public class HttpUtils
|
||||
{
|
||||
return sendPost(url, param, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
|
||||
}
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求,请求体为JSON格式
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param json JSON格式的请求体
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendJsonPost(String url, String json)
|
||||
{
|
||||
return sendPost(url, json, MediaType.APPLICATION_JSON_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
|
||||
Reference in New Issue
Block a user