You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
974 B
32 lines
974 B
package com.hfkj.config;
|
|
|
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
|
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
@Configuration
|
|
public class WxMaConfig {
|
|
|
|
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(CommonSysConst.getSysConfig().getWechatMaAppid());
|
|
config.setSecret(CommonSysConst.getSysConfig().getWechatMaSecret());
|
|
maService = new WxMaServiceImpl();
|
|
maService.setWxMaConfig(config);
|
|
}
|
|
|
|
}
|
|
|