Merge branch 'dev' of https://github.com/magicbug/Cloudlog into dev
这个提交包含在:
		
						当前提交
						1026f6bc30
					
				
					共有  2 个文件被更改,包括 29 次插入 和 2 次删除
				
			
		|  | @ -127,6 +127,30 @@ class API extends CI_Controller { | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	function station_info($key) { | ||||
| 		$this->load->model('api_model'); | ||||
| 		$this->load->model('stations'); | ||||
| 		header("Content-type: application/json"); | ||||
| 		if(substr($this->api_model->access($key),0,1) == 'r') { /* Checkpermission for  _r_eading */ | ||||
| 			$this->api_model->update_last_used($key); | ||||
| 			$userid = $this->api_model->key_userid($key); | ||||
|  			$station_ids = array(); | ||||
| 			$stations=$this->stations->all_of_user($userid); | ||||
|  			foreach ($stations->result() as $row) { | ||||
| 				$result['station_id']=$row->station_id; | ||||
| 				$result['station_profile_name']=$row->station_profile_name; | ||||
| 				$result['station_gridsquare']=$row->station_gridsquare; | ||||
| 				$result['station_callsign']=$row->station_callsign;; | ||||
| 				$result['station_active']=$row->station_active; | ||||
|  				array_push($station_ids, $result); | ||||
|  			} | ||||
| 			echo json_encode($station_ids); | ||||
| 		} else { | ||||
| 			http_response_code(401); | ||||
| 			echo json_encode(['status' => 'failed', 'reason' => "missing or invalid api key"]); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// FUNCTION: search()
 | ||||
| 	// Handle search requests
 | ||||
| 	/* | ||||
|  |  | |||
|  | @ -23,9 +23,12 @@ class Stations extends CI_Model { | |||
| 		return $this->db->get(); | ||||
| 	} | ||||
| 
 | ||||
| 	function all_of_user() { | ||||
| 	function all_of_user($userid = null) { | ||||
| 		if ($userid == null) {  | ||||
| 			$userid=$this->session->userdata('user_id'); // Fallback to session-uid, if userid is omitted
 | ||||
| 		} | ||||
| 		$this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end'); | ||||
| 		$this->db->where('user_id', $this->session->userdata('user_id')); | ||||
| 		$this->db->where('user_id', $userid); | ||||
| 		$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer'); | ||||
| 		return $this->db->get('station_profile'); | ||||
| 	} | ||||
|  |  | |||
		正在加载…
	
		在新工单中引用