注意事项

手写的,如有不规范的地方或有优化的地方请多多指正
1.必须购买e云管家服务(有3天测试版)
2.效果是在ipad的远程登录,通过接口方式管理账号
3.可加微信私聊,互相指正(yy421438814)

post请求示例

private static RequestConfig requestConfig;
static {requestConfig = RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(2000).build();}
public static JSONObject httpPost(String url, JSONObject jsonParam, String headerParam) {// post请求返回结果CloseableHttpClient httpClient = HttpClients.createDefault();JSONObject jsonResult = null;HttpPost httpPost = new HttpPost(url);// 设置请求和传输超时时间httpPost.setConfig(requestConfig);try {if (null != jsonParam) {// 解决中文乱码问题StringEntity entity = new StringEntity(jsonParam.toString(), "utf-8");entity.setContentEncoding("UTF-8");entity.setContentType("application/json");httpPost.setEntity(entity);}if (StringUtils.hasText(headerParam)){httpPost.setHeader("Authorization",headerParam);}CloseableHttpResponse result = httpClient.execute(httpPost);// 请求发送成功,并得到响应if (result.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {String str = "";try {// 读取服务器返回过来的json字符串数据str = EntityUtils.toString(result.getEntity(), "utf-8");// 把json字符串转换成json对象jsonResult = JSONObject.parseObject(str);} catch (Exception e) {logger.error("post请求提交失败:" + url, e);}}} catch (IOException e) {logger.error("post请求提交失败:" + url, e);} finally {httpPost.releaseConnection();}return jsonResult;}

其他模块的通配

    /*** post请求传输json参数** @param url  url地址* @param jsonParam 参数* @return*/public static JSONObject httpPost(String url, JSONObject jsonParam) {return httpPost(url, jsonParam, null);}

全局路径

    public static final String CRM_URL = "购买后在aip信息里面查询";

登录接口

//获取登录tokenpublic  static JSONObject postResponse(String account, String password){JSONObject json = new JSONObject();json.put("account",account);json.put("password",password);return HttpClientUtils.httpPost(CRM_URL + "/member/login", json);}

获取二维码

  public static JSONObject iPadLogin(EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();json.put("wcId",edSchoolWx.getEdSchoolWxWcid());json.put("proxy","18"); //根据地区来适配官方文档有if (StringUtils.hasText(RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()))) {System.out.println(RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()).toString());JSONObject jsonObject = HttpClientUtils.httpPost(CRM_URL + "/iPadLogin",json,RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()));return jsonObject;}else {throw new BusinessException("缺少登录信息");}}

执行登录(确认登录)

    public static JSONObject getIPadLoginInfo(EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();if (StringUtils.hasText(edSchoolWx.getEdSchoolWxWid())){json.put("wId",edSchoolWx.getEdSchoolWxWid());}else {throw new BusinessException("请重新获取微信信息");}if (StringUtils.hasText(RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()))) {//特殊超时时间JSONObject jsonObject = HttpClientUtils.httpPosts(CRM_URL + "/getIPadLoginInfo", json,RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()));return jsonObject;}else {throw new BusinessException("缺少登录信息");}}

初始化通讯录列表

 public static JSONObject initAddressList(EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();if (StringUtils.hasText(edSchoolWx.getEdSchoolWxWid())){json.put("wId",edSchoolWx.getEdSchoolWxWid());}else {throw new BusinessException("请重新获取微信信息");}if (StringUtils.hasText(RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()))) {JSONObject jsonObject = HttpClientUtils.httpPost(CRM_URL + "/initAddressList", json,RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()));return jsonObject;}else {throw new BusinessException("缺少登录信息");}}

获取通讯录列表

public static  JSONObject getAddressList(EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();if (StringUtils.hasText(edSchoolWx.getEdSchoolWxWid())){json.put("wId",edSchoolWx.getEdSchoolWxWid());}else {throw new BusinessException("请重新获取微信信息");}if (StringUtils.hasText(RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()))) {JSONObject jsonObject = HttpClientUtils.httpPost(CRM_URL + "/getAddressList", json,RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()));return jsonObject;}else {throw new BusinessException("缺少登录信息");}}

