spring-sms

Crates.iospring-sms
lib.rsspring-sms
version0.1.2
sourcesrc
created_at2024-11-05 07:31:40.675247
updated_at2024-11-05 07:31:40.675247
description基于spring-rs 0.2.1 版,简单实现了短信发送功能,未来将完善,目前只支持阿里云短信发送
homepage
repositoryhttps://gitea.1000duo.cn/qianduo/spring-sms.git
max_upload_size
id1436180
size11,818
尹旭 (yinxu46)

documentation

README

spring-sms

基于spring-rs 0.2.1 版,简单实现了短信发送功能,未来将完善,目前只支持阿里云短信发送。

#[cfg(test)]
mod tests {
    use std::collections::HashMap;
    use spring_sms::config::AliyunSmsConfig;

    #[tokio::test]
    async fn test() {
        assert_eq!(1, 1);
        let config = AliyunSmsConfig {
            access_key_id: "xxxxx".to_string(),
            access_key_secret: "xxxxxx".to_string(),
            sign_name: "短信签名".to_string(),
            domain: None,
            region_id: None,
            version: None,
        };
        let sms_config = spring_sms::config::SmsConfig {
            aliyun: Some(config),
        };
        let sms_client = spring_sms::client::SmsClient::new(sms_config);
        let mut params: HashMap<&str, &str> = HashMap::new();
        params.insert("code", "123456");
        let res = sms_client.send_sms_by_aliyun("13000000000", "SMS_10000000", Some(params)).await;
        println!("{:?}", res)
    }
}
Commit count: 0

cargo fmt