first commit
This commit is contained in:
359
application/models/admin/cs/m_bbs_faq.php
Executable file
359
application/models/admin/cs/m_bbs_faq.php
Executable file
@@ -0,0 +1,359 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_bbs_faq extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq - list
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_category1 = $req_data['search_category1'];
|
||||
$search_category2 = $req_data['search_category2'];
|
||||
|
||||
if($search_category1!='') {
|
||||
$this->db->where('a.faq_category_code1', $search_category1);
|
||||
}
|
||||
if($search_category2!='') {
|
||||
$this->db->where('a.faq_category_code2', $search_category2);
|
||||
}
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like($search_type, $search_keyword);
|
||||
}
|
||||
|
||||
$this->db->select('a.*, b.category_name as category_name1, c.category_name as category_name2');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.depth', '1');
|
||||
$this->db->where('c.depth', '2');
|
||||
$this->db->where('c.p_category_code = a.faq_category_code1');
|
||||
$this->db->from('bbs_faq as a');
|
||||
$this->db->join('bbs_faq_category as b', 'a.faq_category_code1 = b.category_code');
|
||||
$this->db->join('bbs_faq_category as c', 'a.faq_category_code2 = c.category_code');
|
||||
$this->db->order_by('a.idx desc');
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq - list - total count
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
$search_category1 = $req_data['search_category1'];
|
||||
$search_category2 = $req_data['search_category2'];
|
||||
|
||||
if($search_category1!='') {
|
||||
$this->db->where('faq_category_code1', $search_category1);
|
||||
}
|
||||
if($search_category2!='') {
|
||||
$this->db->where('faq_category_code2', $search_category2);
|
||||
}
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like($search_type, $search_keyword);
|
||||
}
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 공지 - select
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_select($req_data){
|
||||
# request
|
||||
$idx = $req_data;
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq - insert
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_insert($req_data){
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$user_name = $this->session->userdata('Adm_Name');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$req_data['write_id'] = $user_id;
|
||||
$req_data['write_name'] = $user_name;
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = $user_id;
|
||||
$req_data['update_date']= $now_date;
|
||||
$row = $this->db->insert('bbs_faq', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq - category_code count
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_category_code_count($req_data){
|
||||
# request
|
||||
$depth = $req_data['depth'];
|
||||
$category_code = $req_data['category_code'];
|
||||
|
||||
|
||||
if($depth == '1') {
|
||||
$this->db->where('faq_category_code1', $category_code);
|
||||
} else {
|
||||
$this->db->where('faq_category_code2', $category_code);
|
||||
}
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq is_del update
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_is_del_update($req_data){
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$arr_update_data = array();
|
||||
foreach($req_data as $key=>$val) {
|
||||
$arr_update_data[$key]['idx'] = $val;
|
||||
$arr_update_data[$key]['is_del'] = 'Y';
|
||||
$arr_update_data[$key]['update_id'] = $user_id;
|
||||
$arr_update_data[$key]['update_date'] = $now_date;
|
||||
}
|
||||
$this->db->update_batch('bbs_faq', $arr_update_data, 'idx');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq 카테고리 - list
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function faq_category_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like($search_type, $search_keyword);
|
||||
}
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq_category');
|
||||
$this->db->order_by('p_category_code asc, depth asc, category_code asc');
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq 카테고리 list용 - total count
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function faq_category_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like($search_type, $search_keyword);
|
||||
}
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq_category');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq 카테고리 - all list
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function faq_category_all_list(){
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq_category');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq 카테고리 - insert
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_category_insert($req_data){
|
||||
# request
|
||||
$category_name = $req_data['category_name'];
|
||||
$depth = $req_data['depth'];
|
||||
$p_category_code = $req_data['p_category_code'];
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
|
||||
$this->db->select('max(category_code) + 1 as category_code');
|
||||
$this->db->where('depth', $depth);
|
||||
if($p_category_code!='') $this->db->where('p_category_code', $p_category_code);
|
||||
$this->db->from('bbs_faq_category');
|
||||
$res1 = $this->db->get();
|
||||
$row1 = $res1->result_array();
|
||||
|
||||
$category_code = $row1[0]['category_code'];
|
||||
if($depth=='1') {
|
||||
if($category_code == '') $category_code = '10';
|
||||
$p_category_code = $category_code;
|
||||
} else {
|
||||
if($category_code == '') $category_code = '01';
|
||||
}
|
||||
|
||||
$category_code = sprintf('%02d',$category_code);
|
||||
|
||||
|
||||
$insert_data['category_code'] = $category_code;
|
||||
$insert_data['category_name'] = $category_name;
|
||||
$insert_data['depth'] = $depth;
|
||||
$insert_data['p_category_code']= $p_category_code;
|
||||
$insert_data['reg_id'] = $user_id;
|
||||
$insert_data['reg_date'] = $now_date;
|
||||
$insert_data['update_id'] = $user_id;
|
||||
$insert_data['update_date'] = $now_date;
|
||||
|
||||
$row = $this->db->insert('bbs_faq_category', $insert_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq 카테고리 - update
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_category_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
unset($req_data['idx']);
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$req_data['update_id'] = $user_id;
|
||||
$req_data['update_date'] = $now_date;
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->update('bbs_faq_category', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : faq 카테고리 is_del update
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_category_is_del_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
$p_category_code= $req_data['p_category_code'];
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
|
||||
$update_data['is_del'] = 'Y';
|
||||
$update_data['update_id'] = $user_id;
|
||||
$update_data['update_date'] = $now_date;
|
||||
|
||||
if($idx!='') {
|
||||
$this->db->where('idx', $idx);
|
||||
}
|
||||
if($p_category_code!='') {
|
||||
$this->db->where('p_category_code', $p_category_code);
|
||||
}
|
||||
$row = $this->db->update('bbs_faq_category', $update_data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
unset($req_data['idx']);
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$req_data['update_id'] = $user_id;
|
||||
$req_data['update_date'] = $now_date;
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->update('bbs_faq', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
300
application/models/admin/cs/m_bbs_notice.php
Executable file
300
application/models/admin/cs/m_bbs_notice.php
Executable file
@@ -0,0 +1,300 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_bbs_notice extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 공지 - list
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if(isset($req_data['search_click'])==true) $search_click = $req_data['search_click'];
|
||||
|
||||
if($search_click=='1') {
|
||||
$today_date = date("Y-m-d").' 00:00:00';
|
||||
$this->db->where('reg_date >=', $today_date);
|
||||
}
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like($search_type, $search_keyword);
|
||||
}
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$this->db->order_by('idx desc');
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 공지 - list - total count
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if(isset($req_data['search_click'])==true) $search_click = $req_data['search_click'];
|
||||
|
||||
if($search_click=='1') {
|
||||
$today_date = date("Y-m-d").' 00:00:00';
|
||||
$this->db->where('reg_date >=', $today_date);
|
||||
}
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like($search_type, $search_keyword);
|
||||
}
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 - select
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_select($req_data){
|
||||
# request
|
||||
$idx = $req_data;
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_question');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 reply - insert
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_reply_insert($req_data){
|
||||
# request
|
||||
$idx = $req_data['p_idx'];
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$user_name = $this->session->userdata('Adm_Name');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$this->db->select('max(s_idx) + 1 as s_idx');
|
||||
$this->db->where('p_idx', $idx);
|
||||
$this->db->from('bbs_question');
|
||||
$res1 = $this->db->get();
|
||||
$row1 = $res1->result_array();
|
||||
|
||||
$s_idx = $row1[0]['s_idx'];
|
||||
|
||||
$req_data['write_id'] = $user_id;
|
||||
$req_data['write_name'] = $user_name;
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = $user_id;
|
||||
$req_data['update_date']= $now_date;
|
||||
$req_data['s_idx'] = $s_idx;
|
||||
$req_data['is_reply'] = 'Y';
|
||||
$row = $this->db->insert('bbs_question', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 is_reply - update
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_is_reply_update($req_data){
|
||||
# request
|
||||
$idx = $req_data;
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$update_data = array('is_reply' => 'Y',
|
||||
'update_id' => $user_id,
|
||||
'update_date' => $now_date
|
||||
);
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->update('bbs_question', $update_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 is_del update
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_is_del_update($req_data){
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$arr_update_data = array();
|
||||
foreach($req_data as $key=>$val) {
|
||||
$arr_update_data[$key]['idx'] = $val;
|
||||
$arr_update_data[$key]['is_del'] = 'Y';
|
||||
$arr_update_data[$key]['update_id'] = $user_id;
|
||||
$arr_update_data[$key]['update_date'] = $now_date;
|
||||
}
|
||||
$this->db->update_batch('bbs_question', $arr_update_data, 'idx');
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 신규 count
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_new_count(){
|
||||
$now_date = date("Y-m-d").' 00:00:00';
|
||||
$this->db->where('reg_date >=', $now_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('s_idx', '1');
|
||||
$this->db->from('bbs_question');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 처리상태 count
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_group_by_is_reply(){
|
||||
$this->db->select('is_reply, count(is_reply) as cnt');
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('s_idx', '1');
|
||||
$this->db->group_by("is_reply");
|
||||
$this->db->from('bbs_question');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 공지 - insert
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_insert($req_data){
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$user_name = $this->session->userdata('Adm_Name');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$req_data['write_id'] = $user_id;
|
||||
$req_data['write_name'] = $user_name;
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = $user_id;
|
||||
$req_data['update_date']= $now_date;
|
||||
$row = $this->db->insert('bbs_notice', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 공지 - select
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_select($req_data){
|
||||
# request
|
||||
$idx = $req_data;
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 공지 - update
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
unset($req_data['idx']);
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$req_data['update_id'] = $user_id;
|
||||
$req_data['update_date'] = $now_date;
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->update('bbs_notice', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 공지 is_del update
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_is_del_update($req_data){
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$arr_update_data = array();
|
||||
foreach($req_data as $key=>$val) {
|
||||
$arr_update_data[$key]['idx'] = $val;
|
||||
$arr_update_data[$key]['is_del'] = 'Y';
|
||||
$arr_update_data[$key]['update_id'] = $user_id;
|
||||
$arr_update_data[$key]['update_date'] = $now_date;
|
||||
}
|
||||
$this->db->update_batch('bbs_notice', $arr_update_data, 'idx');
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 신규 count
|
||||
# CREATE : 2018-06-11
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_new_count(){
|
||||
$now_date = date("Y-m-d").' 00:00:00';
|
||||
$this->db->where('reg_date >=', $now_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
239
application/models/admin/cs/m_bbs_question.php
Executable file
239
application/models/admin/cs/m_bbs_question.php
Executable file
@@ -0,0 +1,239 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_bbs_question extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 - list
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
$search_click1 = ''; $search_click2 = '';
|
||||
if(isset($req_data['search_click1'])==true) $search_click1 = $req_data['search_click1'];
|
||||
if(isset($req_data['search_click2'])==true) $search_click2 = $req_data['search_click2'];
|
||||
|
||||
if($search_click1=='1') {
|
||||
$today_date = date("Y-m-d").' 00:00:00';
|
||||
$this->db->where('reg_date >=', $today_date);
|
||||
}
|
||||
|
||||
if($search_click2=='1') {
|
||||
$this->db->like('is_reply', 'Y');
|
||||
} else if($search_click2=='2') {
|
||||
$this->db->like('is_reply', 'N');
|
||||
}
|
||||
|
||||
if($search_type!='' && $search_keyword!='') $this->db->like($search_type, $search_keyword);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_question');
|
||||
$this->db->order_by('p_idx desc, s_idx asc');
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 - list - total count
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
$search_click1 = ''; $search_click2 = '';
|
||||
if(isset($req_data['search_click1'])==true) $search_click1 = $req_data['search_click1'];
|
||||
if(isset($req_data['search_click2'])==true) $search_click2 = $req_data['search_click2'];
|
||||
|
||||
if($search_click1=='1') {
|
||||
$today_date = date("Y-m-d").' 00:00:00';
|
||||
$this->db->where('reg_date >=', $today_date);
|
||||
}
|
||||
|
||||
if($search_click2=='1') {
|
||||
$this->db->like('is_reply', 'Y');
|
||||
} else if($search_click2=='2') {
|
||||
$this->db->like('is_reply', 'N');
|
||||
}
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like($search_type, $search_keyword);
|
||||
}
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_question');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 - select
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_select($req_data){
|
||||
# request
|
||||
$idx = $req_data;
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_question');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 reply - insert
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_reply_insert($req_data){
|
||||
# request
|
||||
$idx = $req_data['p_idx'];
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$user_name = $this->session->userdata('Adm_Name');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$this->db->select('max(s_idx) + 1 as s_idx');
|
||||
$this->db->where('p_idx', $idx);
|
||||
$this->db->from('bbs_question');
|
||||
$res1 = $this->db->get();
|
||||
$row1 = $res1->result_array();
|
||||
|
||||
$s_idx = $row1[0]['s_idx'];
|
||||
|
||||
$req_data['write_id'] = $user_id;
|
||||
$req_data['write_name'] = $user_name;
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = $user_id;
|
||||
$req_data['update_date']= $now_date;
|
||||
$req_data['s_idx'] = $s_idx;
|
||||
$req_data['p_idx'] = $idx;
|
||||
$req_data['is_reply'] = 'Y';
|
||||
$row = $this->db->insert('bbs_question', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 is_reply - update
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_is_reply_update($req_data){
|
||||
# request
|
||||
$idx = $req_data;
|
||||
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$update_data = array('is_reply' => 'Y',
|
||||
'update_id' => $user_id,
|
||||
'update_date' => $now_date
|
||||
);
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->update('bbs_question', $update_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 is_del update
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_is_del_update($req_data){
|
||||
$user_id = $this->session->userdata('Adm_Id');
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$arr_update_data = array();
|
||||
foreach($req_data as $key=>$val) {
|
||||
$arr_update_data[$key]['idx'] = $val;
|
||||
$arr_update_data[$key]['is_del'] = 'Y';
|
||||
$arr_update_data[$key]['update_id'] = $user_id;
|
||||
$arr_update_data[$key]['update_date'] = $now_date;
|
||||
}
|
||||
$this->db->update_batch('bbs_question', $arr_update_data, 'idx');
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 신규 count
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_new_count($req_data){
|
||||
|
||||
$search_click2 = '';
|
||||
if(isset($req_data['search_click2'])==true) $search_click2 = $req_data['search_click2'];
|
||||
|
||||
if($search_click2=='1') {
|
||||
$this->db->like('is_reply', 'Y');
|
||||
} else if($search_click2=='2') {
|
||||
$this->db->like('is_reply', 'N');
|
||||
}
|
||||
|
||||
$now_date = date("Y-m-d").' 00:00:00';
|
||||
$this->db->where('reg_date >=', $now_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('s_idx', '1');
|
||||
$this->db->from('bbs_question');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1:1문의 처리상태 count
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_group_by_is_reply($req_data){
|
||||
$search_click1 = '';
|
||||
if(isset($req_data['search_click1'])==true) $search_click1 = $req_data['search_click1'];
|
||||
|
||||
if($search_click1=='1') {
|
||||
$today_date = date("Y-m-d").' 00:00:00';
|
||||
$this->db->where('reg_date >=', $today_date);
|
||||
}
|
||||
|
||||
|
||||
$this->db->select('is_reply, count(is_reply) as cnt');
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('s_idx', '1');
|
||||
$this->db->group_by("is_reply");
|
||||
$this->db->from('bbs_question');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user