Skip to main content

ncm_api_rs/api/
rebind.rs

1use super::Query;
2use crate::error::Result;
3/// 更换手机
4/// 对应 Node.js module/rebind.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 更换手机
10    /// 对应 /rebind
11    pub async fn rebind(&self, query: &Query) -> Result<ApiResponse> {
12        let data = json!({
13            "captcha": query.get("captcha").unwrap_or(""),
14            "phone": query.get("phone").unwrap_or(""),
15            "oldcaptcha": query.get("oldcaptcha").unwrap_or(""),
16            "ctcode": query.get_or("ctcode", "86")
17        });
18        self.request(
19            "/api/user/replaceCellphone",
20            data,
21            query.to_option(CryptoType::Weapi),
22        )
23        .await
24    }
25}