Skip to main content

ncm_api_rs/api/
captcha_sent.rs

1use super::Query;
2use crate::error::Result;
3/// 发送验证码
4/// 对应 Node.js module/captcha_sent.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 发送验证码
10    /// 对应 /captcha/sent
11    pub async fn captcha_sent(&self, query: &Query) -> Result<ApiResponse> {
12        let data = json!({
13            "ctcode": query.get_or("ctcode", "86"),
14            "secrete": "music_middleuser_pclogin",
15            "cellphone": query.get("phone").unwrap_or("")
16        });
17        self.request(
18            "/api/sms/captcha/sent",
19            data,
20            query.to_option(CryptoType::Weapi),
21        )
22        .await
23    }
24}