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§
fn access_token(&mut self) -> Result<JsonValue, String>
Provided Methods§
Sourcefn get_phone_number(
&mut self,
iv: &str,
_encrypted_data: &str,
_session_key: &str,
) -> Result<JsonValue, String>
fn get_phone_number( &mut self, iv: &str, _encrypted_data: &str, _session_key: &str, ) -> Result<JsonValue, String>
小程序获取手机号
Sourcefn send_message(
&mut self,
template_id: &str,
page: &str,
touser: &str,
_data: JsonValue,
_miniprogram_state: &str,
_lang: &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>
发送订阅消息
- template_id 模版ID
- page 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数
- touser 接收者(用户)的 openid
- data 模板内容,格式形如{ “phrase3”: { “value”: “审核通过” }, “name1”: { “value”: “订阅” }, “date2”: { “value”: “2019-12-25 09:42” } }