package com.panzhihua.applets.config;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Component;
|
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
import lombok.extern.slf4j.Slf4j;
|
|
/**
|
* @program: springcloud_k8s_panzhihuazhihuishequ
|
* @description: wexin
|
* @author: huang.hongfa weixin hhf9596 qq 959656820
|
* @create: 2020-11-23 15:07
|
**/
|
@Slf4j
|
@Component
|
public class WxMaConfiguration {
|
|
@Resource
|
private WxMaProperties properties;
|
|
@Resource
|
private WxH5Properties wxH5Properties;
|
|
@Resource
|
private WxMaRHProperties wxMaRHProperties;
|
|
public WxMaService getMaService() {
|
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
config.setAppid(properties.getAppid());
|
config.setSecret(properties.getSecret());
|
config.setMsgDataFormat(properties.getMsgDataFormat());
|
WxMaService wxMaService = new WxMaServiceImpl();
|
wxMaService.setWxMaConfig(config);
|
return wxMaService;
|
}
|
|
public WxMaService getMaH5Service() {
|
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
config.setAppid(wxH5Properties.getAppid());
|
config.setSecret(wxH5Properties.getSecret());
|
config.setMsgDataFormat(wxH5Properties.getMsgDataFormat());
|
WxMaService wxMaService = new WxMaServiceImpl();
|
wxMaService.setWxMaConfig(config);
|
return wxMaService;
|
}
|
|
public WxMaService getMaRhService() {
|
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
config.setAppid(wxMaRHProperties.getAppid());
|
config.setSecret(wxMaRHProperties.getSecret());
|
config.setMsgDataFormat(wxMaRHProperties.getMsgDataFormat());
|
WxMaService wxMaService = new WxMaServiceImpl();
|
wxMaService.setWxMaConfig(config);
|
return wxMaService;
|
}
|
}
|