package com.jeeplus.weChat.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author 王强
 * @version 1.0
 * @date 2024-07-15 17:07
 */
@Data
@Component
//从配置文件里获取
@ConfigurationProperties(prefix = "wechat")
public class WechatAccountConfig {

    /**
     * 公众平台id
     */
    private String mpAppId;

    /**
     * 公众平台密钥
     */
    private String mpAppSecret;

    /**
     * 微信模版id
     */
    private Map<String, String> templateId;

    //appID
    public static String appID;
    //appsecret
    public static String appsecret;
    //获取access_token的url
    public static String accesstokenURL;

    @Value("${wechat.mpAppId}")
    public void setAppID(String appID) {
        WechatAccountConfig.appID = appID;
    }

    @Value("${wechat.mpAppSecret}")
    public void setAppsecret(String appsecret) {
        WechatAccountConfig.appsecret = appsecret;
    }

    @Value("${wechat.accesstokenURL}")
    public void setAccesstokenURL(String accesstokenURL) {
        WechatAccountConfig.accesstokenURL = accesstokenURL;
    }
}
