This commit is contained in:
@@ -135,7 +135,7 @@ class DeptModel extends Model
|
||||
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
|
||||
} else {
|
||||
|
||||
$builder->where('a.isSiteVRVerification', 'N');
|
||||
// $builder->where('a.isSiteVRVerification', 'N');
|
||||
|
||||
// 접수일자
|
||||
/*
|
||||
@@ -228,10 +228,7 @@ class DeptModel extends Model
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->groupStart()
|
||||
->like('a.agent_head_tel', $data['srchTxt'])
|
||||
->orLike('a.agent_head_tel', $data['srchTxt'])
|
||||
->orLike('a.sellr_tel_no', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
}
|
||||
@@ -277,7 +274,7 @@ class DeptModel extends Model
|
||||
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
|
||||
} else {
|
||||
|
||||
$builder->where('a.isSiteVRVerification', 'N');
|
||||
// $builder->where('a.isSiteVRVerification', 'N');
|
||||
|
||||
// 접수일자
|
||||
/*
|
||||
@@ -418,7 +415,7 @@ class DeptModel extends Model
|
||||
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
|
||||
} else {
|
||||
|
||||
$builder->where('b.req_rec_yn', 'Y');
|
||||
// $builder->where('b.req_rec_yn', 'Y');
|
||||
|
||||
// 접수일자
|
||||
/*
|
||||
@@ -662,7 +659,7 @@ class DeptModel extends Model
|
||||
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
|
||||
} else {
|
||||
|
||||
$builder->where('b.req_rec_yn', 'Y');
|
||||
// $builder->where('b.req_rec_yn', 'Y');
|
||||
|
||||
// 접수일자
|
||||
/*
|
||||
@@ -769,10 +766,7 @@ class DeptModel extends Model
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->groupStart()
|
||||
->like('a.agent_head_tel', $data['srchTxt'])
|
||||
->orLike('a.agent_head_tel', $data['srchTxt'])
|
||||
->orLike('a.sellr_tel_no', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
}
|
||||
@@ -845,97 +839,32 @@ class DeptModel extends Model
|
||||
|
||||
$builder = $this->db->table('receipt a');
|
||||
|
||||
$builder->select("a.rcpt_sq
|
||||
,a.comp_sq
|
||||
,a.rcpt_rating
|
||||
,a.rcpt_key
|
||||
,a.rcpt_atclno
|
||||
,a.rcpt_type
|
||||
,a.rcpt_product
|
||||
,a.rcpt_product_nm
|
||||
,a.rcpt_product_area
|
||||
,a.rcpt_product_price
|
||||
,a.rcpt_product_info1
|
||||
,a.rcpt_product_info2
|
||||
,a.rcpt_product_info3
|
||||
,a.rcpt_product_info4
|
||||
,a.rcpt_product_info5
|
||||
,a.rcpt_ptp_nm
|
||||
,a.rcpt_office
|
||||
,(CASE WHEN a.rcpt_agent IS NULL THEN 'N' ELSE 'Y' END) as rcpt_agent
|
||||
,a.rcpt_sido
|
||||
,a.rcpt_gugun
|
||||
,a.rcpt_dong
|
||||
,IFNULL(a.rcpt_hscp_nm, '') AS rcpt_hscp_nm
|
||||
,IFNULL(a.rcpt_ho, '') AS rcpt_ho
|
||||
,a.rcpt_dtl_addr
|
||||
,a.rcpt_li_addr
|
||||
,a.rcpt_jibun_addr
|
||||
,IFNULL(a.rcpt_etc_addr, '') AS rcpt_etc_addr
|
||||
,a.rcpt_floor
|
||||
,a.rcpt_tm
|
||||
,a.rcpt_stat
|
||||
,a.rcpt_x
|
||||
,a.rcpt_y
|
||||
,a.rcpt_living_yn
|
||||
,a.cust_nm
|
||||
,a.cust_tel1
|
||||
,a.cust_tel2
|
||||
,a.cust_zip
|
||||
,a.cust_addr1
|
||||
,a.cust_addr2
|
||||
,a.remark
|
||||
,a.agent_id
|
||||
,a.agent_nm
|
||||
,a.agent_head
|
||||
,a.agent_head_tel
|
||||
,a.agent_contact
|
||||
,a.agent_contact_tel
|
||||
,IFNULL(a.agent_tel, '') AS agent_tel
|
||||
,a.sply_spc
|
||||
,a.excls_spc
|
||||
,a.room_cnt
|
||||
,a.exp_spc_yn
|
||||
,a.agent_fax
|
||||
,DATE_FORMAT(COALESCE(b.rsrv_date, a.rsrv_date), '%Y-%m-%d') AS rsrv_date
|
||||
,COALESCE(b.rsrv_tm_ap, a.rsrv_tm_ap) as rsrv_tm_ap
|
||||
,a.insert_usr
|
||||
,a.insert_tm
|
||||
,a.update_usr
|
||||
,a.update_tm
|
||||
,a.svc_type1
|
||||
,a.svc_type2
|
||||
,a.reconf_yn
|
||||
,f.cd_nm as trade_type_nm
|
||||
,b.rsrv_sq
|
||||
,b.dept_sq
|
||||
,b.usr_sq
|
||||
,b.rsrv_tm_hour
|
||||
,b.result_cd1
|
||||
,b.result_cd2
|
||||
,b.result_msg
|
||||
,b.request_msg
|
||||
,b.photo_save_dt
|
||||
,b.rsrv_delay_dt
|
||||
,b.rsrv_cplt_dt
|
||||
,b.check_dt
|
||||
,b.check_cplt_dt
|
||||
,b.record_cplt_dt
|
||||
,get_code_name('RECEIPT_STATUS1', substring(a.rcpt_stat, 1, 2)) AS rcpt_stat_nm
|
||||
,c.region_nm as addr
|
||||
,b.result_save_dt
|
||||
,u.usr_nm
|
||||
,d.dept_nm
|
||||
,a.exp_photo_yn
|
||||
,a.ground_plan
|
||||
,CASE (SELECT COUNT(1) FROM result_imgs WHERE rsrv_sq=b.rsrv_sq AND img_type = 'I1' AND use_yn = 'Y') WHEN 0 THEN 'N' ELSE 'Y' END conf_img_yn
|
||||
,CASE (SELECT COUNT(1) FROM result_imgs WHERE rsrv_sq=b.rsrv_sq AND img_type = 'I5' AND use_yn = 'Y') WHEN 0 THEN 'N' ELSE 'Y' END ground_plan_yn
|
||||
,a.exp_movie_yn
|
||||
,a.direct_trad_yn
|
||||
,a.sellr_nm
|
||||
,a.sellr_tel_no
|
||||
,a.isSiteVRVerification
|
||||
,a.isPromotionApply");
|
||||
$builder->select("
|
||||
CASE WHEN b.result_cd1 = '90' THEN get_code_name('RECEIPT_STATUS2', b.result_cd2) ELSE '' END AS '매물ID',
|
||||
a.rcpt_atclno AS '예약일자',
|
||||
b.rsrv_tm_hour AS '중개사명',
|
||||
b.photo_save_dt AS '대표전화',
|
||||
a.agent_contact_tel AS '담당자전화',
|
||||
CASE
|
||||
WHEN IFNULL(a.rcpt_jibun_addr, '') = '' THEN
|
||||
CASE
|
||||
WHEN IFNULL(a.rcpt_hscp_nm, '') = '' THEN
|
||||
CONCAT(c.region_nm, ' ', a.rcpt_dtl_addr, ' ', a.rcpt_ho)
|
||||
ELSE
|
||||
CONCAT(c.region_nm, ' ', a.rcpt_hscp_nm, ' ', a.rcpt_dtl_addr, ' ', a.rcpt_ho)
|
||||
END
|
||||
ELSE
|
||||
CASE
|
||||
WHEN IFNULL(a.rcpt_li_addr, '') != '' THEN
|
||||
CONCAT(c.region_nm, ' ', a.rcpt_li_addr, ' ', a.rcpt_jibun_addr, ' ', a.rcpt_etc_addr)
|
||||
ELSE
|
||||
CONCAT(c.region_nm, ' ', a.rcpt_jibun_addr, ' ', a.rcpt_etc_addr)
|
||||
END
|
||||
END AS '주소',
|
||||
a.rcpt_product_nm AS '매물종류',
|
||||
a.rcpt_product_info1 AS '거래구분',
|
||||
u.usr_nm AS '담당자',
|
||||
b.request_msg AS '중개사 요청사항'");
|
||||
|
||||
$builder->join('result b', 'a.rcpt_sq = b.rcpt_sq', 'left');
|
||||
$builder->join('region_codes c', 'a.rcpt_dong = c.region_cd', 'inner');
|
||||
@@ -958,7 +887,7 @@ class DeptModel extends Model
|
||||
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
|
||||
} else {
|
||||
|
||||
$builder->where('b.req_rec_yn', 'Y');
|
||||
// $builder->where('b.req_rec_yn', 'Y');
|
||||
|
||||
// 접수일자
|
||||
/*
|
||||
@@ -1065,10 +994,7 @@ class DeptModel extends Model
|
||||
$builder->groupStart()
|
||||
->like('a.agent_nm', $data['srchTxt'])
|
||||
->orLike('a.sellr_nm', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
|
||||
$builder->groupStart()
|
||||
->like('a.agent_head_tel', $data['srchTxt'])
|
||||
->orLike('a.agent_head_tel', $data['srchTxt'])
|
||||
->orLike('a.sellr_tel_no', $data['srchTxt'])
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Models\article;
|
||||
|
||||
use App\Models\common\CodeModel;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class ReceiptModel extends Model
|
||||
@@ -1182,9 +1183,79 @@ class ReceiptModel extends Model
|
||||
return $builder->get()->getRowArray();
|
||||
}
|
||||
|
||||
public function getDupleGP($rcpt_key, $rcpt_sido, $rcpt_gugun, $rcpt_dong, $rcpt_hscp_nm, $rcpt_dtl_addr, $rcpt_ho)
|
||||
{
|
||||
$sql = "select rcpt_sq, c.rcpt_key, c.photo_save_dt from" .
|
||||
" (select a.rcpt_sq, b.rsrv_sq, a.rcpt_key, b.photo_save_dt " .
|
||||
" from receipt a " .
|
||||
" LEFT OUTER JOIN result b ON b.rcpt_sq = a.rcpt_sq " .
|
||||
" where a.rcpt_sido = ? " .
|
||||
" and a.rcpt_gugun = ? " .
|
||||
" and a.rcpt_dong = ? " .
|
||||
" and a.rcpt_hscp_nm = ? " .
|
||||
" and a.rcpt_dtl_addr = ? " .
|
||||
" and a.rcpt_ho = ? " .
|
||||
" and a.insert_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH) " .
|
||||
" and a.rcpt_key != ? " .
|
||||
" and b.result_cd3 = 600000) c " .
|
||||
" LEFT OUTER JOIN result_imgs d ON c.rsrv_sq = d.rsrv_sq " .
|
||||
" where d.img_type = 'I5'";
|
||||
|
||||
$data = [
|
||||
$rcpt_sido,
|
||||
$rcpt_gugun,
|
||||
$rcpt_dong,
|
||||
$rcpt_hscp_nm,
|
||||
$rcpt_dtl_addr,
|
||||
$rcpt_ho,
|
||||
$rcpt_key
|
||||
];
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
return $res->getResultArray();
|
||||
}
|
||||
|
||||
public function getDupleGP_na($rcpt_key, $rcpt_sido, $rcpt_gugun, $rcpt_dong, $rcpt_hscp_nm, $rcpt_dtl_addr, $rcpt_li_addr, $rcpt_jibun_addr, $rcpt_etc_addr)
|
||||
{
|
||||
$sql = "select rcpt_sq, c.rcpt_key, c.photo_save_dt from" .
|
||||
" (select a.rcpt_sq, b.rsrv_sq, a.rcpt_key, b.photo_save_dt " .
|
||||
" from receipt a " .
|
||||
" LEFT OUTER JOIN result b ON b.rcpt_sq = a.rcpt_sq " .
|
||||
" where a.rcpt_sido = ? " .
|
||||
" and a.rcpt_gugun = ? " .
|
||||
" and a.rcpt_dong = ? " .
|
||||
" and a.rcpt_hscp_nm = ? " .
|
||||
" and a.rcpt_li_addr = ? " .
|
||||
" and a.rcpt_jibun_addr = ? " .
|
||||
" and a.rcpt_etc_addr = ? " .
|
||||
" and a.insert_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH) " .
|
||||
" and a.rcpt_key != ? " .
|
||||
" and b.result_cd3 = 600000) c " .
|
||||
" LEFT OUTER JOIN result_imgs d ON c.rsrv_sq = d.rsrv_sq " .
|
||||
" where d.img_type = 'I5'";
|
||||
|
||||
$data = [
|
||||
$rcpt_sido,
|
||||
$rcpt_gugun,
|
||||
$rcpt_dong,
|
||||
$rcpt_hscp_nm,
|
||||
isset($rpct_li_addr) ? $rpct_li_addr : '',
|
||||
$rcpt_jibun_addr,
|
||||
$rcpt_etc_addr,
|
||||
$rcpt_key
|
||||
];
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
return $res->getResultArray();
|
||||
}
|
||||
|
||||
// 정보변경이력
|
||||
public function getHistory($id)
|
||||
{
|
||||
$sql = "SELECT rcpt_sq FROM receipt WHERE rcpt_key = ?";
|
||||
$query = $query = $this->db->query($sql, [$id]);
|
||||
$rcpt_sq = $query->getRow()->rcpt_sq;
|
||||
|
||||
$sql = "SELECT seq" .
|
||||
" ,rcpt_sq" .
|
||||
" ,rcpt_stat" .
|
||||
@@ -1199,7 +1270,7 @@ class ReceiptModel extends Model
|
||||
" WHERE rcpt_sq = ?" .
|
||||
" ORDER BY changed_tm DESC";
|
||||
|
||||
$data = [$id];
|
||||
$data = [$rcpt_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
|
||||
return $query->getResultArray();
|
||||
@@ -1254,6 +1325,60 @@ class ReceiptModel extends Model
|
||||
return $query2->getResultArray();
|
||||
}
|
||||
|
||||
// 체크리스트 결과 조회
|
||||
public function getChecklist($rsrv_sq)
|
||||
{
|
||||
$sql = "select rsrv_sq, elevator_yn, maintenance_fee, elevator_cctv_yn, building_in_cctv_yn, building_ou_cctv_yn, heating_type, security_dept_yn, parking_lot_yn, interphone_yn, building_security_yn, window_direction, living_room_yn, balcony_yn, balcony_ext_yn, restroom_cnt, bath_yn, showerbooth_yn, utility_yn, built_in_chest_yn, airconditioner_yn, shoe_chest_yn, dress_room_yn, gas_stove_yn, refrigerator_yn, sink_yn, washing_machine_yn, insert_usr, insert_tm from result_check where rsrv_sq = ?";
|
||||
$data = [$rsrv_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getRowArray();
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function getImageList2($rsrv_sq)
|
||||
{
|
||||
$sql = "SELECT * " .
|
||||
" FROM result_imgs" .
|
||||
" WHERE rsrv_sq = ?" .
|
||||
" AND use_yn = 'Y'" .
|
||||
" ORDER BY rsrv_sq, view_odr";
|
||||
|
||||
$data = [$rsrv_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
public function getImageCountByType($rsrv_sq)
|
||||
{
|
||||
$sql = "SELECT img_type, COUNT(*) img_cnt" .
|
||||
" FROM result_imgs" .
|
||||
" WHERE rsrv_sq = ?" .
|
||||
" AND use_yn = 'Y'" .
|
||||
" GROUP BY img_type";
|
||||
$data = [$rsrv_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
// 녹취파일정보
|
||||
public function getRecordInfo($rsrv_sq)
|
||||
{
|
||||
$sql = "SELECT record_sq, rsrv_sq, use_yn, record_path, record_filenm, record_orignm, record_size, record_tel, record_nm, record_dt, remark, insert_usr, insert_tm, update_usr, update_tm" .
|
||||
" FROM result_record" .
|
||||
" WHERE rsrv_sq = ?" .
|
||||
" AND record_sq = (SELECT MAX(record_sq)" .
|
||||
" FROM result_record" .
|
||||
" WHERE rsrv_sq = ?)";
|
||||
$data = array(
|
||||
$rsrv_sq,
|
||||
$rsrv_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getRowArray();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// 연락처 저장
|
||||
public function saveTel($rcpt_sq, $tel)
|
||||
{
|
||||
@@ -1287,6 +1412,187 @@ class ReceiptModel extends Model
|
||||
];
|
||||
}
|
||||
|
||||
// 평면도요청 저장
|
||||
public function saveGround($rcpt_sq, $ground_plan)
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
$sql = "UPDATE receipt" .
|
||||
" SET ground_plan = ?" .
|
||||
" WHERE rcpt_sq = ?";
|
||||
|
||||
$data = [$ground_plan, $rcpt_sq];
|
||||
|
||||
if ($this->db->query($sql, $data) === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장실패',
|
||||
];
|
||||
}
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
|
||||
// 동영상촬영여부 저장
|
||||
public function saveRequestMovie($rcpt_sq, $rsrv_sq, $exp_movie_yn)
|
||||
{
|
||||
$this->db->transStart();
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "SELECT a.result_cd3, b.exp_movie_yn FROM result a INNER JOIN receipt b ON b.rcpt_sq = a.rcpt_sq WHERE rsrv_sq = ?";
|
||||
$data = [$rsrv_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getRowArray();
|
||||
|
||||
$sql = "UPDATE receipt" .
|
||||
" SET exp_movie_yn = ?" .
|
||||
" WHERE rcpt_sq = ?";
|
||||
$data = [$exp_movie_yn, $rcpt_sq];
|
||||
|
||||
|
||||
if ($this->db->query($sql, $data) === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장실패',
|
||||
];
|
||||
}
|
||||
|
||||
$this->saveChangedHistory($rcpt_sq, $row['result_cd3'], 'C24', $usr_id, $row['exp_movie_yn'] . ' => ' . $exp_movie_yn);
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
// 중개사메모 저장
|
||||
public function saveRequestMessage($rcpt_sq, $rsrv_sq, $request_msg)
|
||||
{
|
||||
$this->db->transStart();
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
if (empty($rsrv_sq)) {
|
||||
$sql = "SELECT rsrv_sq FROM result WHERE rcpt_sq = ? ORDER BY rsrv_sq DESC LIMIT 1";
|
||||
$data = [$rcpt_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getResultArray();
|
||||
|
||||
$rsrv_sq = $row['rsrv_sq'];
|
||||
}
|
||||
|
||||
$sql = "SELECT result_cd3, request_msg FROM result WHERE rsrv_sq = ?";
|
||||
$data = [$rsrv_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getResultArray();
|
||||
|
||||
$sql = "UPDATE result" .
|
||||
" SET request_msg = ?" .
|
||||
" WHERE rsrv_sq = ?" .
|
||||
" AND rcpt_sq = ?";
|
||||
$data = [
|
||||
'request_msg' => $request_msg,
|
||||
'rsrv_sq' => $rsrv_sq,
|
||||
'rcpt_sq' => $rcpt_sq
|
||||
];
|
||||
|
||||
|
||||
if ($this->db->query($sql, $data) === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장실패',
|
||||
];
|
||||
}
|
||||
|
||||
$memo = "메모변경";
|
||||
$this->saveChangedHistory($rcpt_sq, $row['result_cd3'], 'C19', $usr_id, $memo);
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// 문자발송
|
||||
public function sendSms($dest_phone, $dest_name, $send_phone, $send_name, $msg_type, $rsrv_sq, $rcpt_sq, $cd, $data)
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
|
||||
$sql = "SELECT DATE_FORMAT(NOW(), '%Y%m%d-%H%i%s') as cmid, NOW() as currDttm FROM DUAL";
|
||||
$query = $this->db->query($sql);
|
||||
$row = $query->getRowArray();
|
||||
|
||||
$cmid = $row['cmid'];
|
||||
$currDate = $row['currDttm'];
|
||||
|
||||
$category = 'SMS_MSG_TYPE';
|
||||
if ($data['comp_sq'] == '2') {
|
||||
$category = 'SMS_MSG_TYPE2';
|
||||
}
|
||||
|
||||
$codeModel = new CodeModel();
|
||||
$code = $codeModel->getCodeDetail($category, $cd);
|
||||
|
||||
$subject = $code['category_nm'];
|
||||
|
||||
if ($cd === "S10") {
|
||||
$body = sprintf($code['cd_nm'], $data['rcpt_atclno'], $data['agent_nm'], $data['addr'], $data['rcpt_hscp_nm'], $data['rcpt_dtl_addr'], $data['rcpt_ho']);
|
||||
} else {
|
||||
$body = $code['cd_nm'];
|
||||
}
|
||||
|
||||
$body = str_replace('#매물번호#', $data['rcpt_atclno'], $code['cd_nm']);
|
||||
|
||||
$msg_length = strlen(iconv('UTF-8', 'EUCKR', $body));
|
||||
if ($msg_length > 80 && $msg_type == 0) {
|
||||
$msg_type = 5;
|
||||
}
|
||||
|
||||
$param = [
|
||||
//'cmid' => $cmid,
|
||||
'dest_phone' => $dest_phone,
|
||||
'dest_name' => $dest_name,
|
||||
'send_phone' => $send_phone,
|
||||
'send_name' => $send_name,
|
||||
'subject' => $subject,
|
||||
'msg_body' => $body,
|
||||
'msg_type' => $msg_type,
|
||||
'request_time' => $currDate,
|
||||
'send_time' => $currDate,
|
||||
'etc1' => $rsrv_sq,
|
||||
'etc2' => $cd
|
||||
];
|
||||
|
||||
$this->db->transStart();
|
||||
$this->db->table('ums_data')->insert($param);
|
||||
$this->db->table('ums_log')->insert($param);
|
||||
|
||||
$remark = "문자 발송 - " . $subject . "(" . $dest_phone . ")";
|
||||
$this->saveChangedHistory($rcpt_sq, $data['rcpt_stat'], 'C8', $usr_id, $remark);
|
||||
$this->db->transComplete();
|
||||
|
||||
if ($this->db->transStatus() === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장실패',
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function saveChangedHistory($rcpt_sq, $rcpt_stat, $changed_type, $usr_id, $remark)
|
||||
{
|
||||
@@ -1303,4 +1609,104 @@ class ReceiptModel extends Model
|
||||
];
|
||||
$res = $this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
|
||||
// 거주인정보저장
|
||||
public function saveRecInfo($data)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
$usr_sq = session('usr_sq');
|
||||
|
||||
$this->db->transStart();
|
||||
|
||||
$detail = $this->getDetail($data['rcpt_key']);
|
||||
|
||||
!empty($data['file']) ? $rec_yn = "Y" : $rec_yn = "N";
|
||||
|
||||
$param = [
|
||||
$rec_yn,
|
||||
$data['rec_tel'],
|
||||
$data['rec_nm'],
|
||||
$data['rec_remark'],
|
||||
$usr_sq,
|
||||
$data['rsrv_sq'],
|
||||
];
|
||||
|
||||
$sql = "UPDATE result SET
|
||||
rec_yn = ? ";
|
||||
if ($rec_yn == "Y") {
|
||||
$sql .= ", record_cplt_dt = NOW()";
|
||||
}
|
||||
$sql .= ", rec_tel = ?
|
||||
, rec_nm = ?
|
||||
, remark = ?
|
||||
, update_tm = NOW()
|
||||
, update_usr = ?
|
||||
WHERE rsrv_sq = ?
|
||||
";
|
||||
|
||||
if ($this->db->query($sql, $param) === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장실패',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
if (!empty($data['file'])) {
|
||||
$rec_sql = "SELECT * FROM result_record WHERE rsrv_sq = ? AND use_yn = 'Y'";
|
||||
$rec_data = array($data['rsrv_sq']);
|
||||
$query = $this->db->query($rec_sql, $rec_data);
|
||||
$preData = $query->getRowArray();
|
||||
|
||||
|
||||
$f = $data['file'];
|
||||
|
||||
$sql = "INSERT INTO result_record
|
||||
(rsrv_sq, use_yn, record_path, record_filenm, record_orignm, record_size, record_tel, record_nm, record_dt, remark, insert_usr, insert_tm, cloud_upload_yn)
|
||||
VALUES
|
||||
(?, 'Y', ?, ?, ?, ?, ?, ?, NOW(), ?, ?, NOW(), 'Y')
|
||||
";
|
||||
$param = [
|
||||
$data['rsrv_sq'],
|
||||
$f['file_path'],
|
||||
$f['new_name'],
|
||||
$f['orig_name'],
|
||||
$f['size'],
|
||||
$data['rec_tel'],
|
||||
$data['rec_nm'],
|
||||
$data['rec_remark'],
|
||||
$usr_sq
|
||||
];
|
||||
|
||||
$this->db->query($sql, $param);
|
||||
|
||||
// 이전 데이터 미사용 처리
|
||||
if (!empty($preData)) {
|
||||
$rec_sql = "UPDATE result_record SET use_yn = 'N' WHERE record_sq = ? AND rsrv_sq = ?";
|
||||
$this->db->query($rec_sql, [$preData['record_sq'], $data['rsrv_sq']]);
|
||||
|
||||
$remark = "녹취파일 업로드 - " . $preData['record_nm'] . "(" . $preData['record_tel'] . ") -> " . $data['rec_nm'] . "(" . $data['rec_tel'] . ")";
|
||||
} else {
|
||||
$remark = "녹취파일 업로드 - " . $data['rec_nm'] . "(" . $data['rec_tel'] . ")";
|
||||
}
|
||||
|
||||
$this->saveChangedHistory($data['rcpt_sq'], $detail['rcpt_stat'], 'C15', $usr_id, $remark);
|
||||
|
||||
}
|
||||
|
||||
if (!empty($detail['rec_tel'])) {
|
||||
$remark = "거주인정보변경 - " . $detail['rec_nm'] . "(" . $detail['rec_tel'] . ") -> " . $data['rec_nm'] . "(" . $data['rec_tel'] . ")";
|
||||
} else {
|
||||
$remark = "거주인정보변경 - " . $data['rec_nm'] . "(" . $data['rec_tel'] . ")";
|
||||
}
|
||||
|
||||
$this->saveChangedHistory($data['rcpt_sq'], $detail['rcpt_stat'], 'C15', $usr_id, $remark);
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user