修改区域公司

dev-discount
袁野 2 years ago
parent eac9c4008a
commit daaef7efd5
  1. 38
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  2. 52
      v1/src/main/java/com/v1/controller/WxMsgController.java
  3. 26
      v1/src/main/resources/dev/application.yml

@ -15,10 +15,7 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.*;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.*;
import com.hai.entity.HighUser;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
@ -371,4 +368,37 @@ public class WechatController {
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;
}
}
}

@ -251,32 +251,32 @@ public class WxMsgController {
}
@RequestMapping(value = "/verifyWx", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "微信签名")
public String verifyWx() {
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","Wm3WZYTPz0wzccnW");
map.put("jsapi_ticket",accessTokenObject.getString("ticket"));
map.put("timestamp","1414587457");
map.put("url","http://mp.weixin.qq.com?params=value");
return WxUtils.getSHA1(map);
} catch (Exception e) {
return null;
}
}
// @RequestMapping(value = "/verifyWx", method = RequestMethod.GET)
// @ResponseBody
// @ApiOperation(value = "微信签名")
// public String verifyWx() {
//
// 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","Wm3WZYTPz0wzccnW");
// map.put("jsapi_ticket",accessTokenObject.getString("ticket"));
// map.put("timestamp","1414587457");
// map.put("url","http://mp.weixin.qq.com?params=value");
//
// return WxUtils.getSHA1(map);
// } catch (Exception e) {
// return null;
// }
//
// }
}

@ -53,6 +53,11 @@ spring:
#MQTT默认的消息推送主题,实际可在调用接口是指定
# default:
# topic: topic
rocketmq:
name-server: 139.159.177.244:9876
producer:
#必须指定group
group: default-group
#配置日期返回至前台为时间戳
jackson:
serialization:
@ -62,6 +67,27 @@ mybatis:
- classpath*:sqlmap*/*.xml
type-aliases-package:
org.springboot.sample.entity
jetcache:
statIntervalMinutes: 15
areaInCacheName: false
local:
default:
type: linkedhashmap
keyConvertor: fastjson
remote:
default:
type: redis
host: 139.159.177.244
port: 36379
password: HF123456.Redis
keyConvertor: fastjson
broadcastChannel: projectA
valueEncoder: java
valueDecoder: java
poolConfig:
minIdle: 5
maxIdle: 20
maxTotal: 50
pagehelper:
helperDialect: mysql

Loading…
Cancel
Save