WechatMethod

Trait WechatMethod 

Source
pub trait WechatMethod {
    // Required methods
    fn access_token(&mut self) -> Result<JsonValue, String>;
    fn check(&mut self) -> Result<bool, String>;
    fn login(&mut self, code: &str) -> Result<JsonValue, String>;

    // Provided methods
    fn code2_session(&mut self, code: &str) -> Result<JsonValue, String> { ... }
    fn get_phone_number(
        &mut self,
        iv: &str,
        _encrypted_data: &str,
        _session_key: &str,
    ) -> Result<JsonValue, String> { ... }
    fn getuserinfo(&mut self, code: &str) -> Result<JsonValue, String> { ... }
    fn jsapi_ticket(&mut self, url: &str) -> Result<JsonValue, String> { ... }
    fn send_message(
        &mut self,
        template_id: &str,
        page: &str,
        touser: &str,
        _data: JsonValue,
        _miniprogram_state: &str,
        _lang: &str,
    ) -> Result<JsonValue, String> { ... }
}

Required Methods§

Source

fn access_token(&mut self) -> Result<JsonValue, String>

Source

fn check(&mut self) -> Result<bool, String>

服务状态检测

Source

fn login(&mut self, code: &str) -> Result<JsonValue, String>

登录

Provided Methods§

Source

fn code2_session(&mut self, code: &str) -> Result<JsonValue, String>

小程序登录

Source

fn get_phone_number( &mut self, iv: &str, _encrypted_data: &str, _session_key: &str, ) -> Result<JsonValue, String>

小程序获取手机号

Source

fn getuserinfo(&mut self, code: &str) -> Result<JsonValue, String>

code 获取用户信息 企业微信只能拿到userid

Source

fn jsapi_ticket(&mut self, url: &str) -> Result<JsonValue, String>

公众号JS接口的临时票据

Source

fn send_message( &mut self, template_id: &str, page: &str, touser: &str, _data: JsonValue, _miniprogram_state: &str, _lang: &str, ) -> Result<JsonValue, String>

发送订阅消息

  • template_id 模版ID
  • page 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数
  • touser 接收者(用户)的 openid
  • data 模板内容,格式形如{ “phrase3”: { “value”: “审核通过” }, “name1”: { “value”: “订阅” }, “date2”: { “value”: “2019-12-25 09:42” } }

Implementors§