Added API function country_worked

function country_worked can be called either as

/api/country_worked/230/40m/ssb

or by leaving mode bank /api/country_worked/230/40m
pull/326/head
Peter Goodhall 2019-07-22 16:27:18 +01:00
rodzic 160aa44c89
commit 53d4577b26
2 zmienionych plików z 25 dodań i 0 usunięć

Wyświetl plik

@ -431,6 +431,12 @@ class API extends CI_Controller {
}
function country_worked($dxcc_num, $band, $mode = NULL) {
$this->load->model('api_model');
echo $this->api_model->country_worked($dxcc_num, $band, $mode);
}
/* ENDPOINT for Rig Control */

Wyświetl plik

@ -38,6 +38,25 @@ class API_Model extends CI_Model {
}
function country_worked($dxcc_num, $band, $mode){
if($mode != NULL) {
$query = $this->db->query('SELECT COUNT(1) as count FROM '.$this->config->item('table_name').' WHERE COL_DXCC = "'.$dxcc_num.'" AND COL_BAND = "'.$band.'" AND COL_MODE = "'.$mode.'"');
} else {
$query = $this->db->query('SELECT COUNT(1) as count FROM '.$this->config->item('table_name').' WHERE COL_DXCC = "'.$dxcc_num.'" AND COL_BAND = "'.$band.'"');
}
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
return $row->count;
}
}
}
function delete_key($key) {
$this->db->where('key', $key);
$this->db->delete('api');