From 8ff6680c1f0b50a7986d99a64a9068b340df4899 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 30 Nov 2021 17:13:12 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/cweb/config/AuthConfig.java | 2 ++ .../cweb/controller/HighUserController.java | 31 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index 8d876b53..78cfb369 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -109,6 +109,8 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/user/login") .excludePathPatterns("/user/unionPhoneLogin") .excludePathPatterns("/user/getUnionId") + .excludePathPatterns("/highUser/setCacheParam") + .excludePathPatterns("/highUser/getCacheParam") .excludePathPatterns("/order/orderToH5Pay") .excludePathPatterns("/order/orderToPay") .excludePathPatterns("/test/*") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java index efb82c4f..7d3c9ee1 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -205,37 +205,38 @@ public class HighUserController { } } - @RequestMapping(value="/setUserParam",method = RequestMethod.GET) + @RequestMapping(value="/setCacheParam",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "设置用户参数") - public ResponseData setUserParam(@RequestParam(name = "param", required = true) String param,HttpServletRequest request) { + public ResponseData setCacheParam(@RequestBody JSONObject body) { try { - // 用户 - SessionObject sessionObject = userCenter.getSessionObject(request); - HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + if (body == null + || StringUtils.isBlank(body.getString("key")) + || StringUtils.isBlank(body.getString("value"))) { + log.error("HighUserController --> setUserPayPwd() error!", "请求参数校验失败"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } - redisUtil.hset("USER_PARAM", userInfoModel.getHighUser().getPhone(), param, 60*60*60); - return ResponseMsgUtil.success(redisUtil.hget("USER_PARAM", userInfoModel.getHighUser().getPhone())); + redisUtil.hset("PROVISIONAL_CACHE_PARAM", body.getString("key"), body.getString("value"), 60*5); + + return ResponseMsgUtil.success("设置成功"); } catch (Exception e) { - log.error("CommonController --> getDictionaryByCodeTypeAndValue() error!", e); + log.error("CommonController --> setCacheParam() error!", e); return ResponseMsgUtil.exception(e); } } - @RequestMapping(value="/getUserParam",method = RequestMethod.GET) + @RequestMapping(value="/getCacheParam",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取设置用户参数") - public ResponseData getUserParam(HttpServletRequest request) { + public ResponseData getCacheParam(@RequestParam(name = "key", required = true) String key) { try { - // 用户 - SessionObject sessionObject = userCenter.getSessionObject(request); - HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - return ResponseMsgUtil.success(redisUtil.hget("USER_PARAM", userInfoModel.getHighUser().getPhone())); + return ResponseMsgUtil.success(redisUtil.hget("PROVISIONAL_CACHE_PARAM", key)); } catch (Exception e) { - log.error("CommonController --> getDictionaryByCodeTypeAndValue() error!", e); + log.error("CommonController --> getCacheParam() error!", e); return ResponseMsgUtil.exception(e); } } From 839bd268d943d0b3e5ca634620fa9be672ff9fc7 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 30 Nov 2021 22:13:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cweb/controller/pay/OrderController.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index bd646610..acf446e5 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -127,6 +127,7 @@ public class OrderController { } JSONObject jsonObject = JSONObject.parseObject(reqBodyStr); Long orderId = jsonObject.getLong("orderId"); + Integer openIdType = jsonObject.getInteger("openIdType"); // openId类型 1:小程序 2:公众号 String orderScene = jsonObject.getString("orderScene"); // 订单类型 String openId = jsonObject.getString("openId"); // openId if ( orderId == null || StringUtils.isBlank(orderScene) || StringUtils.isBlank(openId)) { @@ -187,7 +188,11 @@ public class OrderController { WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo(); weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号 - weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId()); //商户号 + if (openIdType != null && openIdType.equals(2)) { + weChatPayReqInfo.setSub_appid("wxa075e8509802f826"); //商户号公众号 + } else { + weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId());//商户号 + } weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxSubMchId()); //子商户号 // weChatPayReqInfo.setOpenid(openId); @@ -204,7 +209,7 @@ public class OrderController { //附加数据,区分订单类型 Map payMap = new HashMap<>(); - payMap.put("app_id",SysConst.getSysConfig().getWxSubAppId()); + payMap.put("app_id", weChatPayReqInfo.getSub_appid()); payMap.put("api_key",SysConst.getSysConfig().getWxApiKey()); payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl()); SortedMap sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap); From defa041e83474cb2cd9c9a03d128af3882a35f1d Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 1 Dec 2021 17:08:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/cweb/config/AuthConfig.java | 1 + .../cweb/controller/HighUserController.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index 78cfb369..c119e8c6 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -111,6 +111,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/user/getUnionId") .excludePathPatterns("/highUser/setCacheParam") .excludePathPatterns("/highUser/getCacheParam") + .excludePathPatterns("/highUser/delCacheParam") .excludePathPatterns("/order/orderToH5Pay") .excludePathPatterns("/order/orderToPay") .excludePathPatterns("/test/*") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java index 7d3c9ee1..45d7cfe2 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -241,5 +241,23 @@ public class HighUserController { } } + @RequestMapping(value="/delCacheParam",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "删除设置用户参数") + public ResponseData delCacheParam(@RequestParam(name = "key", required = true) String key) { + try { + + Object param = redisUtil.hget("PROVISIONAL_CACHE_PARAM", key); + if (param != null) { + redisUtil.hdel("PROVISIONAL_CACHE_PARAM", key); + } + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("CommonController --> delCacheParam() error!", e); + return ResponseMsgUtil.exception(e); + } + } + }