| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?
- include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
- include $_SERVER['DOCUMENT_ROOT'].'/common/lib/biztalk.php';
- /*
- 필요 함수 /common/lib/func.php에 정의
- lock 시스템
- 1. 낙찰리스트, 진행중 리스트
- 1차 발송
- 2차 발송
- 3차 발송 후 2일 후 해당 계정 입찰 안되게
- 관리자가 해제 할 수 있음
- 2. 3차 발송 후 기간 지나면 락 처리
- 1차 발송후 5일후 자동으로 2차발송 2차발송후 3일후 3차발송 : 10일 후 락 처리
- /cron/tender_sms_lock.php
- 1. 낙찰 중인 건 진행중인 건
- depth = 3 && ds_send_status = 'Z0' && ds_lock_status = 'B0'
- 진행중이나 견적실수로로 넘어갈 경우
- (((s.ds_status_contract is null or s.ds_status_contract = '' or s.ds_status_contract = 'Z0') and s.ds_status_contract_step1 = 'Y')
- or s.ds_status in ('ZE') and (s.ds_status_contract is null or s.ds_status_contract = '') ) 로 변경 됐으면
- //견적실수
- // and s.ds_status in ('ZE') and (s.ds_status_contract is null or s.ds_status_contract = '')
- ds_lock_status = A0 update
- 상태 변경이 없을 경우
- ds_lock_status = Z0 update
- tender_master
- ds_lock_status = 'A0'
- dt_lock : 현재시간
- 2. 진행중인건
- depth = 3 && ds_send_status = 'Z0' && ds_lock_status = 'B0'
- 현재 매물이 Z0 이고 거래완료나, 거래 실패/거래연기, 등으로 변경이 됐으면
- //해약
- // s.ds_status in ('Z0') and s.ds_status_contract in ('C0')
- //거래연기
- // and s.ds_status in ('Z0') and s.ds_status_contract in ('B0')
- //판매완료
- // and s.ds_status in ('ZS')
- ds_lock_status = A0 update
- 상태 변경이 없을 경우
- ds_lock_status = Z0 update
- tender_master
- ds_lock_status = 'A0'
- dt_lock : 현재시간
- */
- exit;
- //3차 발송완료, 락이 필요한 상태, 발송시간+2일이 현재 보다 작은 건 취합
- $sql = "select *
- from tender_sms_master
- where depth = 3
- and ds_send_status = 'Z0'
- and ds_lock_status = 'B0'
- and DATE_ADD(dt_send, INTERVAL 2 DAY) < now() ";
- $res = mysql_query($sql);
- while($col = mysql_fetch_array($res)) {
- $cd_tender_sms = $col['cd_tender_sms'];
- $cd_sale = $col['cd_sale'];
- $cd_tender = $col['cd_tender'];
- $depth = $col['depth'];
- $ds_status = $col['ds_status'];
- //경매 정보 불러옴
- $r = mysql_query("SELECT
- a.*
- , b.nm_model
- , c.nm_grade
- , d.nm_brand
- , e.nm_model_sub
- , getCode('car_master','ds_type',a.ds_type) as nm_type
- , getCode('car_master','ds_open',a.ds_open) as nm_open
- , getCode('car_master','ds_sales',a.ds_sales) as nm_sales
- , getCode('car_master','ds_transmission',a.ds_transmission) as nm_transmission
- , getCode('member_master','ds_area',s.ds_area) as nm_area
- , getCode('sale_master','ds_status',s.ds_status) as nm_status
- , s.cd_sale
- , f.cd_tender cd_tender
- , s.ds_status as ds_status_sale
- , f.nm_hp tender_nm_hp
- , s.ds_status_contract
- , s.ds_status_contract_step1
- FROM sale_master s
- inner join car_master a on (s.cd_car = a.cd_car)
- left outer join car_model b on (a.cd_model = b.cd_model)
- left outer join car_grade c on (a.cd_grade = c.cd_grade)
- left outer join car_brand d on (a.cd_brand = d.cd_brand)
- left outer join car_model_sub e on (a.cd_model_sub = e.cd_model_sub)
- inner join tender_master f on (s.cd_sale = f.cd_sale and f.ds_status = 'Z0' and f.ds_delind = 'N' and f.cd_tender = '$cd_tender')
- where s.cd_sale = '". $cd_sale . "' and s.ds_delind = 'N' LIMIT 1");
- $sale_col = mysql_fetch_array($r);
- if(empty($sale_col['cd_sale'])) {
- continue;
- }
- $is_cancel = false;
- switch($ds_status) {
- //낙찰중인건
- case 'Z0':
- //진행중으로 변경이 됐거나 ZE 견적실수로 변경 됐을 경우 락 필요치 않음 으로 업데이트
- if((((empty($sale_col['ds_status_contract']) || $sale_col['ds_status_contract'] == 'Z0') && $sale_col['ds_status_contract_step1'] == 'Y')
- || ($sale_col['ds_status_sale'] == 'ZE' && empty($sale_col['ds_status_contract'])))) {
- $is_cancel = true;
- }
- break;
- //진행중인건
- case 'Z1':
- //해약
- // s.ds_status in ('Z0') and s.ds_status_contract in ('C0')
- //거래연기
- // and s.ds_status in ('Z0') and s.ds_status_contract in ('B0')
- //판매완료
- // and s.ds_status in ('ZS')
- if($sale_col['ds_status_sale'] == 'Z0' && $sale_col['ds_status_contract'] == 'C0') {
- $is_cancel = true;
- }else if($sale_col['ds_status_sale'] == 'Z0' && $sale_col['ds_status_contract'] == 'B0') {
- $is_cancel = true;
- }else if($sale_col['ds_status_sale'] == 'ZS') {
- $is_cancel = true;
- }
- break;
- default:
- continue;
- break;
- }
- //락이 필요치 않은 매울이면 락 필요 없음 처리
- if($is_cancel == true) {
- no_lock_tender_sms($cd_tender_sms);
- continue;
- }
- //여기까지 오면 lock처리
- //tender sms lock update
- lock_tender_sms($cd_tender, $cd_tender_sms);
- }
- ?>
|