impemented del_fav
这个提交包含在:
父节点
e86b0a2f86
当前提交
baa3724da9
共有 2 个文件被更改,包括 20 次插入 和 1 次删除
|
|
@ -11,6 +11,9 @@ class User_Options extends CI_Controller {
|
||||||
|
|
||||||
public function add_edit_fav() {
|
public function add_edit_fav() {
|
||||||
$obj = json_decode(file_get_contents("php://input"), true);
|
$obj = json_decode(file_get_contents("php://input"), true);
|
||||||
|
foreach($obj as $option_key => $option_value) {
|
||||||
|
$obj[$option_key]=$this->security->xss_clean($option_value);
|
||||||
|
}
|
||||||
if ($obj['sat_name'] ?? '' != '') {
|
if ($obj['sat_name'] ?? '' != '') {
|
||||||
$option_name=$obj['sat_name'];
|
$option_name=$obj['sat_name'];
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -19,7 +22,7 @@ class User_Options extends CI_Controller {
|
||||||
return $this->user_options_model->set_option('Favourite',$option_name, $obj);
|
return $this->user_options_model->set_option('Favourite',$option_name, $obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_favs() {
|
public function get_fav() {
|
||||||
$result=$this->user_options_model->get_options('Favourite');
|
$result=$this->user_options_model->get_options('Favourite');
|
||||||
foreach($result->result() as $options) {
|
foreach($result->result() as $options) {
|
||||||
$jsonout[$options->option_name][$options->option_key]=$options->option_value;
|
$jsonout[$options->option_name][$options->option_key]=$options->option_value;
|
||||||
|
|
@ -27,6 +30,16 @@ class User_Options extends CI_Controller {
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode($jsonout);
|
echo json_encode($jsonout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function del_fav() {
|
||||||
|
$result=$this->user_options_model->get_options('Favourite');
|
||||||
|
$obj = json_decode(file_get_contents("php://input"), true);
|
||||||
|
if ($obj['option_name'] ?? '' != '') {
|
||||||
|
$option_name=$this->security->xss_clean($obj['option_name']);
|
||||||
|
$this->user_options_model->del_option('Favourite',$option_name);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,12 @@ class User_options_model extends CI_Model {
|
||||||
return $this->db->query($sql, array($uid, $option_type));
|
return $this->db->query($sql, array($uid, $option_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function del_option($option_type, $option_name) {
|
||||||
|
$uid=$this->session->userdata('user_id');
|
||||||
|
$sql='delete from user_options where user_id=? and option_type=? and option_name=?';
|
||||||
|
return $this->db->query($sql, array($uid, $option_type,$option_name));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用