获取联系人信息

 public static List<CrmFriend> getContact(List<String> wcIds, EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();if (StringUtils.hasText(edSchoolWx.getEdSchoolWxWid())){json.put("wId",edSchoolWx.getEdSchoolWxWid());}else {throw new BusinessException("请重新获取微信信息");}if (StringUtils.hasText(RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()))) {List<CrmFriend> data = new ArrayList<>();if (wcIds != null && !wcIds.isEmpty()){//一次最多获取20个联系人的数据List<List<String>> lists = SysUtils.averageAssign(wcIds, 20);lists.stream().forEach(itme ->{StringBuffer resultBuffer = new StringBuffer();for (int m=0;m<itme.size();m++){String bondNo=itme.get(m);if (m == 0) {//只有一个值的时候输出resultBuffer.append(bondNo);}else{//有多个值的时候分号分割resultBuffer.append("," + bondNo);}}String    testResult = resultBuffer.toString();json.put("wcId",testResult);try {sleep(300);} catch (InterruptedException e) {e.printStackTrace();}JSONObject httpPost = HttpClientUtils.httpPost(CRM_URL + "/getContact", json,RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()));//组装数据if ("1000".equals(httpPost.get("code"))){if (null != httpPost.get("data")){List<CrmFriend> jsonArray = JSON.parseArray(httpPost.getString("data"),CrmFriend.class);data.addAll(jsonArray);}}else {throw new BusinessException("获取联系人列表失败");}});}return data;}else {throw new BusinessException("缺少登录信息");}}

发送文本消息

 public static void sendText(List<String> wcIds,String content,EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();if (StringUtils.hasText(edSchoolWx.getEdSchoolWxWid())){json.put("wId",edSchoolWx.getEdSchoolWxWid());}else {throw new BusinessException("请重新获取微信信息");}json.put("content",content);if (StringUtils.hasText(RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()))) {wcIds.stream().forEach(imte -> {if (json.containsKey("wcId")) {json.remove("wcId");}json.put("wcId", imte);HttpClientUtils.httpPost(CRM_URL + "/sendText", json, RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()));});}}

发送图片消息

 public static  void sendImage(List<String> wcIds,String content,EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();if (StringUtils.hasText(edSchoolWx.getEdSchoolWxWid())){json.put("wId",edSchoolWx.getEdSchoolWxWid());}else {throw new BusinessException("请重新获取微信信息");}json.put("content",content);if (StringUtils.hasText(RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()))) {wcIds.stream().forEach(imte -> {if (json.containsKey("wcId")) {json.remove("wcId");}json.put("wcId", imte);JSONObject jsonObject = HttpClientUtils.httpPost(CRM_URL + "/sendImage", json, RedisUtils.getCacheObject("school-" + edSchoolWx.getEdSchoolId()));System.out.println(jsonObject);});}}

判断是否登录

  public static  boolean isOnline(EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();if (StringUtils.hasText(edSchoolWx.getEdSchoolWxWid())){json.put("wId",edSchoolWx.getEdSchoolWxWid());}else {throw new BusinessException("当前登录信息有误");}if (StringUtils.hasText(RedisUtils.getCacheObject("school"+edSchoolWx.getEdSchoolId()))) {JSONObject jsonObject = HttpClientUtils.httpPost(CRM_URL + "/isOnline", json, RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()));JSONObject obj = (JSONObject) jsonObject.get("data");return (boolean) obj.get("isOnline");}else {return false;}}

退出登录

public static JSONObject offline(List<String> wcIds,EdSchoolWx edSchoolWx){JSONObject json = new JSONObject();json.put("wcIds",wcIds);return HttpClientUtils.httpPost(CRM_URL + "/member/offline", json, RedisUtils.getCacheObject("school-"+edSchoolWx.getEdSchoolId()));}

个人微信自动化发送信息提供基础接口示例(E云管家)相关推荐

  1. 模拟微信自动化发送(微信公众号文章自动点击)

    大家好,我是烤鸭: 分享个微信自动化发送的新方式,仅技术分享. 本来是公众号文章抓取相关的,审核一直不过,将就看吧. 需要的工具 Java(jdk1.8) Fiddler Python(3.8) 一些 ...

  2. 开源PHP微信通用sdk,支持微信支付及所有基础接口(强烈推荐)

    PHP微信通用sdk,支持微信支付及所有基础接口 WeChatDeveloper for PHP 功能描述 技术帮助 代码仓库 文件说明(后缀会根据官方文档增加文件) 安装使用 微信支付 支付宝支付 ...

  3. 企业微信机器人脚本python_python实现企业微信定时发送文本消息的示例代码

    企业微信定时发送文本消息 使用工具:企业微信机器人+python可执行文件+计算机管理中的任务计划程序 第一步:创建群机器人 选择群聊,单击鼠标右键,添加群机器人. 建立群机器人后,右键查看机器人,如 ...

  4. .net微信公众号开发——基础接口

    作者:王先荣     本文讲述微信公众号开发中基础接口的使用,包括以下内容:     (1)获取许可令牌(AccessToken):     (2)获取微信服务器地址:     (3)上传.下载多媒体 ...

  5. Python实现微信自动化发送信息

    需求:利用PC端微信实现自动向文件传输助手,好友等发送信息 库说明 psutil: 获取系统运行的进程和系统利用率(包括CPU.内存.磁盘.网络等)信息,用于获取进程ID pywinauto:自动化M ...

  6. 微信自动化发送消息以及点击

    需求来源:公司在更新一些某信数据的时候,总是按照电脑的像素来对为获取,每次部署总需要更新一下代码的位置,为了代码能够更加的严谨,适用于更多的电脑,本次进行了调研更新完善代码 备注:本次代码仅适用于wi ...

  7. 企业微信调用发送应用消息接口返回错误代码301002

    接口返回信息: ["errcode"]=> int(301002) ["errmsg"]=> string(109) "not allow ...

  8. 微信公众号开发(二)基础接口

    微信公众号开发(二)基础接口 未经认证的订阅号只有基础接口的权限,基础接口主要包括三个部分:接收用户消息.发送被动响应消息和接收事件推送消息,开发者需要对用户消息在5秒内立即做出回应,微信服务器在五秒 ...

  9. Python发送微信消息(文字、图片、文件)给指定好友和微信群,零基础可看懂(附源码和教程)

    前言 本示例是调用Windows API模拟发送,用Python调用win32api这个库来调用Windows API模拟人的手动操作来发送消息. 在使用前,请将你微信的窗口设置为在最前面,这样就便于 ...

最新文章

  1. hibernate 插入 效率_Hibernate:检索策略的学习1
  2. iOS之UI--涂鸦画板实例
  3. prism项目搭建 wpf_Prism完成的一个WPF项目
  4. python之torchlight使用_python游戏编程之pgzero使用介绍
  5. react前端显示图片_如何在react项目中引用图片?
  6. linux 文件系统 dfs,分布式文件系统fastDFS 机器硬件要求
  7. [解决方案]Window 2008 R2 + IIS7.5 + VS2013 错误代码 0x80070002
  8. 利用1stOpt进行方程拟合与参数优化
  9. ICP-MS和ICP-AES的区别与检出限
  10. npm install安装失败,报错记录之The operation was rejected by your operating system. node-sass无法安装,且禁用淘宝镜像
  11. 全球及中国浏览器即服务行业运营模式与前景趋势展望报告2022版
  12. 制作简单刮刮乐View
  13. 个人微信/支付宝免签支付系统源码
  14. 【湍流】基于Matlab模拟高斯光束在湍流大气中传输仿真,得到大气湍流相位屏、以及光斑强度变化
  15. 绩效管理三原则,让你做好绩效
  16. 建立完善的员工晋升机制_建立合理的晋升机制,给员工发展的空间
  17. wordpress 插件的开发 入门
  18. 王童:知行合一 · 当大数据遇到生物学 | 优秀毕业生专访
  19. 【服务器】多人共享服务器用户管理
  20. hash redis springboot_SpringBoot 操作 Redis 详解

热门文章

  1. 长波、中波、短波、超短波和微波
  2. 服务器硬件RAID性能横评(4)
  3. Wetool已死,私域流量还有可用的社群工具吗?
  4. 都市快打apk格斗小助手,.net反编译,unity3d游戏逆向。
  5. python print打印設置字體顔色
  6. 关于Kali Linux的安装
  7. 千峰python 培训南京千锋教育IT培训赋能人才
  8. 简单的shader渲染带纹理的OBJ文件
  9. urllib的build_opener
  10. Android使用系统分享,分享不成功,提示多图只支持照片格式