校验:发送消息校验
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user