|
@@ -180,19 +180,14 @@ public class OkkiSiteController extends JeecgController<OkkiSite, IOkkiSiteServi
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping(value = "status")
|
|
|
- public Result<String> changeStatus(@RequestBody OkkiSite okkiSite) {
|
|
|
+ public Result<String> changeStatus(@RequestBody OkkiSite okkiSite) throws Exception{
|
|
|
// TODO:: 请求okki平台接口
|
|
|
- return Result.OK();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public static void main(String[] args) throws Exception {
|
|
|
String url = "https://cms.dev.xiaoman.cn/shop-api/External/site";
|
|
|
String clientSecret = "rAqZAp9oo0crNariGVVpt5AvPeVhCKXJ";
|
|
|
Map<String, String> query = new TreeMap<>();
|
|
|
query.put("sign_method", "hmac-md5");
|
|
|
query.put("timestamp", String.valueOf(System.currentTimeMillis()));
|
|
|
- query.put("site_id", "1000002");
|
|
|
+ query.put("site_id", String.valueOf(okkiSite.getSiteId()));
|
|
|
query.put("method", "update_site_status");
|
|
|
|
|
|
Map<String, Object> postData = new HashMap<>();
|
|
@@ -205,9 +200,38 @@ public class OkkiSiteController extends JeecgController<OkkiSite, IOkkiSiteServi
|
|
|
|
|
|
String okkiUrl = url + "?" + buildQueryString(query);
|
|
|
String res = doPost(okkiUrl, body);
|
|
|
- System.out.println(res);
|
|
|
+ if (!res.isEmpty()) {
|
|
|
+ okkiSite.setStatus(3);
|
|
|
+ okkiSiteService.updateById(okkiSite);
|
|
|
+ return Result.OK("操作成功");
|
|
|
+ }else {
|
|
|
+ return Result.error("操作失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// public static void main(String[] args) throws Exception {
|
|
|
+// String url = "https://cms.dev.xiaoman.cn/shop-api/External/site";
|
|
|
+// String clientSecret = "rAqZAp9oo0crNariGVVpt5AvPeVhCKXJ";
|
|
|
+// Map<String, String> query = new TreeMap<>();
|
|
|
+// query.put("sign_method", "hmac-md5");
|
|
|
+// query.put("timestamp", String.valueOf(System.currentTimeMillis()));
|
|
|
+// query.put("site_id", "1000002");
|
|
|
+// query.put("method", "update_site_status");
|
|
|
+//
|
|
|
+// Map<String, Object> postData = new HashMap<>();
|
|
|
+// postData.put("status", 3);
|
|
|
+//
|
|
|
+// String queryStr = buildQueryString(query);
|
|
|
+// String body = toJsonString(postData);
|
|
|
+// String signStr = queryStr + body;
|
|
|
+// query.put("signature", generateHmacMD5(signStr, clientSecret));
|
|
|
+//
|
|
|
+// String okkiUrl = url + "?" + buildQueryString(query);
|
|
|
+// String res = doPost(okkiUrl, body);
|
|
|
+// System.out.println(res);
|
|
|
+// }
|
|
|
+
|
|
|
private static String buildQueryString(Map<String, String> params) {
|
|
|
StringBuilder query = new StringBuilder();
|
|
|
for (Map.Entry<String, String> entry : params.entrySet()) {
|