Merge pull request #4 from magicbug/master

Merge with master
这个提交包含在:
Kim - DG9VH 2019-06-16 19:06:17 +02:00 提交者 GitHub
当前提交 f400830170
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 6 个文件被更改,包括 45 次插入9 次删除

查看文件

@ -58,6 +58,11 @@ class Logbook extends CI_Controller {
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
$this->load->model('lotw_user');
$lotw_member = $this->lotw_user->check($callsign);
$this->load->model('logbook_model'); $this->load->model('logbook_model');
$return = [ $return = [
@ -67,7 +72,8 @@ class Logbook extends CI_Controller {
"callsign_qth" => "", "callsign_qth" => "",
"callsign_iota" => "", "callsign_iota" => "",
"bearing" => "", "bearing" => "",
"workedBefore" => false "workedBefore" => false,
"lotw_member" => $lotw_member,
]; ];
$return['dxcc'] = $this->dxcheck($callsign); $return['dxcc'] = $this->dxcheck($callsign);
@ -91,6 +97,7 @@ class Logbook extends CI_Controller {
return; return;
} }
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null)
{ {
// Lookup using QRZ // Lookup using QRZ
@ -119,10 +126,12 @@ class Logbook extends CI_Controller {
if (isset($callbook)) if (isset($callbook))
{ {
$return['callsign_name'] = $callbook['name']; $return['callsign_name'] = $callbook['name'];
$return['callsign_qra'] = $callbook['gridsquare']; $return['callsign_qra'] = $callbook['gridsquare'];
$return['callsign_qth'] = $callbook['city']; $return['callsign_qth'] = $callbook['city'];
$return['callsign_iota'] = $callbook['iota']; $return['callsign_iota'] = $callbook['iota'];
$return['qsl_manager'] = $callbook['qslmgr'];
if ($return['callsign_qra'] != "") { if ($return['callsign_qra'] != "") {
$return['latlng'] = $this->qralatlng($return['callsign_qra']); $return['latlng'] = $this->qralatlng($return['callsign_qra']);
} }
@ -131,6 +140,7 @@ class Logbook extends CI_Controller {
$return['bearing'] = $this->bearing($return['callsign_qra']); $return['bearing'] = $this->bearing($return['callsign_qra']);
echo json_encode($return, JSON_PRETTY_PRINT); echo json_encode($return, JSON_PRETTY_PRINT);
return; return;
} }

查看文件

@ -301,6 +301,8 @@ class Lotw extends CI_Controller {
set_time_limit(0); set_time_limit(0);
$this->load->model('lotw_user'); $this->load->model('lotw_user');
$this->lotw_user->empty_table();
$row = 1; $row = 1;
if (($handle = fopen("https://lotw.arrl.org/lotw-user-activity.csv", "r")) !== FALSE) { if (($handle = fopen("https://lotw.arrl.org/lotw-user-activity.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
@ -324,6 +326,9 @@ class Lotw extends CI_Controller {
*/ */
function lotw_usercheck($callsign) { function lotw_usercheck($callsign) {
$this->load->model('lotw_user'); $this->load->model('lotw_user');
$lotw_user_result = $this->lotw_user->check($callsign);
} }

查看文件

@ -79,6 +79,7 @@ class Qrz {
$data['lat'] = (string) $xml->Callsign->lat; $data['lat'] = (string) $xml->Callsign->lat;
$data['long'] = (string) $xml->Callsign->lon; $data['long'] = (string) $xml->Callsign->lon;
$data['iota'] = (string) $xml->Callsign->iota; $data['iota'] = (string) $xml->Callsign->iota;
$data['qslmgr'] = (string) $xml->Callsign->qslmgr;
return $data; return $data;
} }

查看文件

@ -9,8 +9,8 @@ class Lotw_user extends CI_Model {
} }
function empty_table($table) { function empty_table() {
$this->db->empty_table($table); $this->db->empty_table('lotw_userlist');
} }
function add_lotwuser($callsign, $date) { function add_lotwuser($callsign, $date) {
@ -20,9 +20,18 @@ class Lotw_user extends CI_Model {
'upload_date' => $date 'upload_date' => $date
); );
$this->db->insert('lotw_userlist', $data); $this->db->insert('lotw_userlist', $data);
} }
function check($callsign) {
$this->db->where('callsign', $callsign);
$query = $this->db->get('lotw_userlist');
if ($query->num_rows() > 0) {
return "active";
} else {
return "not found";
}
}
} }
?> ?>

查看文件

@ -203,6 +203,7 @@ $(document).ready(function(){
$('#callsign_info').text(""); $('#callsign_info').text("");
$('#locator_info').text(""); $('#locator_info').text("");
$('#country').val(""); $('#country').val("");
$('#lotw_info').text("");
$('#dxcc_id').val(""); $('#dxcc_id').val("");
$('#cqz').val(""); $('#cqz').val("");
$('#name').val(""); $('#name').val("");
@ -223,9 +224,13 @@ $(document).ready(function(){
/* Find and populate DXCC */ /* Find and populate DXCC */
$.getJSON('logbook/json/' + $(this).val(), function(result) $.getJSON('logbook/json/' + $(this).val(), function(result)
{ {
//$('#country').val(result); //$('#country').val(result); lotw_info
$('#country').val(convert_case(result.dxcc.entity)); $('#country').val(convert_case(result.dxcc.entity));
$('#callsign_info').text(convert_case(result.dxcc.entity)); $('#callsign_info').text(convert_case(result.dxcc.entity));
if(result.lotw_member == "active") {
$('#lotw_info').text("LoTW");
}
$('#dxcc_id').val(result.dxcc.adif); $('#dxcc_id').val(result.dxcc.adif);
$('#cqz').val(result.dxcc.cqz); $('#cqz').val(result.dxcc.cqz);
@ -243,6 +248,7 @@ $(document).ready(function(){
} }
markers.addLayer(marker).addTo(mymap); markers.addLayer(marker).addTo(mymap);
/* Find Locator if the field is empty */ /* Find Locator if the field is empty */
if($('#locator').val() == "") { if($('#locator').val() == "") {
@ -272,6 +278,11 @@ $(document).ready(function(){
} }
/* Find Operators Name */ /* Find Operators Name */
if($('#qsl_via').val() == "") {
$('#qsl_via').val(result.qsl_manager);
}
/* Find Operators Name */
if($('#name').val() == "") { if($('#name').val() == "") {
$('#name').val(result.callsign_name); $('#name').val(result.callsign_name);
} }

查看文件

@ -60,7 +60,7 @@
<div class="form-group"> <div class="form-group">
<label for="callsign">Callsign</label> <label for="callsign">Callsign</label>
<input type="text" class="form-control" id="callsign" name="callsign" required> <input type="text" class="form-control" id="callsign" name="callsign" required>
<small id="callsign_info" class="badge badge-primary"></small> <small id="callsign_info" class="badge badge-secondary"></small> <small id="lotw_info" class="badge badge-light"></small>
</div> </div>
@ -255,9 +255,9 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="qsl-via" class="col-sm-2 col-form-label">Via</label> <label for="qsl_via" class="col-sm-2 col-form-label">Via</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" id="qsl-via" class="form-control" name="qsl_via" value="" /> <input type="text" id="qsl_via" class="form-control" name="qsl_via" value="" />
</div> </div>
</div> </div>