Benchmarking data added to controller function and new callsign lookup call to speed up load times

这个提交包含在:
Peter Goodhall 2020-04-06 23:58:26 +01:00
父节点 db0d0db60d
当前提交 5042ce3f8c
共有 2 个文件被更改,包括 37 次插入7 次删除

查看文件

@ -497,6 +497,8 @@ class API extends CI_Controller {
}
function lookup() {
// start benchmarking
$this->output->enable_profiler(TRUE);
/*
*
* Callsign lookup function for Cloudlogs logging page or thirdparty systems
@ -606,14 +608,15 @@ class API extends CI_Controller {
* Pool any local data we have for a callsign
*
*/
$call_lookup_results = $this->logbook_model->call_lookup_result($lookup_callsign);
if($this->logbook_model->call_name($lookup_callsign) != null)
if($call_lookup_results != null)
{
$return['name'] = $this->logbook_model->call_name($lookup_callsign);
$return['gridsquare'] = $this->logbook_model->call_qra($lookup_callsign);
$return['location'] = $this->logbook_model->call_qth($lookup_callsign);
$return['iota_ref'] = $this->logbook_model->call_iota($lookup_callsign);
$return['qsl_manager'] = $this->logbook_model->call_qslvia($lookup_callsign);
$return['name'] = $call_lookup_results->COL_NAME;
$return['gridsquare'] = $call_lookup_results->COL_GRIDSQUARE;
$return['location'] = $call_lookup_results->COL_QTH;
$return['iota_ref'] = $call_lookup_results->COL_IOTA;
$return['qsl_manager'] = $call_lookup_results->COL_QSL_VIA;
if ($return['gridsquare'] != "") {
$return['latlng'] = $this->qralatlng($return['gridsquare']);
@ -644,6 +647,8 @@ class API extends CI_Controller {
echo json_encode($return, JSON_PRETTY_PRINT);
return;
// End benchmarking
$this->output->enable_profiler(FALSE);
}
function qralatlng($qra) {

查看文件

@ -378,8 +378,33 @@ class Logbook_model extends CI_Model {
return $this->db->get($this->config->item('table_name'));
}
/* Callsign QRA */
/*
*
* Function: call_lookup_result
*
* Usage: Callsign lookup data for the QSO panel and API/callsign_lookup
*
*/
function call_lookup_result($callsign) {
$this->db->select('COL_CALL, COL_NAME, COL_QSL_VIA, COL_GRIDSQUARE, COL_QTH, COL_IOTA, COL_TIME_ON');
$this->db->where('COL_CALL', $callsign);
$where = "COL_NAME != \"\"";
$this->db->where($where);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit(1);
$query = $this->db->get($this->config->item('table_name'));
$name = "";
if ($query->num_rows() > 0)
{
$data = $query->row();
}
return $data;
}
/* Callsign QRA */
function call_qra($callsign) {
$this->db->select('COL_CALL, COL_GRIDSQUARE, COL_TIME_ON');
$this->db->where('COL_CALL', $callsign);