|  |  | 
 |  |  | package com.doumee.core.wx; | 
 |  |  |  | 
 |  |  | import cn.binarywang.wx.miniapp.api.WxMaService; | 
 |  |  | import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; | 
 |  |  | import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; | 
 |  |  | import com.doumee.config.mybatis.SpringUtils; | 
 |  |  | import com.github.binarywang.wxpay.config.WxPayConfig; | 
 |  |  | import com.github.binarywang.wxpay.constant.WxPayConstants; | 
 |  |  | import com.github.binarywang.wxpay.service.WxPayService; | 
 |  |  | import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.context.annotation.Configuration; | 
 |  |  |  | 
 |  |  | import javax.annotation.PostConstruct; | 
 |  |  | //import cn.binarywang.wx.miniapp.api.WxMaService; | 
 |  |  | //import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; | 
 |  |  | //import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; | 
 |  |  | //import com.doumee.config.mybatis.SpringUtils; | 
 |  |  | //import com.github.binarywang.wxpay.config.WxPayConfig; | 
 |  |  | //import com.github.binarywang.wxpay.constant.WxPayConstants; | 
 |  |  | //import com.github.binarywang.wxpay.service.WxPayService; | 
 |  |  | //import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; | 
 |  |  | //import org.apache.commons.lang3.StringUtils; | 
 |  |  | //import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | //import org.springframework.context.annotation.Configuration; | 
 |  |  | // | 
 |  |  | //import javax.annotation.PostConstruct; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 微信小程序组件 | 
 |  |  |  */ | 
 |  |  | @Configuration | 
 |  |  | //@Configuration | 
 |  |  | public class WxMiniConfig { | 
 |  |  |     /********微信小程序服务**********/ | 
 |  |  |     public static WxMaService wxMaService; | 
 |  |  |     /********微信小程序支付**********/ | 
 |  |  |     public static WxPayService wxPayService; | 
 |  |  |     /********微信APP支付**********/ | 
 |  |  |     public static WxPayService wxAppPayService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private WxPayProperties wxPayProperties; | 
 |  |  |  | 
 |  |  |     public static WxMiniConfig me() { | 
 |  |  |         return SpringUtils.get().getBean(WxMiniConfig.class); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostConstruct | 
 |  |  |     void init() { | 
 |  |  |         this.load_WxMaService(); | 
 |  |  | //        this.load_wxPayService(); | 
 |  |  | //        this.load_wxAppPayService(); | 
 |  |  |     } | 
 |  |  |     /** | 
 |  |  |      * 初始化微信小程序 | 
 |  |  |      */ | 
 |  |  |     public void load_WxMaService() { | 
 |  |  |         WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); | 
 |  |  |         config.setAppid(StringUtils.trimToNull(wxPayProperties.getAppId())); | 
 |  |  |         config.setSecret(StringUtils.trimToNull(wxPayProperties.getAppSecret())); | 
 |  |  |         config.setMsgDataFormat("JSON"); | 
 |  |  |         //config.setToken(""); | 
 |  |  |         //config.setAesKey(""); | 
 |  |  |         WxMaService wxMaService = new WxMaServiceImpl(); | 
 |  |  |         wxMaService.setWxMaConfig(config); | 
 |  |  |         this.wxMaService = wxMaService; | 
 |  |  |     } | 
 |  |  | //    /********微信小程序服务**********/ | 
 |  |  | //    public static WxMaService wxMaService; | 
 |  |  | //    /********微信小程序支付**********/ | 
 |  |  | //    public static WxPayService wxPayService; | 
 |  |  | //    /********微信APP支付**********/ | 
 |  |  | //    public static WxPayService wxAppPayService; | 
 |  |  | // | 
 |  |  | // | 
 |  |  | //    @Autowired | 
 |  |  | //    private WxPayProperties wxPayProperties; | 
 |  |  | // | 
 |  |  | //    public static WxMiniConfig me() { | 
 |  |  | //        return SpringUtils.get().getBean(WxMiniConfig.class); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    @PostConstruct | 
 |  |  | //    void init() { | 
 |  |  | //        this.load_WxMaService(); | 
 |  |  | ////        this.load_wxPayService(); | 
 |  |  | ////        this.load_wxAppPayService(); | 
 |  |  | //    } | 
 |  |  | //    /** | 
 |  |  | //     * 初始化微信小程序 | 
 |  |  | //     */ | 
 |  |  | //    public void load_WxMaService() { | 
 |  |  | //        WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); | 
 |  |  | //        config.setAppid(StringUtils.trimToNull(wxPayProperties.getAppId())); | 
 |  |  | //        config.setSecret(StringUtils.trimToNull(wxPayProperties.getAppSecret())); | 
 |  |  | //        config.setMsgDataFormat("JSON"); | 
 |  |  | //        //config.setToken(""); | 
 |  |  | //        //config.setAesKey(""); | 
 |  |  | //        WxMaService wxMaService = new WxMaServiceImpl(); | 
 |  |  | //        wxMaService.setWxMaConfig(config); | 
 |  |  | //        this.wxMaService = wxMaService; | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 初始化微信小程序支付 |