提交代码

dev-discount
胡锐 3 years ago
parent fee3475b60
commit 8ff6680c1f
  1. 2
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  2. 31
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java

@ -109,6 +109,8 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/user/login") .excludePathPatterns("/user/login")
.excludePathPatterns("/user/unionPhoneLogin") .excludePathPatterns("/user/unionPhoneLogin")
.excludePathPatterns("/user/getUnionId") .excludePathPatterns("/user/getUnionId")
.excludePathPatterns("/highUser/setCacheParam")
.excludePathPatterns("/highUser/getCacheParam")
.excludePathPatterns("/order/orderToH5Pay") .excludePathPatterns("/order/orderToH5Pay")
.excludePathPatterns("/order/orderToPay") .excludePathPatterns("/order/orderToPay")
.excludePathPatterns("/test/*") .excludePathPatterns("/test/*")

@ -205,37 +205,38 @@ public class HighUserController {
} }
} }
@RequestMapping(value="/setUserParam",method = RequestMethod.GET) @RequestMapping(value="/setCacheParam",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "设置用户参数") @ApiOperation(value = "设置用户参数")
public ResponseData setUserParam(@RequestParam(name = "param", required = true) String param,HttpServletRequest request) { public ResponseData setCacheParam(@RequestBody JSONObject body) {
try { try {
// 用户 if (body == null
SessionObject sessionObject = userCenter.getSessionObject(request); || StringUtils.isBlank(body.getString("key"))
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); || 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); redisUtil.hset("PROVISIONAL_CACHE_PARAM", body.getString("key"), body.getString("value"), 60*5);
return ResponseMsgUtil.success(redisUtil.hget("USER_PARAM", userInfoModel.getHighUser().getPhone()));
return ResponseMsgUtil.success("设置成功");
} catch (Exception e) { } catch (Exception e) {
log.error("CommonController --> getDictionaryByCodeTypeAndValue() error!", e); log.error("CommonController --> setCacheParam() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }
@RequestMapping(value="/getUserParam",method = RequestMethod.GET) @RequestMapping(value="/getCacheParam",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取设置用户参数") @ApiOperation(value = "获取设置用户参数")
public ResponseData getUserParam(HttpServletRequest request) { public ResponseData getCacheParam(@RequestParam(name = "key", required = true) String key) {
try { 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) { } catch (Exception e) {
log.error("CommonController --> getDictionaryByCodeTypeAndValue() error!", e); log.error("CommonController --> getCacheParam() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }

Loading…
Cancel
Save