|
@@ -14,6 +14,7 @@ import com.iformall.enums.*; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.service.*; |
|
|
import com.iformall.service.*; |
|
|
import com.iformall.service.wx.WxPayService; |
|
|
import com.iformall.service.wx.WxPayService; |
|
|
|
|
|
import com.iformall.service.wx.WxWeappService; |
|
|
import com.iformall.utils.Constant; |
|
|
import com.iformall.utils.Constant; |
|
|
import com.iformall.utils.SysConfigConstant; |
|
|
import com.iformall.utils.SysConfigConstant; |
|
|
|
|
|
|
|
@@ -42,6 +43,12 @@ public class WxChatController extends BaseController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
SysConfigService sysConfigService; |
|
|
SysConfigService sysConfigService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxWeappService wxWeappService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxAppinfoService wxAppinfoServie; |
|
|
|
|
|
|
|
|
@GetMapping("/limit") |
|
|
@GetMapping("/limit") |
|
|
public ResultData chatLimit() { |
|
|
public ResultData chatLimit() { |
|
|
Map retMap = new HashMap(); |
|
|
Map retMap = new HashMap(); |
|
@@ -50,5 +57,30 @@ public class WxChatController extends BaseController { |
|
|
retMap.put("saysContentLength", saysContentLength.getConfigItemValue()); |
|
|
retMap.put("saysContentLength", saysContentLength.getConfigItemValue()); |
|
|
return new ResultData(retMap); |
|
|
return new ResultData(retMap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/msgSecCheck") |
|
|
|
|
|
@ApiOperation(value = "用户输入内容非法字符过滤", notes = "{\"message\":\"string\",\"appId\":\"string\"}") |
|
|
|
|
|
public ResultData msgSecCheck(@RequestBody Map<String, String> map) { |
|
|
|
|
|
String message = map.get("message"); |
|
|
|
|
|
String appId = map.get("appId"); |
|
|
|
|
|
if (StringUtils.isBlank(message)) { |
|
|
|
|
|
return new ResultData(ErrorCode.PARAM_EMPITY.getCode(), "message不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(appId)) { |
|
|
|
|
|
return new ResultData(ErrorCode.PARAM_EMPITY.getCode(), "appId不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
WxAppinfo wxAppinfo = wxAppinfoServie.getCAppInfoFromRedis(appId); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
boolean isChecked = wxWeappService.msgSecCheck(wxAppinfo, message); |
|
|
|
|
|
if (isChecked) { |
|
|
|
|
|
return new ResultData(Result.SUCCESS, "校验成功"); |
|
|
|
|
|
}else { |
|
|
|
|
|
return new ResultData(Result.ERROR, "含非法字符"); |
|
|
|
|
|
} |
|
|
|
|
|
}catch(Exception e) { |
|
|
|
|
|
return new ResultData(ErrorCode.PARAM_EMPITY.getCode(), e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |