AuthGroupAccess.php 513 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class AuthGroupAccess extends Model
  5. {
  6. /**
  7. * 获取所属组名
  8. * @param $usr_id
  9. * @return bool|mixed
  10. */
  11. public static function getGroupName($usr_id)
  12. {
  13. $name = self::where('a.uid',$usr_id)
  14. ->alias('a')
  15. ->join(['auth_group'=>'g'],'a.group_id = g.id')
  16. ->field('g.name,g.id')
  17. ->find();
  18. if($name){
  19. return $name;
  20. }
  21. return false;
  22. }
  23. }