|
|
@@ -15,6 +15,7 @@
|
|
|
*/
|
|
|
package io.jpress.admin.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jfinal.aop.Before;
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
import com.jfinal.plugin.activerecord.IAtom;
|
|
|
@@ -37,6 +38,7 @@ import io.jpress.router.RouterNotAllowConvert;
|
|
|
import io.jpress.template.TemplateManager;
|
|
|
import io.jpress.template.TplModule;
|
|
|
import io.jpress.template.TplTaxonomyType;
|
|
|
+import io.jpress.utils.HttpUtils;
|
|
|
import io.jpress.utils.JsoupUtils;
|
|
|
import io.jpress.utils.StringUtils;
|
|
|
|
|
|
@@ -458,12 +460,43 @@ public class _ContentController extends JBaseCRUDController<Content> {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if ("uuhelper".equals(content.getModule()) && Content.STATUS_NORMAL.equals(content.getStatus())) {
|
|
|
+ pushUuHelper(content);
|
|
|
+ }
|
|
|
+
|
|
|
AjaxResult ar = new AjaxResult();
|
|
|
ar.setErrorCode(0);
|
|
|
ar.setData(content.getId());
|
|
|
renderAjaxResult("save ok", 0, content.getId());
|
|
|
}
|
|
|
|
|
|
+ private void pushUuHelper(Content content) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ String url = "http://113.105.74.140:8092/console/pushToAll";
|
|
|
+ String fromUserId = "10000";
|
|
|
+ JSONObject bodyJO = new JSONObject(true);
|
|
|
+ bodyJO.put("content", content.getTitle());
|
|
|
+ bodyJO.put("fromUserId", "10000");
|
|
|
+ bodyJO.put("fromUserName", "系统消息");
|
|
|
+ bodyJO.put("type", 1);
|
|
|
+ bodyJO.put("timeSend", "");
|
|
|
+ bodyJO.put("imageUrl", content.getThumbnail());
|
|
|
+ bodyJO.put("linkUrl", content.getUrl());
|
|
|
+ String body = bodyJO.toJSONString();
|
|
|
+
|
|
|
+ map.put("fromUserId", fromUserId);
|
|
|
+ map.put("body", body);
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+ String response = HttpUtils.get(url, map);
|
|
|
+ System.out.println(response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private Content getContent() {
|
|
|
Content content = getModel(Content.class);
|
|
|
|