feat(auth): 小程序登录采集微信昵称
This commit is contained in:
@@ -228,6 +228,8 @@ pub struct WechatBindPhoneRequest {
|
||||
pub code: Option<String>,
|
||||
#[serde(default)]
|
||||
pub wechat_phone_code: Option<String>,
|
||||
#[serde(default)]
|
||||
pub display_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
@@ -241,6 +243,8 @@ pub struct WechatBindPhoneResponse {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WechatMiniProgramLoginRequest {
|
||||
pub code: String,
|
||||
#[serde(default)]
|
||||
pub display_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
@@ -354,6 +358,7 @@ mod tests {
|
||||
phone: None,
|
||||
code: None,
|
||||
wechat_phone_code: Some("wx-phone-code-001".to_string()),
|
||||
display_name: Some("陶泥儿玩家".to_string()),
|
||||
})
|
||||
.expect("payload should serialize");
|
||||
|
||||
@@ -362,7 +367,25 @@ mod tests {
|
||||
json!({
|
||||
"phone": null,
|
||||
"code": null,
|
||||
"wechatPhoneCode": "wx-phone-code-001"
|
||||
"wechatPhoneCode": "wx-phone-code-001",
|
||||
"displayName": "陶泥儿玩家"
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wechat_mini_program_login_request_accepts_native_nickname() {
|
||||
let payload = serde_json::to_value(WechatMiniProgramLoginRequest {
|
||||
code: "wx-mini-code-001".to_string(),
|
||||
display_name: Some("陶泥儿玩家".to_string()),
|
||||
})
|
||||
.expect("payload should serialize");
|
||||
|
||||
assert_eq!(
|
||||
payload,
|
||||
json!({
|
||||
"code": "wx-mini-code-001",
|
||||
"displayName": "陶泥儿玩家"
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user