package com.atguigu.yygh.msm.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;

import org.springframework.stereotype.Component;


/**
* 腾讯云短信服务参数的常量类
*/
@Component
public class Constants implements InitializingBean {

   //腾讯云账户密钥对: SecretID
   @Value("${tencentcloud.sms.SecretID}")
   private  String SecretID;

   //腾讯云账户密钥对: SecretKey
   @Value("${tencentcloud.sms.SecretKey}")
   private  String SecretKey;

   //SdkAppid
   @Value("${tencentcloud.sms.SdkAppid}")
   private  String SdkAppid;

   //signName :签名
   @Value("${tencentcloud.sms.signName}")
   private  String signName;

   //短信模板id:
   @Value("${tencentcloud.sms.templateId}")
   private  String templateId;

   private  String voicode="";

   public static String SECRET_ID;
   public static String SECRET_KEY;
   public static String SDK_APP_ID;
   public static String SIGN_NAME;
   public static String TEMPLATE_ID;

   @Override
   public void afterPropertiesSet() throws Exception {
      SECRET_ID=SecretID;
      SECRET_KEY=SecretKey;
      SDK_APP_ID=SdkAppid;
      //解决读取中文乱码的问题
      SIGN_NAME=new String(signName.getBytes("iso8859-1"),"UTF-8");
      TEMPLATE_ID=templateId;
   }
}

