package org.fouram.core.plugin.weixin.cp.core;

import org.fouram.core.util.ConfConfig;

import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.api.impl.WxCpOAuth2ServiceImpl;
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;

/**
 * 企业微信工具类
 *
 * @author Liup
 */
public class WXCpMailList {


	public static final WxCpService service = new WxCpServiceImpl();
	public static final WxCpOAuth2Service oauth2Service;
	static {
		WxCpDefaultConfigImpl configStorage = new WxCpDefaultConfigImpl();
		configStorage.setCorpId(ConfConfig.getConfigString("wxCp.corpId"));
		configStorage.setCorpSecret(ConfConfig.getConfigString("wxCp.mailList.corpSecret"));
		// 初始化基础service
		service.setWxCpConfigStorage(configStorage);
		// 初始化用户service
		oauth2Service = new WxCpOAuth2ServiceImpl(service);
	}
}
