Add Username and ID to hash. ID to MQTT-Topic

This commit is contained in:
int2001
2025-04-11 06:08:26 +00:00
parent 7c27074982
commit 356cef4830
2 changed files with 27 additions and 2 deletions

View File

@@ -444,8 +444,16 @@ class Logbook_model extends CI_Model {
}
$this->add_qso($data, $skipexport = false);
$this->load->model('stations');
$this->load->library('Mh');
$this->mh->wl_event('qso/logged/'.$this->session->userdata('user_id'), json_encode($data));
$h_user=$this->stations->get_user_from_station($station_id);
$event_data=$data;
$event_data['user_name']=$h_user->user_name;
$event_data['user_id']=$h_user->user_id;
$this->mh->wl_event('qso/logged/'.($h_user->user_id ?? ''), json_encode($event_data));
unset($event_data);
unset($h_user);
unset($data);
}
public function check_last_lotw($call) { // Fetch difference in days when $call has last updated LotW
@@ -4596,8 +4604,15 @@ class Logbook_model extends CI_Model {
}
if ($apicall) {
$this->load->model('stations');
$this->load->library('Mh');
$this->mh->wl_event('qso/logged/api/'.($this->session->userdata('user_id') ?? 'API'), json_encode($data));
$h_user=$this->stations->get_user_from_station($station_id);
$event_data=$data;
$event_data['user_name']=($h_user->user_name ?? '');
$event_data['user_id']=($h_user->user_id ?? '');
$this->mh->wl_event('qso/logged/api/'.($h_user->user_id ?? ''), json_encode($event_data));
unset($event_data);
unset($h_user);
}
// Save QSO
if ($batchmode) {

View File

@@ -570,6 +570,16 @@ class Stations extends CI_Model {
}
}
public function get_user_from_station($stationid) {
if (($stationid ?? '') != '') {
$sql="select u.* from users u inner join station_profile sp on (u.user_id=sp.user_id) where sp.station_id = ?";
$query = $this->db->query($sql, $stationid);
return $query->row();
} else {
return false;
}
}
public function check_station_against_user($stationid, $userid) {
$this->db->select('station_id');
$this->db->where('user_id', $userid);