Skip to content

Commit

Permalink
Merge pull request #6 from wslongchen/develop
Browse files Browse the repository at this point in the history
feat(develop): Add some features
  • Loading branch information
wslongchen authored Aug 30, 2022
2 parents a926acd + 2f41ab7 commit a06ed76
Show file tree
Hide file tree
Showing 7 changed files with 1,921 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "labrador"
version = "0.1.7"
version = "0.1.8"
authors = ["mrpan <[email protected]>"]
edition = "2018"
description = "Labrador - Mini thirdpart client for rust."
Expand Down
802 changes: 802 additions & 0 deletions src/wechat/mp/api/card.rs

Large diffs are not rendered by default.

979 changes: 979 additions & 0 deletions src/wechat/mp/api/member.rs

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/wechat/mp/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ mod template_msg;
mod subscribe_msg;
mod wifi;
mod ocr;
mod member;
mod card;

pub use self::oauth2::*;
pub use self::qrcode::*;
Expand All @@ -19,5 +21,7 @@ pub use self::media::*;
pub use self::menu::*;
pub use self::wifi::*;
pub use self::ocr::*;
pub use self::member::*;
pub use self::card::*;


4 changes: 2 additions & 2 deletions src/wechat/mp/api/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<'a, T: SessionStore> WeChatMpWifi<'a, T> {

//----------------------------------------------------------------------------------------------------------------------------

#[derive(Debug, Clone, PartialEq, Eq,Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WechatMpWifiShopDataResponse {
/// 门店名称
pub shop_name: Option<String>,
Expand Down Expand Up @@ -106,7 +106,7 @@ pub struct WechatMpWifiShopDataResponse {
pub poi_id: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq,Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SsidPassword {
/// 无线网络设备的ssid
pub ssid: Option<String>,
Expand Down
2 changes: 2 additions & 0 deletions src/wechat/mp/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub static REFRESH_TOKEN: &str = "refresh_token";


pub static QR_SCENE: &str = "QR_SCENE";
pub static QR_CODE: &str = "QR_CODE";
pub static QR_LIMIT_SCENE: &str = "QR_LIMIT_SCENE";
pub static IMG_URL: &str = "img_url";

Expand All @@ -26,5 +27,6 @@ pub static TICKET_TYPE_JSAPI: &str = "jsapi";
pub static TICKET_TYPE: &str = "type";
pub static TICKET_TYPE_SDK: &str = "2";
pub static TICKET_TYPE_WXCARD: &str = "wx_card";
pub static MEMBER_CARD: &str = "MEMBER_CARD";


132 changes: 131 additions & 1 deletion src/wechat/mp/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ pub enum WechatMpMethod {
Ocr(MpOcrMethod),
/// wifi服务
Wifi(MpWifiMethod),
/// 会员卡服务
MemberCard(MpMemeberCardMethod),
/// 卡券服务
Card(MpCardMethod),
/// 用户服务
User(MpUserMethod),
/// 菜单服务
Expand Down Expand Up @@ -182,6 +186,130 @@ impl MpWifiMethod {



#[allow(unused)]
#[derive(Debug, PartialEq, Clone)]
pub enum MpMemeberCardMethod {
Create,
Activate,
GetUserInfo,
UpdateUser,
/// 会员卡激活之微信开卡接口(wx_activate=true情况调用).
ActivateSetUser,
/// 获取会员卡开卡插件参数
ActivateGetUrl,
/// 会员卡信息更新
Update,
/// 跳转型会员卡开卡字段.
/// 获取用户提交资料(wx_activate=true情况调用),开发者根据activate_ticket获取到用户填写的信息
GetActivateTempInfo,
}

#[allow(unused)]
impl MpMemeberCardMethod {
pub fn get_method(&self) -> String {
match *self {
MpMemeberCardMethod::Create => String::from("/card/create"),
MpMemeberCardMethod::Activate => String::from("/card/membercard/activate"),
MpMemeberCardMethod::GetUserInfo => String::from("/card/membercard/userinfo/get"),
MpMemeberCardMethod::UpdateUser => String::from("/card/membercard/updateuser"),
MpMemeberCardMethod::ActivateSetUser => String::from("/card/membercard/activateuserform/set"),
MpMemeberCardMethod::ActivateSetUser => String::from("/card/membercard/activateuserform/set"),
MpMemeberCardMethod::ActivateGetUrl => String::from("/card/membercard/activate/geturl"),
MpMemeberCardMethod::Update => String::from("/card/update"),
MpMemeberCardMethod::GetActivateTempInfo => String::from("/card/membercard/activatetempinfo/get"),
}
}
}





#[allow(unused)]
#[derive(Debug, PartialEq, Clone)]
pub enum MpCardMethod {
Create,
Get,
Update,
CodeDecrypt,
CodeGet,
CodeMark,
SetWhiteList,
CreateQrcode,
CodeConsume,
CreateLandingpage,
/// 将用户的卡券设置为失效状态
UnavailabeCode,
Delete,
/// 导入code接口
CodeDeposit,
/// 查询导入code数目接口
GetDepositCount,
/// 核查code接口
CheckCode,
/// 图文消息群发卡券
GetHtml,
/// 修改库存接口
ModifyStock,
/// 更改Code接口
UpdateCode,
/// 设置买单接口
SetPayCell,
/// 设置自助核销接口
SetSelfConsumerCell,
/// 获取用户已领取卡券接口
GetUserCardList,
/// 创建子商户
SubmitSubmerchant,
/// 卡券开放类目查询接口
GetApplyProtocol,
/// 修改子商户
UpdateSubmerchant,
/// 拉取单个子商户信息接口
GetSubmerchant,
/// 批量拉取子商户信息接口
BatchGetSubmerchant,
}

#[allow(unused)]
impl MpCardMethod {
pub fn get_method(&self) -> String {
match *self {
MpCardMethod::Create => String::from("/card/create"),
MpCardMethod::Get => String::from("/card/get"),
MpCardMethod::Update => String::from("/card/update"),
MpCardMethod::CodeDecrypt => String::from("/card/code/decrypt"),
MpCardMethod::CodeGet => String::from("/card/code/get"),
MpCardMethod::CodeConsume => String::from("/card/code/consume"),
MpCardMethod::CodeMark => String::from("/card/code/mark"),
MpCardMethod::SetWhiteList => String::from("/card/testwhitelist/set"),
MpCardMethod::CreateQrcode => String::from("/card/qrcode/create"),
MpCardMethod::CreateLandingpage => String::from("/card/landingpage/create"),
MpCardMethod::UnavailabeCode => String::from("/card/code/unavailable"),
MpCardMethod::Delete => String::from("/card/delete"),
MpCardMethod::CodeDeposit => String::from("/card/code/deposit"),
MpCardMethod::GetDepositCount => String::from("/card/code/getdepositcount"),
MpCardMethod::CheckCode => String::from("/card/code/checkcode"),
MpCardMethod::GetHtml => String::from("/card/mpnews/gethtml"),
MpCardMethod::ModifyStock => String::from("/card/modifystock"),
MpCardMethod::UpdateCode => String::from("/card/code/update"),
MpCardMethod::SetPayCell => String::from("/card/paycell/set"),
MpCardMethod::SetSelfConsumerCell => String::from("/card/selfconsumecell/set"),
MpCardMethod::GetUserCardList => String::from("/card/user/getcardlist"),
MpCardMethod::SubmitSubmerchant => String::from("/card/submerchant/submit"),
MpCardMethod::UpdateSubmerchant => String::from("/card/submerchant/update"),
MpCardMethod::GetApplyProtocol => String::from("/card/getapplyprotocol"),
MpCardMethod::GetSubmerchant => String::from("/card/submerchant/get"),
MpCardMethod::BatchGetSubmerchant => String::from("/card/submerchant/batchget"),
MpCardMethod::BatchGetSubmerchant => String::from("/card/submerchant/batchget"),
}
}
}






#[allow(unused)]
#[derive(Debug, PartialEq, Clone)]
Expand Down Expand Up @@ -267,13 +395,15 @@ impl RequestMethod for WechatMpMethod {
WechatMpMethod::CustomService(v) => v.get_method(),
WechatMpMethod::User(v) => v.get_method(),
WechatMpMethod::Menu(v) => v.get_method(),
WechatMpMethod::MemberCard(v) => v.get_method(),
WechatMpMethod::Wifi(v) => v.get_method(),
WechatMpMethod::TemplateMessage(v) => v.get_method(),
WechatMpMethod::QrCode(v) => v.get_method(),
WechatMpMethod::Media(v) => v.get_method(),
WechatMpMethod::Custom(v) => v.to_string(),
WechatMpMethod::SubscribeMessage(v) => v.get_method(),
WechatMpMethod::Ocr(v) => v.get_method()
WechatMpMethod::Ocr(v) => v.get_method(),
WechatMpMethod::Card(v) => v.get_method(),
}
}
}
Expand Down

0 comments on commit a06ed76

Please sign in to comment.