load->database(); $this->load->library('session'); } #--------------------------------------------------------------------------- # PURPOSE : list - total count # CREATE : 2018-03-13 #--------------------------------------------------------------------------- function comment_where_write_id_list_total_count($req_data){ # request $write_id = $req_data['write_id']; $this->db->where('write_id', $write_id); $this->db->from('comment'); $row = $this->db->count_all_results(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : list # CREATE : 2018-03-13 #--------------------------------------------------------------------------- function comment_where_write_id_list($req_data){ # request $offset = $req_data['offset']; $limit = $req_data['limit']; $write_id = $req_data['write_id']; $this->db->where('write_id', $write_id); $this->db->from('comment'); $this->db->limit($limit, $offset); $res = $this->db->get(); $row = $res->result_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : is_del update - news # CREATE : 2018-03-13 #--------------------------------------------------------------------------- function comment_is_del_where_write_id_update($req_data){ # request $write_id = $req_data['write_id']; $comment_status = $req_data['comment_status']; $comment = $req_data['comment']; $content_type = $req_data['content_type']; $user_id = $this->session->userdata('Adm_Id'); $sql = "update comment set comment_status = '".$comment_status."' , comment_org = comment , comment = '".$comment."' , is_del = 'Y' , update_id = '".$user_id."' , update_date = now() where content_type = '".$content_type."' and write_id = '".$write_id."' and is_del = 'N'"; $this->db->query($sql); } #--------------------------------------------------------------------------- # PURPOSE : blind 해지 update # CREATE : 2018-03-28 #--------------------------------------------------------------------------- function comment_blind_stop_update($req_data){ # request $idx = $req_data['idx']; $comment_status = $req_data['comment_status']; $user_id = $this->session->userdata('Adm_Id'); $sql = "update comment set comment_status = '".$comment_status."' , comment = comment_org , is_del = 'N' , update_id = '".$user_id."' , update_date = now() where idx = '".$idx."'"; $this->db->query($sql); } #--------------------------------------------------------------------------- # PURPOSE : contents update # CREATE : 2018-02-22 #--------------------------------------------------------------------------- function comment_is_best_all_update(){ $user_id = 'system'; $now_date = date("Y-m-d H:i:s"); $update_data = array('is_best' => 'N', 'update_id' => $user_id, 'update_date' => $now_date ); $this->db->where('is_best', 'Y'); $row = $this->db->update('comment', $update_data); return $row; } #--------------------------------------------------------------------------- # PURPOSE : contents update # CREATE : 2018-02-22 #--------------------------------------------------------------------------- function comment_is_best_update($req_data){ # request $content_type = $req_data['content_type']; $like_count = $req_data['like_count']; $limit = $req_data['limit']; $user_id = 'system'; $now_date = date("Y-m-d H:i:s"); $update_data = array('is_best' => 'Y', 'update_id' => $user_id, 'update_date' => $now_date ); $this->db->where('is_best', 'N'); $this->db->where('content_type', $content_type); $this->db->where('like_count>=', $like_count); $this->db->order_by('reg_date', 'desc'); $this->db->limit($limit, 0); $row = $this->db->update('comment', $update_data); return $row; } #--------------------------------------------------------------------------- # PURPOSE : select # CREATE : 2018-04-27 #--------------------------------------------------------------------------- function comment_select($idx){ # request $this->db->where('idx', $idx); $this->db->from('comment'); $res = $this->db->get(); $row = $res->row_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : update # CREATE : 2018-03-21 #--------------------------------------------------------------------------- function comment_update($req_data){ # request $idx = $req_data['idx']; unset($req_data['idx']); $this->db->where('idx', $idx); $row = $this->db->update('comment', $req_data); return $row; } #--------------------------------------------------------------------------- # PURPOSE : select # CREATE : 2018-04-27 #--------------------------------------------------------------------------- function comment_where_p_idx_select($p_idx){ # request $this->db->where('p_idx', $p_idx); $this->db->where('s_idx', '1'); $this->db->from('comment'); $res = $this->db->get(); $row = $res->row_array(); return $row; } } ?>