101captain
2022-02-22 c83cf9d2d82a0a29a15e38f4566eb470b9a3517b
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/config/WxMaConfiguration.java
@@ -1,14 +1,13 @@
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;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
@@ -23,7 +22,10 @@
    @Resource
    private WxMaProperties properties;
    public  WxMaService getMaService() {
    @Resource
    private WxH5Properties wxH5Properties;
    public WxMaService getMaService() {
        WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
        config.setAppid(properties.getAppid());
        config.setSecret(properties.getSecret());
@@ -32,4 +34,14 @@
        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;
    }
}