BusinessmanService.php 935 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Modules\Jiesuan\Services;
  3. use Illuminate\Support\Facades\DB;
  4. class BusinessmanService
  5. {
  6. /**
  7. * 商务列表
  8. * name: list
  9. * @param array $param
  10. * @return \Illuminate\Support\Collection
  11. * date 2023/05/30 10:01
  12. */
  13. public static function list($param = []) {
  14. $list = DB::table('users')
  15. ->join('user_has_roles', 'users.id', 'user_has_roles.user_id')
  16. ->join('roles', 'user_has_roles.role_id', 'roles.id')
  17. ->where([
  18. 'roles.identify' => 'business',
  19. 'users.status' => 1,
  20. ]);
  21. if (getProp($param,'name','')){
  22. $list->where('users.username','like',"%".$param['name']."%");
  23. }
  24. if (getProp($param,'id',0)){
  25. $list->where('users.id',$param['id']);
  26. }
  27. return $list->select('users.id', 'users.username', 'users.email')
  28. ->get();
  29. }
  30. }