Added Search Callsign function which returns results as json
这个提交包含在:
父节点
a4d023d225
当前提交
fe14cdc111
共有 1 个文件被更改,包括 27 次插入 和 0 次删除
|
|
@ -2,6 +2,33 @@
|
||||||
|
|
||||||
class API extends CI_Controller {
|
class API extends CI_Controller {
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODOs
|
||||||
|
- Search Callsign (Return Json)
|
||||||
|
- Add QSO return json
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function search_callsign($callsign) {
|
||||||
|
$this->db->select('COL_PRIMARY_KEY, COL_CALL, COL_MODE, COL_BAND, COL_COUNTRY, COL_FREQ, COL_GRIDSQUARE, COL_RST_RCVD, COL_RST_SENT, COL_SAT_MODE, COL_SAT_NAME, COL_TIME_ON');
|
||||||
|
$this->db->select("DATE_FORMAT(COL_TIME_ON, '%H:%i') AS time_on", FALSE );
|
||||||
|
$this->db->select("DATE_FORMAT(COL_TIME_ON, '%d/%c/%Y') AS date_on", FALSE );
|
||||||
|
$this->db->like('COL_CALL', $callsign);
|
||||||
|
$this->db->or_like('COL_GRIDSQUARE', $callsign);
|
||||||
|
$query = $this->db->get($this->config->item('table_name'));
|
||||||
|
|
||||||
|
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
foreach ($query->result() as $result)
|
||||||
|
{
|
||||||
|
$results [] = $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($results);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Do absolutely nothing
|
// Do absolutely nothing
|
||||||
function index()
|
function index()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用