package com.order.config;

import cn.binarywang.wx.miniapp.api.WxMaService;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class WxMaConfiguration {

    private static WxMaService maService;

    public static WxMaService getMaService() {
        if (maService == null) {
            throw new IllegalArgumentException(String.format("未找到对应的配置，请核实！"));
        }

        return maService;
    }

    @PostConstruct
    public void init() {
        /*WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
        config.setAppid(SysConst.getSysConfig().getWxAppId());
        config.setSecret(SysConst.getSysConfig().getWxAppSecret());

        maService = new WxMaServiceImpl();
        maService.setWxMaConfig(config);*/
    }

}
