* [apiv2] Check object exists.

This commit is contained in:
朱金勇
2025-12-29 14:00:50 +08:00
parent 039fc15722
commit 0109f278aa
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -429,6 +429,8 @@ class api extends router
'testcaseID' => TABLE_CASE,
'user' => TABLE_USER,
'userID' => TABLE_USER,
'ticket' => TABLE_TICKET,
'ticketID' => TABLE_TICKET,
];
$params = array_merge($this->params, $_POST);
@@ -436,7 +438,7 @@ class api extends router
{
if(isset($objectMap[$key]) && $value != 0)
{
$id = $this->dao->select('id')->from($objectMap[$key])->where('id')->eq($value)->fetch('id');
$id = $this->dao->select('id')->from($objectMap[$key])->where('id')->eq($value)->andWhere('deleted')->eq('0')->fetch('id');
if(!$id) return $this->control->sendError(ucfirst(str_replace('ID', '', $key)) . ' does not exist.');
}
}