AuthGroupAccess.php 470 B

123456789101112131415161718192021222324252627
  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('uid',$usr_id)
  14. ->alias('a')
  15. ->join(['auth_group'=>'g'],'a.uid')
  16. ->value('g.name');
  17. if($name){
  18. return $name;
  19. }
  20. return false;
  21. }
  22. }