kopia lustrzana https://github.com/magicbug/Cloudlog
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/40mpull/326/head
rodzic
160aa44c89
commit
53d4577b26
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
Ładowanie…
Reference in New Issue