fullCalendar事件源加载时间太长

时间:2016-10-30 01:58:16

标签: jquery mysql ajax fullcalendar

我正在使用fullCalendar和jQuery / PHP / mySQL来显示日历调度程序。在我的localhost机器测试服务器上,它运行得非常快。

现在我正试图让我的网站上线,我正在我的服务器上测试一下。

我注意到获取fullCalendar事件的ajax调用需要很长时间才能加载(> 15秒!)。我在ajax页面上收集了数千个事件。

 var calendar = $("#calendar_full").fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            editable: true,
            slotDuration: '00:10:00',
            minTime: "<?php echo $location->data()->calendar_start; ?>",
            maxTime: "<?php echo $location->data()->calendar_end; ?>",
            hiddenDays: $.parseJSON('[' + "<?php echo $location->data()->calendar_hide_days_of_week; ?>" + ']'),
            defaultView: 'agendaWeek',
            eventLimit: true,
            events: 'ajax_get_json.php?what=company_all_appointments',
            eventRender: function eventRender(event, element, view) {

                return ['all', event.location_id].indexOf($('#calendar_location_id option:selected').val()) >= 0 && ['all', event.saw_by_id].indexOf($('#calendar_provider_id option:selected').val()) >= 0;

            }, ...
 ...

在ajax页面上,我的服务器上运行以下查询:

 SELECT post_notes, post_appt_statuses.`status` AS post_appt_status_name, post_appt_status_id, CONCAT_WS(' ', users.first_name, users.last_name) AS scheduled_with_name, appt_reasons.reason AS appt_reason_name, appt_statuses.status AS appt_status_name, appts.date_created, appts.inserted_by_user_id, appts.saw_by_id, appts.company_id, appts.location_id, locations.name AS location_name, marketing_events.promo_code, appt_status_id, howheard_id, appts.marketing_event_id, appts.allDay, reason_id, appts.pre_notes, appt_reasons.color, appt_reasons.textColor, contacts.id AS appt_contact_id, contacts.friends_call_me, contacts.first_name, contacts.last_name, appts.id, appts.start, appts.end 
 FROM appointments appts 
 LEFT JOIN marketing_events ON marketing_events.id = appts.marketing_event_id LEFT JOIN locations ON locations.ID = appts.location_id 
 LEFT JOIN appt_reasons ON appt_reasons.id = appts.reason_id 
 LEFT JOIN contacts ON contacts.id = appts.contact_id 
 LEFT JOIN appt_statuses ON appt_statuses.id = appts.appt_status_id     
 LEFT JOIN post_appt_statuses ON post_appt_statuses.id = appts.post_appt_status_id 
 LEFT JOIN users ON users.id = appts.saw_by_id  WHERE appts.company_id = '" . $company . "'

我知道这是一个很大的选择语句而且许多JOINS会减慢查询速度,但是我需要来自JOINS的所有信息以获取模式表单,该表单显示日历中的事件被选中。

是否有一种很好的方法可以让ajax调用事件加载得更快?

0 个答案:

没有答案