[Bands] Changed frequency library to fetch default frequency from DB

这个提交包含在:
Andreas 2022-09-09 16:53:01 +02:00
父节点 71b38c72a5
当前提交 7a4def1f3d
共有 2 个文件被更改,包括 53 次插入24 次删除

查看文件

@ -100,7 +100,21 @@ class Frequency {
$mode= "DATA";
}
return $this->defaultFrequencies[$band][$mode];
return $this->getDefaultFrequency($band, $mode);
}
function getDefaultFrequency($band, $mode) {
$CI =& get_instance();
$db =& $CI->db;
$db->from('bands');
$db->where('bands.band', $band);
$result = $db->get()->row();
$mode = strtolower($mode);
return $result->$mode;
}
public function GetBand($Frequency) {

查看文件

@ -26,6 +26,21 @@ class Migration_add_band_bandxuser extends CI_Migration {
'constraint' => 20,
'unsigned' => TRUE,
'auto_increment' => FALSE
),
'ssb' => array(
'type' => 'bigint',
'unsigned' => TRUE,
'auto_increment' => FALSE
),
'data' => array(
'type' => 'bigint',
'unsigned' => TRUE,
'auto_increment' => FALSE
),
'cw' => array(
'type' => 'bigint',
'unsigned' => TRUE,
'auto_increment' => FALSE
)
));
@ -33,29 +48,29 @@ class Migration_add_band_bandxuser extends CI_Migration {
$this->dbforge->create_table('bands');
$this->db->query("INSERT INTO bands (band, bandgroup) values ('160m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('80m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('60m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('40m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('30m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('20m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('17m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('15m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('12m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('10m', 'hf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('6m', 'vhf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('4m', 'vhf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('2m', 'vhf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('1.25m', 'vhf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('70cm', 'uhf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('33cm', 'uhf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('23cm', 'shf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('13cm', 'shf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('9cm', 'shf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('6cm', 'shf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('3cm', 'shf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('1.25cm', 'shf');");
$this->db->query("INSERT INTO bands (band, bandgroup) values ('SAT', 'sat');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('160m', 'hf', '1900000', '1838000', '1830000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('80m', 'hf', '3700000', '3583000', '3550000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('60m', 'hf', '5330000', '5330000', '5260000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('40m', 'hf', '7100000', '7040000', '7020000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('30m', 'hf', '10120000', '10145000', '10120000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('20m', 'hf', '14200000', '14080000', '14020000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('17m', 'hf', '18130000', '18105000', '18080000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('15m', 'hf', '21300000', '21080000', '21020000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('12m', 'hf', '24950000', '24925000', '24900000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('10m', 'hf', '28300000', '28120000', '28050000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('6m', 'vhf', '50150000', '50230000', '50090000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('4m', 'vhf', '70200000', '70200000', '70200000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('2m', 'vhf', '144300000', '144370000', '144050000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('1.25m', 'vhf', '222100000', '222100000', '222100000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('70cm', 'uhf', '432200000', '432088000', '432050000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('33cm', 'uhf', '902100000', '902100000', '902100000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('23cm', 'shf', '1296000000', '1296138000', '129600000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('13cm', 'shf', '2320800000', '2320800000', '2320800000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('9cm', 'shf', '3410000000', '3410000000', '3400000000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('6cm', 'shf', '5670000000', '5670000000', '5670000000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('3cm', 'shf', '10225000000', '10225000000', '10225000000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('1.25cm', 'shf', '24000000000', '24000000000', '240000000000');");
$this->db->query("INSERT INTO bands (band, bandgroup, ssb, data, cw) values ('SAT', 'sat', '', '', '');");
}
if (!$this->db->table_exists('bandxuser')) {