|
|
@@ -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);
|
|
|
+ }
|
|
|
+}
|