链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
906 B

  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class ImsCjdcUser extends Model
  5. {
  6. protected $table = 'lanzu_user';
  7. protected $dateFormat = 'U';
  8. /**
  9. * 获取单个用户信息
  10. * @param int $id
  11. * @param string $field
  12. * @return object
  13. */
  14. public static function getUserInfo($id,$field = '*')
  15. {
  16. return self::select($field)->find($id);
  17. }
  18. /**
  19. * 获取用户数组
  20. * id为键,name为值
  21. * @return array
  22. */
  23. public static function getUserArray()
  24. {
  25. $list = self::select('id','nick_name')
  26. ->where('status',1)
  27. ->whereNull('deleted_at')
  28. ->get();
  29. $array = [];
  30. if(count($list) > 0){
  31. foreach ($list as $value) {
  32. $array[$value->id] = $value->nick_name;
  33. }
  34. }
  35. return $array;
  36. }
  37. }