StudioApi.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Http\Api;
  3. use App\Models\UserInfo;
  4. class StudioApi{
  5. public static function getIdByName($name){
  6. /**
  7. * 获取 uuid
  8. */
  9. //TODO 改为studio table
  10. if(empty($name)){
  11. return false;
  12. }
  13. $userInfo = UserInfo::where('username',$name)->first();
  14. if(!$userInfo){
  15. return false;
  16. }else{
  17. return $userInfo->userid;
  18. }
  19. }
  20. public static function getById($id){
  21. //TODO 改为studio table
  22. if(empty($id)){
  23. return false;
  24. }
  25. $userInfo = UserInfo::where('userid',$id)->first();
  26. if(!$userInfo){
  27. return false;
  28. }
  29. return [
  30. 'id'=>$id,
  31. 'nickName'=>$userInfo['nickname'],
  32. 'realName'=>$userInfo['username'],
  33. 'studioName'=>$userInfo['username'],
  34. 'avatar'=>'',
  35. ];
  36. }
  37. public static function getByIntId($id){
  38. //TODO 改为studio table
  39. if(empty($id)){
  40. return false;
  41. }
  42. $userInfo = UserInfo::where('id',$id)->first();
  43. if(!$userInfo){
  44. return false;
  45. }
  46. return [
  47. 'id'=>$userInfo['userid'],
  48. 'nickName'=>$userInfo['nickname'],
  49. 'realName'=>$userInfo['username'],
  50. 'studioName'=>$userInfo['username'],
  51. 'avatar'=>'',
  52. ];
  53. }
  54. }