|
@@ -1,64 +1,64 @@
|
|
|
-package com.diagbot.web;
|
|
|
-
|
|
|
-import com.diagbot.dto.RespDTO;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import me.chanjar.weixin.common.bean.WxJsapiSignature;
|
|
|
-import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
-import me.chanjar.weixin.mp.api.WxMpService;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-import springfox.documentation.annotations.ApiIgnore;
|
|
|
-
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-
|
|
|
-/**
|
|
|
- * @Description:
|
|
|
- * @author: gaodm
|
|
|
- * @time: 2020/2/5 18:03
|
|
|
- */
|
|
|
-@AllArgsConstructor
|
|
|
-@RestController
|
|
|
-@Api(value = "微信验证", tags = { "微信验证API" })
|
|
|
-@SuppressWarnings("unchecked")
|
|
|
-@Slf4j
|
|
|
-@ApiIgnore
|
|
|
-@Deprecated
|
|
|
-@RequestMapping("jssdk/{appid}")
|
|
|
-public class WeXinJsSdkController {
|
|
|
-
|
|
|
- private final WxMpService wxMpService;
|
|
|
-
|
|
|
- @RequestMapping(value = "/config", method = RequestMethod.GET)
|
|
|
- public RespDTO<WxJsapiSignature> wxJsSdkConfig(HttpServletRequest request, @PathVariable String appid, String url) {
|
|
|
- if (!this.wxMpService.switchover(appid)) {
|
|
|
- throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
|
|
|
- }
|
|
|
-
|
|
|
- try { // 直接调用wxMpServer 接口
|
|
|
- WxJsapiSignature wxJsapiSignature = wxMpService.createJsapiSignature(url);
|
|
|
- log.info("createJsapiSignature被调用了~~~");
|
|
|
- return RespDTO.onSuc(wxJsapiSignature);
|
|
|
- } catch (WxErrorException e) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/ticket", method = RequestMethod.GET)
|
|
|
- public RespDTO<String> wxjsapiTicket(HttpServletRequest request, @PathVariable String appid) {
|
|
|
- if (!this.wxMpService.switchover(appid)) {
|
|
|
- throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
|
|
|
- }
|
|
|
-
|
|
|
- try { // 直接调用wxMpServer 接口
|
|
|
- String jsapiTicket = wxMpService.getJsapiTicket();
|
|
|
- return RespDTO.onSuc(jsapiTicket);
|
|
|
- } catch (WxErrorException e) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+//package com.diagbot.web;
|
|
|
+//
|
|
|
+//import com.diagbot.dto.RespDTO;
|
|
|
+//import io.swagger.annotations.Api;
|
|
|
+//import lombok.AllArgsConstructor;
|
|
|
+//import lombok.extern.slf4j.Slf4j;
|
|
|
+//import me.chanjar.weixin.common.bean.WxJsapiSignature;
|
|
|
+//import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
+//import me.chanjar.weixin.mp.api.WxMpService;
|
|
|
+//import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+//import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+//import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+//import org.springframework.web.bind.annotation.RestController;
|
|
|
+//import springfox.documentation.annotations.ApiIgnore;
|
|
|
+//
|
|
|
+//import javax.servlet.http.HttpServletRequest;
|
|
|
+//
|
|
|
+///**
|
|
|
+// * @Description:
|
|
|
+// * @author: gaodm
|
|
|
+// * @time: 2020/2/5 18:03
|
|
|
+// */
|
|
|
+//@AllArgsConstructor
|
|
|
+//@RestController
|
|
|
+//@Api(value = "微信验证", tags = { "微信验证API" })
|
|
|
+//@SuppressWarnings("unchecked")
|
|
|
+//@Slf4j
|
|
|
+//@ApiIgnore
|
|
|
+//@Deprecated
|
|
|
+//@RequestMapping("jssdk/{appid}")
|
|
|
+//public class WeXinJsSdkController {
|
|
|
+//
|
|
|
+// private final WxMpService wxMpService;
|
|
|
+//
|
|
|
+// @RequestMapping(value = "/config", method = RequestMethod.GET)
|
|
|
+// public RespDTO<WxJsapiSignature> wxJsSdkConfig(HttpServletRequest request, @PathVariable String appid, String url) {
|
|
|
+// if (!this.wxMpService.switchover(appid)) {
|
|
|
+// throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
|
|
|
+// }
|
|
|
+//
|
|
|
+// try { // 直接调用wxMpServer 接口
|
|
|
+// WxJsapiSignature wxJsapiSignature = wxMpService.createJsapiSignature(url);
|
|
|
+// log.info("createJsapiSignature被调用了~~~");
|
|
|
+// return RespDTO.onSuc(wxJsapiSignature);
|
|
|
+// } catch (WxErrorException e) {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// @RequestMapping(value = "/ticket", method = RequestMethod.GET)
|
|
|
+// public RespDTO<String> wxjsapiTicket(HttpServletRequest request, @PathVariable String appid) {
|
|
|
+// if (!this.wxMpService.switchover(appid)) {
|
|
|
+// throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
|
|
|
+// }
|
|
|
+//
|
|
|
+// try { // 直接调用wxMpServer 接口
|
|
|
+// String jsapiTicket = wxMpService.getJsapiTicket();
|
|
|
+// return RespDTO.onSuc(jsapiTicket);
|
|
|
+// } catch (WxErrorException e) {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//}
|