|  | @ -1,14 +1,18 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.patient.endpoint.wechat;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.sun.net.httpserver.Authenticator;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.JsApiTicket;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.WxWechatDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.patient.PatientRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.service.WechatInfoService;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.service.WxAccessTokenService;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.service.WxUrlConfigService;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  | import org.json.JSONObject;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
	
		
			
				|  | @ -17,6 +21,7 @@ import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestMethod;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.ResponseBody;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.security.MessageDigest;
 | 
	
	
		
			
				|  | @ -40,15 +45,29 @@ public class WechatInfoEndPoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |     private WechatInfoService wechatInfoService;
 | 
	
		
			
				|  |  |     @Value("${wechat.id}")
 | 
	
		
			
				|  |  |     private String wxId;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WxUrlConfigService wxUrlConfigService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value =  PatientRequestMapping.Wechat.getWxWechatConfig, method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     public ObjEnvelop<Map<String,Object>> getWxWechatConfig(@ApiParam(name = "url", value = "域名地址")
 | 
	
		
			
				|  |  |                                                                 @RequestParam(value = "url", required = true)String url){
 | 
	
		
			
				|  |  |         return success(PatientRequestMapping.Wechat.api_success,wxUrlConfigService.getWxWechatConfig(url));
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取签名signature
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param pageUrl 需要签名的页面全地址(?后的也需要除了#后的不需要)
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @RequestMapping(value = "getSign", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @RequestMapping(value = PatientRequestMapping.Wechat.getSign, method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     public Envelop getSign(String pageUrl,String wxId) {
 | 
	
		
			
				|  |  |     public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
 | 
	
		
			
				|  |  |                            @RequestParam(value = "pageUrl", required = true)String pageUrl,
 | 
	
		
			
				|  |  |                            @ApiParam(name = "wxId", value = "微信id")
 | 
	
		
			
				|  |  |                            @RequestParam(value = "wxId", required = true)String wxId) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String ticket = getJsapi_ticketByToken(wxId);
 | 
	
		
			
				|  |  |             Map<Object, Object> map = new HashMap<Object, Object>();
 |