-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
38 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Api\Model; | ||
|
||
use Api\Model\BaseModel; | ||
|
||
class MemberModel extends BaseModel | ||
{ | ||
protected $autoCheckFields = false; //一定要关闭字段缓存,不然会报找不到表的错误 | ||
|
||
// 如果用户被分配了 目录权限 ,则获取他在该项目下拥有权限的目录id | ||
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; | ||
return $cat_id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters