master
			
			
		
		
							parent
							
								
									aa8ab5eb2e
								
							
						
					
					
						commit
						664349439d
					
				@ -0,0 +1,40 @@ | 
				
			|||||||
 | 
					package com.zbkj.admin.config; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.aliyun.dysmsapi20170525.Client; | 
				
			||||||
 | 
					import com.aliyun.teaopenapi.models.Config; | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Value; | 
				
			||||||
 | 
					import org.springframework.context.annotation.Bean; | 
				
			||||||
 | 
					import org.springframework.context.annotation.Configuration; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * @author admin2 | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Configuration | 
				
			||||||
 | 
					public class SmsConfig { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Value("${sms.appkey}") | 
				
			||||||
 | 
					    private String accessKeyId ; | 
				
			||||||
 | 
					    @Value("${sms.secret}") | 
				
			||||||
 | 
					    private String accessKeySecret  ; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final String ENDPOINT = "dysmsapi.aliyuncs.com"; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Bean | 
				
			||||||
 | 
					    public Client smsClient() { | 
				
			||||||
 | 
					        try { | 
				
			||||||
 | 
					            Config config = new Config() | 
				
			||||||
 | 
					                    // 必填,您的 AccessKey ID
 | 
				
			||||||
 | 
					                    .setAccessKeyId(accessKeyId) | 
				
			||||||
 | 
					                    // 必填,您的 AccessKey Secret
 | 
				
			||||||
 | 
					                    .setAccessKeySecret(accessKeySecret); | 
				
			||||||
 | 
					            // 访问的域名
 | 
				
			||||||
 | 
					            config.endpoint = ENDPOINT; | 
				
			||||||
 | 
					            return new Client(config); | 
				
			||||||
 | 
					        } catch (Exception e) { | 
				
			||||||
 | 
					            throw new RuntimeException(e); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue