Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
star7th committed Nov 13, 2024
1 parent 7482459 commit 4107347
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/Application/Api/Model/MemberModel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public function getCatId($item_id, $uid)
$cat_id1 = D("ItemMember")->where(" item_id = '%d' and uid = '%d' ", array($item_id, $uid))->getField('cat_id');
$cat_id2 = D("TeamItemMember")->where(" item_id = '%d' and member_uid = '%d' ", array($item_id, $uid))->getField('cat_id');
// 尝试给 $cat_id 赋值 $cat_id1,如果 $cat_id1 未空,则尝试 $cat_id2,如果 $cat_id2 也未空,则最终给 $cat_id 赋值 0。
$cat_id = $cat_id1 ?? $cat_id2 ?? 0;
if (!empty($cat_id1)) {
$cat_id = $cat_id1;
} elseif (!empty($cat_id2)) {
$cat_id = $cat_id2;
} else {
$cat_id = 0;
}
return $cat_id;
}
}

0 comments on commit 4107347

Please sign in to comment.