Crates.io | spring-sms |
lib.rs | spring-sms |
version | 0.1.2 |
source | src |
created_at | 2024-11-05 07:31:40.675247 |
updated_at | 2024-11-05 07:31:40.675247 |
description | 基于spring-rs 0.2.1 版,简单实现了短信发送功能,未来将完善,目前只支持阿里云短信发送 |
homepage | |
repository | https://gitea.1000duo.cn/qianduo/spring-sms.git |
max_upload_size | |
id | 1436180 |
size | 11,818 |
基于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)
}
}