| | |
| | |
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.create.get", map);
|
| | | |
| | | // String result = "{\r\n" + |
| | | // " \"status\":\"0000\",\r\n" + |
| | | // " \"msg\":\"亲,添加成功\",\r\n" + |
| | | // " \"data\":{\r\n" + |
| | | // " \"id\":11770,\r\n" + |
| | | // " \"uid\":1625,\r\n" + |
| | | // " \"wechatrobot\":\"wechatrobot\",\r\n" + |
| | | // " \"wx_id\":\"\",\r\n" + |
| | | // " \"amount_used\":0,\r\n" + |
| | | // " \"group_num\":20,\r\n" + |
| | | // " \"passwd\":\"\",\r\n" + |
| | | // " \"nickname\":\"\",\r\n" + |
| | | // " \"c_uid\":1625,\r\n" + |
| | | // " \"login_status\":0,\r\n" + |
| | | // " \"end_time\":1594785534,\r\n" + |
| | | // " \"remark\":null,\r\n" + |
| | | // " \"wc_id\":\"\",\r\n" + |
| | | // " \"agent_uid\":null,\r\n" + |
| | | // " \"is_enabled\":0,\r\n" + |
| | | // " \"robot_type\":4,\r\n" + |
| | | // " \"ip\":\"http://49.234.36.129:10002/\",\r\n" + |
| | | // " \"is_new\":1\r\n" + |
| | | // " }\r\n" + |
| | | // "}\r\n" + |
| | | // "";
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | |
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | resultJson = resultJson.optJSONObject("data");
|
| | | Type type = new TypeToken<RobotInfoDTO>() {}.getType();
|
| | |
| | | map.put("month", month +"");
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.change.get", map);
|
| | | |
| | | // String result = "{\r\n" + |
| | | // " \"status\":\"0000\",\r\n" + |
| | | // " \"msg\":\"\\u4eb2,\\u6dfb\\u52a0\\u6210\\u529f\",\r\n" + |
| | | // " \"data\":{\r\n" + |
| | | // " \"id\":11770,\r\n" + |
| | | // " \"uid\":1625,\r\n" + |
| | | // " \"wechatrobot\":\"fxdaka\",\r\n" + |
| | | // " \"wx_id\":\"wxid_vm6eb5i0in0622\",\r\n" + |
| | | // " \"amount_used\":0,\r\n" + |
| | | // " \"group_num\":20,\r\n" + |
| | | // " \"passwd\":\"\",\r\n" + |
| | | // " \"nickname\":\"\\u5206\\u4eab\\u5927\\u5496??\",\r\n" + |
| | | // " \"c_uid\":1625,\r\n" + |
| | | // " \"login_status\":1,\r\n" + |
| | | // " \"end_time\":1597377534,\r\n" + |
| | | // " \"remark\":null,\r\n" + |
| | | // " \"wc_id\":\"246124e9-9a8c-4da6-a77e-7f7f88049731\",\r\n" + |
| | | // " \"agent_uid\":null,\r\n" + |
| | | // " \"is_enabled\":0,\r\n" + |
| | | // " \"robot_type\":4,\r\n" + |
| | | // " \"ip\":\"http:\\/\\/49.234.36.129:10002\\/\",\r\n" + |
| | | // " \"is_new\":1\r\n" + |
| | | // " }\r\n" + |
| | | // "}";
|
| | | // |
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | resultJson = resultJson.optJSONObject("data");
|
| | |
| | | * @param robotId
|
| | | * @return
|
| | | */
|
| | | public static List<WeiXinGroupDTO> getContract(int robotId) {
|
| | | public static List<String> getContract(int robotId) {
|
| | | // 请求参数
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("robot_id", robotId +"");
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.room.list", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | JSONArray groupArray = resultJson.optJSONArray("data");
|
| | | if (groupArray != null && groupArray.size() > 0) {
|
| | | Type type = new TypeToken<ArrayList<String>>() {
|
| | | }.getType();
|
| | | List<String> list = new Gson().fromJson(groupArray.toString(), type);
|
| | | return list;
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | /**
|
| | | * 获取群列表
|
| | | * @param robotId
|
| | | * @param roomId
|
| | | * @return
|
| | | */
|
| | | public static WeiXinGroupDTO getGroupDetail(int robotId, String roomId) {
|
| | | if (StringUtil.isNullOrEmpty(roomId)) {
|
| | | return null;
|
| | | }
|
| | | |
| | | // 请求参数
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("robot_id", robotId +"");
|
| | | map.put("room_id", roomId +""); // 群的id ,多个用逗号隔开
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.room.detail", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | JSONArray groupArray = resultJson.optJSONArray("data");
|
| | | if (groupArray != null && groupArray.size() > 0) {
|
| | | Type type = new TypeToken<ArrayList<WeiXinGroupDTO>>() {
|
| | | }.getType();
|
| | | List<WeiXinGroupDTO> goodsList = new Gson().fromJson(groupArray.toString(), type);
|
| | | if (goodsList == null || goodsList.size() == 0) {
|
| | | return null;
|
| | | } else {
|
| | | return goodsList.get(0);
|
| | | }
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 获取群列表
|
| | | * @param robotId
|
| | | * @param roomId
|
| | | * @return
|
| | | */
|
| | | public static List<WeiXinGroupDTO> getGroupDetail(int robotId, List<String> listRoomId) {
|
| | | if (listRoomId == null || listRoomId.size() ==0) {
|
| | | return null;
|
| | | }
|
| | | |
| | | String roomIds = "";
|
| | | for (String roomID: listRoomId) {
|
| | | roomIds += roomID + ",";
|
| | | }
|
| | | if(roomIds.endsWith(","))
|
| | | roomIds = roomIds.substring(0, roomIds.length()-1);
|
| | | |
| | | // 请求参数
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("robot_id", robotId +"");
|
| | | map.put("room_id", roomIds); // 群的id ,多个用逗号隔开
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.room.detail", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | JSONArray groupArray = resultJson.optJSONArray("data");
|
| | |
| | | map.put("pic_url", picUrl);
|
| | | map.put("content", content);
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.macsend.circle", map);
|
| | | String result = baseRequest("itaoke.robot.circle.send", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | resultJson = resultJson.optJSONObject("data");
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 发朋友圈 |
| | | * @param robotId
|
| | | * @param content
|
| | | * @param picUrl 图片url,多个请用;分隔
|
| | | * @return
|
| | | */
|
| | | public static String macsendUpload(int robotId, String picUrl) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("robot_id", robotId +"");
|
| | | map.put("pic_url", picUrl);
|
| | | map.put("type", "2");
|
| | | String result = baseRequest("itaoke.robot.circle.upload", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | return resultJson.optString("data");
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 朋友圈发送视频
|