校验:发送消息校验

This commit is contained in:
luying
2022-07-27 17:38:47 +08:00
parent e114a5297c
commit f94bc38b02

View File

@@ -760,7 +760,12 @@ export function checkRouteParam(route: string, msg: any) {
{
let { channel, type, content, targetRoleId, targetMsgCode} = msg;
if(!checkNaturalNumbers(type) || !checkIsInEnum(MSG_TYPE, type)) return false;
if(!checkNaturalStrings(channel, content)) return false;
if(!checkNaturalStrings(channel)) return false;
if(type == MSG_TYPE.IMG) {
if(!checkNaturalNumbers(content)) return false;
} else {
if(!checkNaturalStrings(content)) return false;
}
if(!checkStringIfExist(targetRoleId, targetMsgCode)) return false;
break;
}
@@ -768,7 +773,11 @@ export function checkRouteParam(route: string, msg: any) {
{
let { type, content, targetRoleId, targetMsgCode} = msg;
if(!checkNaturalNumbers(type) || !checkIsInEnum(MSG_TYPE, type)) return false;
if(!checkNaturalStrings(content)) return false;
if(type == MSG_TYPE.IMG) {
if(!checkNaturalNumbers(content)) return false;
} else {
if(!checkNaturalStrings(content)) return false;
}
if(!checkStringIfExist(targetRoleId, targetMsgCode)) return false;
break;
}