zoukankan      html  css  js  c++  java
  • 【微信小程序】公众号接口

    【微信接口学习】
    1.生成二维码(临时7天、永久)
    https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN
    参数{"action_name":"QR_LIMIT_SCENE","action_info":{{"scene":{"scene_id":123}}}
    临时的参数加多个"expire_seconds":6004800
    
    2.公众号授权快印客获取
    https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=wx8e2fa56e5e9fa34a&pre_auth_code=preauthcode@@@usxFmDVebUzEfKVKNVv87qQMPqx514-yAr-vWaI9ArsFxrYfjyjR68QmvDMBeZbF&redirect_uri=http://www.165183.com/callback.aspx
    
    3.公众号账号(6个参数)
    公众号名称、公众号、AppId、AppSecret、接口URL、接口Token
    其中的接口URL、接口Token需要填入公众号开发者模式里
    
    4.自定义菜单设置
    提交后最后获取
    https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN
    (接口不同处是第3段menu为菜单,第4段create为创建,ACCESS_TOKE为公众号token)
    接口版本:需要IPHONE5.4.1和Android5.4以上
    参数有10种type
    参数:{"button":[
    {
    "type":"click",
    "name":"歌曲",
    "key":"V1001_TODAY_MUSIC" //key在哪获取?
    },
    {
    "name":"菜单",
    "sub_button":
    [
    "type":"view""url":"http://www.123.com/view.html",
    "name":"展示"
    ]
    }
    ]}
    返回结果JSON:{"errorcode":0,"errmsg":"ok"}
    5.自动回复
    (在开发文档的发送消息-获取自动回复规则)
    https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=ACCESS_TOKEN
    {
    "is_add_friend_reply_open":1,
    "is_autoreply_open":1,
    "add_friend_autoreply_info": 
    {
    "type":"text",
    "content":"关注回复消息"
    }
    "message_default_autoreplry_info":
    {
    "type":"text",
    "content":"默认回复消息"
    }
    }
    6.关键字回复
    (和第5的接口是一样的,只是更改了参数)
    {
    "keyword_autoreplry_info":
    {
    "list"://清单
    [
    { 
    "rule_name": "autoreply-news", 
    "create_time": 1423028166, 
    "reply_mode": "reply_all", 
    "keyword_list_info": 
    [ 
    { 
    "type": "text", 
    "match_mode": "contain", 
    "content": "news测试"//此处content即为关键词内容
    }
    ], 
    "reply_list_info": 
    [ 
    { 
    "type": "news", 
    "news_info": 
    { 
    "list": 
    [ 
    { 
    "title": "it's news", 
    "author": "jim", 
    "digest": "it's digest", 
    "show_cover": 1, 
    "cover_url": "http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKbE8sWdt2DDcL0dMfQWJWTVn1N8DxI0gcRmrtqBOuwQHeuPKmFLK0ZQ/0", 
    "content_url": "http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=203929886&idx=1&sn=628f964cf0c6d84c026881b6959aea8b#rd", 
    "source_url": "http://www.url.com"
    }
    ]
    }
    }
    ]
    },
    {
    //这里继续加关键字回复信息...
    }
    ]    
    }
    }
    7.运营图表
    (使用HighChats图表控件生成,生成H5的svg线性图表,将配置和数据写好)
    7-1.用户图表
    用户增减数据(限7天):https://api.weixin.qq.com/datacube/getusersummary?access_token=ACCESS_TOKEN
    用户累计数据(限7天):https://api.weixin.qq.com/datacube/getusercumulate?access_token=ACCESS_TOKEN
    参数:
    {
    "access_token":"",
    "begin_date":"2017-02-14",
    "end_date":"2017-02-14"
    }
    结果:
    {
    "list":
    [
    {
    //参数可以有(非全部)
    "ref_date":"2017-02-14",//数据的日期
    "user_source":0,//用户来源渠道
    "new_user":123,//新增用户量
    "cancel_user":321,//取消关注用户量
    "cumulate_user":1000//总用户量
    }
    ]
    }
    7-2.消息图表
    类似用户图表,有7种:概况数据、分时数据、周数据、月数据、分布数据、分布周数据、分布月数据(接口详细见文档)
    (每周最大时间跨度都不一样)
    
    参数:
    {
    "access_token":"",
    "begin_date":"2017-02-14",
    "end_date":"2017-02-14"
    }
    结果:有7种,详细见文档
    7-3.内容分享分析(图文分享统计)
    类似用户图表,有2种:
    分享数据https://api.weixin.qq.com/datacube/getusershare?access_token=ACCESS_TOKEN
    分时分享数据:https://api.weixin.qq.com/datacube/getusersharehour?access_token=ACCESS_TOKEN
    
    7-4.浏览分析(图文统计)
    类似用户图表,有4种:
    
    8.粉丝管理
    https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
    NEXT_OPENID为OPENID的开始位置(类似分页)
    
    9.粉丝分组
    (选择公众号,显示分组信息,做增删改,同步数据)
    查:https://api.weixin.qq.com/cgi-bin/groups/get?access_token=ACCESS_TOKEN
    改:https://api.weixin.qq.com/cgi-bin/groups/update?access_token=ACCESS_TOKEN
    删:https://api.weixin.qq.com/cgi-bin/groups/delete?access_token=ACCESS_TOKEN
    增:https://api.weixin.qq.com/cgi-bin/groups/create?access_token=ACCESS_TOKEN
    参数
    {"group":{"id":108,"name":"test"}}
    结果
    {
    "group": {
    "id": 107, 
    "name": "test"
    }
    }
    
    
    9-1.分组里用户操作:
    搜索用户:https://api.weixin.qq.com/cgi-bin/groups/getid?access_token=ACCESS_TOKEN
    移动用户:https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=ACCESS_TOKEN
    批量移动用户:https://api.weixin.qq.com/cgi-bin/groups/members/batchupdate?access_token=ACCESS_TOKEN
    
    
    10.消息处理
    公众号用户发送时,微信会同时发一份XML格式的信息给开发者URL,开发者再保存进数据库。
    
     
    
     
    
     
  • 相关阅读:
    VC2005从开发MFC ActiveX ocx控件到发布到.net网站的全部过程
    【Demo 0025】注册/反注册窗体类RegisterClassEx/UnregisterClass
    《白手起家Win32SDK应用程序》(完整版+目录)
    关于初始化C++类成员
    TCP和UDP的"保护消息边界" (经典)
    (经典)tcp粘包分析
    解决TCP网络传输“粘包”问题
    无锁队列
    MFC全局函数开局——AfxGetApp解剖
    Tomcat系列之服务器的安装与配置以及各组件详解
  • 原文地址:https://www.cnblogs.com/laokchen/p/13306150.html
Copyright © 2011-2022 走看看