UserSession.php 870 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Module\System\AdminLazyRenderable;
  3. use App\Module\App\SessionApp;
  4. use Dcat\Admin\Widgets\Card;
  5. use Dcat\Admin\Widgets\Table;
  6. use UCore\DcatAdmin\Support\LazyRenderable;
  7. /**
  8. *
  9. * 展示用户的Session信息
  10. */
  11. class UserSession extends LazyRenderable
  12. {
  13. public function index($user_id)
  14. {
  15. $content = '';
  16. $infoArray=[];
  17. $sessions = SessionApp::getUKeys($user_id);
  18. foreach ($sessions as $k=> $session){
  19. $infoArray['se:'.$k] =$session;
  20. }
  21. $content .= Table::make($infoArray);
  22. $card = new Card('用户:'.$user_id, $content);
  23. return view('admin.user_info', [
  24. 'user_id' => $user_id,
  25. 'content' => $card
  26. ]);
  27. }
  28. public function render()
  29. {
  30. $user_id = $this->key;
  31. return $this->index($user_id);
  32. }
  33. }