admin_config/
sms_config.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct SmsConfig {
5 pub provider: String,
7 pub app_id: String,
9 pub app_key: String,
11 pub sign_name: String,
13 pub template_id: String,
15 pub tencent: Option<TencentSmsConfig>,
17 pub aliyun: Option<AliyunSmsConfig>,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct TencentSmsConfig {
23 pub sdk_app_id: String,
25 pub secret_id: String,
27 pub secret_key: String,
29 pub region: String,
31}
32
33impl Default for TencentSmsConfig {
34 fn default() -> Self {
35 Self {
36 sdk_app_id: "".to_string(),
37 secret_id: "".to_string(),
38 secret_key: "".to_string(),
39 region: "ap-guangzhou".to_string(),
40 }
41 }
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
45pub struct AliyunSmsConfig {
46 pub access_key_id: String,
48 pub access_key_secret: String,
50 pub region: String,
52}
53
54impl Default for AliyunSmsConfig {
55 fn default() -> Self {
56 Self {
57 access_key_id: "".to_string(),
58 access_key_secret: "".to_string(),
59 region: "".to_string(),
60 }
61 }
62}
63
64impl Default for SmsConfig {
65 fn default() -> Self {
66 Self {
67 provider: "tencent".to_string(),
68 app_id: "".to_string(),
69 app_key: "".to_string(),
70 sign_name: "您的应用".to_string(),
71 template_id: "123456".to_string(),
72 tencent: Some(TencentSmsConfig::default()),
73 aliyun: Some(AliyunSmsConfig::default()),
74 }
75 }
76}