修复转发企业微信群机器人碰到"被截断问题
This commit is contained in:
parent
20c432c12e
commit
9a0f26a7a3
|
@ -4,9 +4,12 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.idormy.sms.forwarder.utils.LogUtil;
|
import com.idormy.sms.forwarder.utils.LogUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
import okhttp3.Callback;
|
import okhttp3.Callback;
|
||||||
|
@ -29,10 +32,17 @@ public class SenderQyWxGroupRobotMsg {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String textMsg = "{ \"msgtype\": \"text\", \"text\": {\"content\": \"" + from + " : " + content + "\"}}";
|
//String textMsg = "{ \"msgtype\": \"text\", \"text\": {\"content\": \"" + from + " : " + content + "\"}}";
|
||||||
|
Map textMsgMap = new HashMap();
|
||||||
|
textMsgMap.put("msgtype", "text");
|
||||||
|
Map textText = new HashMap();
|
||||||
|
textText.put("content", content);
|
||||||
|
textMsgMap.put("text", textText);
|
||||||
|
String textMsg = JSON.toJSONString(textMsgMap);
|
||||||
|
Log.i(TAG, "textMsg:" + textMsg);
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient client = new OkHttpClient();
|
||||||
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;charset=utf-8"),
|
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;charset=utf-8"), textMsg);
|
||||||
textMsg);
|
|
||||||
|
|
||||||
final Request request = new Request.Builder()
|
final Request request = new Request.Builder()
|
||||||
.url(webHook)
|
.url(webHook)
|
||||||
|
|
Loading…
Reference in New Issue