|
|
@ -15,10 +15,7 @@ import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.security.*; |
|
|
|
import com.hai.common.security.*; |
|
|
|
import com.hai.common.utils.HttpsUtils; |
|
|
|
import com.hai.common.utils.*; |
|
|
|
import com.hai.common.utils.IDGenerator; |
|
|
|
|
|
|
|
import com.hai.common.utils.RedisUtil; |
|
|
|
|
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
|
|
|
|
import com.hai.entity.HighUser; |
|
|
|
import com.hai.entity.HighUser; |
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
@ -371,4 +368,37 @@ public class WechatController { |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/verifyWx", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "微信签名") |
|
|
|
|
|
|
|
public ResponseData verifyWx(@RequestParam(value = "url", required = true) String url) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
|
|
|
|
params.put("appid", SysConst.getSysConfig().getWxH5AppId()); |
|
|
|
|
|
|
|
params.put("secret", SysConst.getSysConfig().getWxH5AppSecret()); |
|
|
|
|
|
|
|
params.put("grant_type", "client_credential"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
map.put("noncestr",WxUtils.makeNonStr()); |
|
|
|
|
|
|
|
map.put("jsapi_ticket",accessTokenObject.getString("ticket")); |
|
|
|
|
|
|
|
map.put("timestamp", new Date().getTime()); |
|
|
|
|
|
|
|
map.put("url",url); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> objectMap = new HashMap<>(); |
|
|
|
|
|
|
|
objectMap.put("appId" , params.get("appId")); |
|
|
|
|
|
|
|
objectMap.put("timestamp" , map.get("timestamp")); |
|
|
|
|
|
|
|
objectMap.put("nonceStr" , map.get("nonceStr")); |
|
|
|
|
|
|
|
objectMap.put("signature" , WxUtils.getSHA1(map)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(objectMap); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|