package org.enfi.config;

import com.jfinal.weixin.sdk.api.ApiConfig;
import com.jfinal.wxaapp.WxaConfig;
import net.dreamlu.weixin.config.WxConfigLoader;
import org.enfi.common.util.WxaQrcodeApiPlus;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.context.annotation.Configuration;

import java.util.Collections;
import java.util.List;

/**
 * @Description:
 * @ClassName: WXConfig
 * @Author: wanghao
 * @date: 2021.11.13 19:04
 * @version: 1.0
 */
@Configuration
public class WXConfig implements WxConfigLoader {
//    private static final String appId = "wx350f88bff9a92cbd";
//    private static final String appSecret = "cf82e5b190dc22f5f599ee9288b87fc8";
    private static final String appId = "wxc4ef577b568723ed";
    private static final String appSecret = "828337a4be4cabc1769e5bd6275349a6";

    public static String getAppId(){
        return appId;
    }
    public static String getAppSecret(){
        return appSecret;
    }


    @Override
    public List<ApiConfig> loadWx() {
        // 公众号
        ApiConfig wxConf = new ApiConfig();
        wxConf.setAppId(appId);
        wxConf.setAppSecret(appSecret);
        //wxConf.setToken("123456");
        return Collections.singletonList(wxConf);
    }

    @Override
    public List<WxaConfig> loadWxa() {
        WxaQrcodeApiPlus.setEnv(WxaQrcodeApiPlus.Env.trial);// 正式版使用 release，开发版使用 trial
        WxaConfig wxaConfig = new WxaConfig();
        wxaConfig.setAppId(appId);
        wxaConfig.setAppSecret(appSecret);
        // 小程序
        return Collections.singletonList(wxaConfig);
    }


}
