فهرست منبع

portal 界面

danchaofan1412 3 سال پیش
والد
کامیت
4004ed4521
1فایلهای تغییر یافته به همراه23 افزوده شده و 0 حذف شده
  1. 23 0
      framework-common/src/main/java/com/mrxu/framework/common/weixin/api/KefuApi.java

+ 23 - 0
framework-common/src/main/java/com/mrxu/framework/common/weixin/api/KefuApi.java

@@ -0,0 +1,23 @@
+package com.mrxu.framework.common.weixin.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.mrxu.framework.common.weixin.base.WxHttp;
+import com.mrxu.framework.common.weixin.base.WxResult;
+import com.mrxu.framework.common.weixin.bean.ComponentToken;
+
+public class KefuApi {
+
+    public static String sendUrl = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=";
+
+    // https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#7
+    public static WxResult sendText(String accessToken, String openId, String content) {
+        JSONObject json = new JSONObject();
+        json.put("touser", openId);
+        json.put("msgtype", "text");
+
+        JSONObject text = new JSONObject();
+        text.put("content", content);
+        json.put("text", text);
+        return WxHttp.post(ComponentToken.class,sendUrl+accessToken,json);
+    }
+}