package org.jeecg.modules.shop.captcha.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;

@Configuration
public class SmsClientConfig {

    @Value("${aliyun.sms.ak}")
    private String accessKey;

    @Value("${aliyun.sms.sk}")
    private String secretKey;
    
    @Bean
    public Client getSmsClient() throws Exception {
        Config config = new Config()
                .setAccessKeyId(accessKey)
                .setAccessKeySecret(secretKey)
                .setEndpoint("dysmsapi.aliyuncs.com");
        return new Client(config);
    }
    
}
