UserInfo.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\api\model;
  13. use app\common\model\User;
  14. use app\common\model\UserInfo as UserInfoModel;
  15. /**
  16. * 用户资料模型类
  17. * Class UserInfo
  18. * @package app\api\model
  19. */
  20. class UserInfo extends UserInfoModel
  21. {
  22. protected $globalScope = [''];
  23. /**
  24. * 隐藏字段
  25. * @var array
  26. */
  27. protected $hidden = [
  28. 'store_id',
  29. 'update_time'
  30. ];
  31. /**
  32. * 获取用户信息
  33. * @param $where
  34. * @param array $with
  35. * @return static|array|false|null
  36. */
  37. public static function detail($where, array $with = [])
  38. {
  39. $filter = [];
  40. if (is_array($where)) {
  41. $filter = array_merge($filter, $where);
  42. } else {
  43. $filter['user_id'] = (int)$where;
  44. }
  45. return static::get($filter, $with);
  46. }
  47. }