MeetingInfo.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Web\Components\Meeting;
  3. use App\Exceptions\ApiException;
  4. use App\Web\Facades\MeetingFacade;
  5. use App\Web\Facades\WebFacade;
  6. use App\Web\Services\WebService;
  7. use Illuminate\View\Component;
  8. class MeetingInfo extends Component
  9. {
  10. protected $viewFile; //视图地址
  11. protected $router_path;
  12. protected $meeting_id;
  13. public function __construct($viewFile = "", $params = [], $id = 0, $routerPath = '')
  14. {
  15. if (empty($viewFile)) {
  16. throw new ApiException("common.page_none", '您访问的地址不存在~');
  17. }
  18. $this->meeting_id = $params['id'] ?? $id;
  19. $this->router_path = $params['router_path'] ?? $routerPath;
  20. $this->viewFile = $viewFile;
  21. }
  22. /**
  23. *
  24. */
  25. public function render()
  26. {
  27. $params = [
  28. "id" => $this->meeting_id,
  29. ];
  30. $meetingInfo = MeetingFacade::getMeetingRenderData($params);
  31. if (!empty($meetingInfo['expand_content'])) {
  32. $meetingInfo['expand_content'] = mapByKey($meetingInfo['expand_content'], 'key');
  33. if (!empty($meetingInfo['speech_schedule'])) {
  34. foreach ($meetingInfo['speech_schedule'] as $speech_schedule_key => $speech_schedule_item) {
  35. if (!empty($speech_schedule_item['expand_content'])) {
  36. $meetingInfo['speech_schedule'][$speech_schedule_key]['expand_content'] = mapByKey($speech_schedule_item['expand_content'], 'key');
  37. } else {
  38. $meetingInfo['speech_schedule'][$speech_schedule_key]['expand_content'] = [];
  39. }
  40. }
  41. }
  42. }
  43. $retData['event_detail']=$meetingInfo;
  44. if (!empty($this->router_path)) {
  45. $pageContent = WebFacade::getStaticPageInfo(['route_path' => $this->router_path]);
  46. $retData['page_content'] = $pageContent['page_content'];
  47. }
  48. $retData['menu_data'] = WebFacade::getWebMenu();
  49. //dd($retData);
  50. return view($this->viewFile, $retData);
  51. }
  52. }