Initial import
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
class Emailconfig extends MY_Controller
|
||||
{
|
||||
var $db_onedev;
|
||||
public function index()
|
||||
{
|
||||
echo "EMAIL CONFIG API";
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db_onedev = $this->load->database("onedev", true);
|
||||
}
|
||||
|
||||
public function getdata()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "select *
|
||||
from one_preorder_dev .m_emailconfig
|
||||
where
|
||||
M_EmailConfigIsActive = 'Y' LIMIT 1";
|
||||
$rows = $this->db_onedev->query($sql)->row_array();
|
||||
//echo $this->db_onedev->last_query();
|
||||
if (!$rows) {
|
||||
$this->sys_error_db("emailconfig select");
|
||||
exit;
|
||||
|
||||
}
|
||||
$result = array ("total" => count($rows),"records" => $rows);
|
||||
$this->sys_ok($result);
|
||||
|
||||
} catch(Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function save()
|
||||
{
|
||||
try {
|
||||
//# cek token valid
|
||||
if (! $this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
//# ambil parameter input
|
||||
$prm = $this->sys_input;
|
||||
|
||||
$sql = "update one_preorder_dev .m_emailconfig SET
|
||||
M_EmailConfigSender = ?,
|
||||
M_EmailConfigUsername = ?,
|
||||
M_EmailConfigPassword = ?,
|
||||
M_EmailConfigServer = ?,
|
||||
M_EmailConfigMaxRetry = ?,
|
||||
M_EmailConfigHomeServiceFormat = ?,
|
||||
M_EmailConfigCc = ?,
|
||||
M_EmailConfigLastUpdate = now()
|
||||
where
|
||||
M_EmailConfigID = ?
|
||||
";
|
||||
$query = $this->db_onedev->query($sql,$prm);
|
||||
//echo $query;
|
||||
if (!$query) {
|
||||
$this->sys_error_db("nat_bahan update");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = array ("total" => 1, "records" => array());
|
||||
$this->sys_ok($result);
|
||||
|
||||
} catch(Exception $exc) {
|
||||
$message = $exc->getMessage();
|
||||
$this->sys_error($message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user