diff --git a/webht/third_party/trippestOrderSync/controllers/send_operation.php b/webht/third_party/trippestOrderSync/controllers/send_operation.php index c4d9bc57..b0200d4e 100644 --- a/webht/third_party/trippestOrderSync/controllers/send_operation.php +++ b/webht/third_party/trippestOrderSync/controllers/send_operation.php @@ -73,15 +73,26 @@ class Send_operation extends CI_Controller { return false; } $order = $ready_order[0]; - if (strtotime($order->GCI_travelDate) < strtotime(date('Y-m-d')) ) { + if (strtotime($order->COLD_StartDate) < strtotime(date('Y-m-d')) ) { echo "已过期"; return; } + $last_update = ""; + $guide_name = ""; + if ($order->gcod != null) { + $split_gcod = explode("@", $order->gcod); + $guide_name = $split_gcod[0]; + $guide_tel = $split_gcod[1]; + $last_update = $split_gcod[2] . " " . $split_gcod[3]; + } else { + $guide_name = strstr($order->eva, "@", true); + $guide_tel = substr(strstr($order->eva, "@"), 1); + } $send_body = array( - "one" => trim($order->GUT_FirstName . " " . $order->GUT_LastName) - ,"two" => substr($order->GCI_travelDate, 0, 10) - ,"three" => $order->GCOD_dutyName - ,"four" => "+86 " . $order->GCOD_dutyTel + "one" => trim($order->guest_name) + ,"two" => substr($order->COLD_StartDate, 0, 10) + ,"three" => $guide_name + ,"four" => "+86 " . $guide_tel ,"phone" => real_phone_number($order->GUT_TEL, $order->GUT_POST) ,"nation_code" => $order->GUT_POST ); @@ -95,7 +106,7 @@ class Send_operation extends CI_Controller { $ht_id = $this->send_model->insert_trippest_sms_log($cb_db); $error_msg = ""; $send_time = date("Y-m-d H:i:s"); - if ($order->GCOD_dutyName !== null) { + if ($guide_name != null) { $send_cb = $this->excute_curl($this->send_url, $send_body); $send_cb_obj = json_decode($send_cb); $update_cb_db["TPSL_sendTime"] = $send_time; @@ -110,15 +121,15 @@ class Send_operation extends CI_Controller { if ($time_flag === "try1") { return; } - if ($order->GCOD_dutyName === null || $error_msg !== "") { + if ($guide_name == null || $error_msg !== "") { // 没有调度或发送失败 // to Alex $operator_mailbody = "
Dear Alex:
" . "导游信息发送客人失败:
订单号:" . $order->COLI_ID ."
" . - "发团时间:" . substr($order->GCI_travelDate, 0, 10) ."
" . - "导游信息:" . $order->GCOD_dutyName . "(" . $order->GCOD_dutyTel . ")" ."
" . - "导游更新时间:" . $order->GCI_createTime . " " . $order->GCOD_creatTime ."
" . + "发团时间:" . substr($order->COLD_StartDate, 0, 10) ."
" . + "导游信息:" . $guide_name . "(" . $guide_tel . ")" ."
" . + "导游更新时间:" . $last_update ."
" . "发送时间:" . $send_time ."
"; if ($error_msg !== "") { $operator_mailbody .= "发送失败信息:" . $error_msg . "
"; diff --git a/webht/third_party/trippestOrderSync/models/send_operation_model.php b/webht/third_party/trippestOrderSync/models/send_operation_model.php index 976de4be..f91606bd 100644 --- a/webht/third_party/trippestOrderSync/models/send_operation_model.php +++ b/webht/third_party/trippestOrderSync/models/send_operation_model.php @@ -38,37 +38,62 @@ class Send_operation_model extends CI_Model { if ($time_flag == "no_send_state") { $send_state_sql = ""; $top = ""; - $sms_state = " ,(select top 1 TPSL_sendState from InfoManager.dbo.trippest_sms_log - where TPSL_COLI_SN=coli.COLI_SN and TPSL_sendContent like '%'+GCOD_startDate+'%' + $sms_state = " ,(SELECT top 1 TPSL_sendState from InfoManager.dbo.trippest_sms_log + where TPSL_COLI_SN=coli.COLI_SN + and TPSL_sendContent like '%'+CONVERT(VARCHAR(10),CONVERT(DATE, COLD_StartDate))+'%' order by TPSL_sendState desc ) as send_state"; } - $search_sql = " AND GCI_travelDate ='$date' "; + $search_sql = " AND COLD_StartDate ='$date' "; if ($COLI_ID !== "") { $search_sql = " AND COLI_ID='" . $COLI_ID . "'"; } - $sql = "SELECT $top GroupCombineOperationDetail.GCOD_SN,COLI_SN,COLI_ID,COLI_groupCode - ,GUT_POST,GUT_TEL - ,PAG_ExtendType,PAG_Code - ,g.GUT_FirstName,g.GUT_LastName - ,gci.* - ,GCOD_startDate,GCOD_operationType,GCOD_dutyName,GCOD_dutyTel,GCOD_creatTime - $sms_state - FROM BIZ_ConfirmLineInfo coli - INNER JOIN BIZ_ConfirmLineDetail cold ON COLD_COLI_SN=COLI_SN + $sql = "SELECT $top + COLI_GroupCode,COLI_SN,COLI_ID + $sms_state + ,GUT_POST,GUT_TEL + ,PAG_Code + ,g.GUT_FirstName+' '+g.GUT_LastName guest_name + ,( + select top 1 GCOD_dutyName+'@'+GCOD_dutyTel+'@'+convert(varchar(20),GCOD_creatTime)+'@'+convert(varchar(20),GCI_createTime) + from GroupCombineInfo + inner join GroupCombineOperationDetail on GCOD_GCI_combineNo=GCI_combineNo + AND GCI_combineNo not IN ('cancel','forbidden') + where GCI_GRI_SN=COLI_GRI_SN + AND GCOD_operationType='guiderOperations' + ) as gcod + ,( + select top 1 TGI2_Name+'@'+TGI_Mobile from Eva_ObjectInfo + left join + ( select TGI_SN,TGI_Mobile,TGI2_Name from TouristGuideInfo tgi + left join TouristGuideInfo2 tgi2 on TGI2_TGI_SN=TGI_SN and TGI2_LGC=1 + ) as tgi_info on tgi_info.TGI_SN=EOI_ObjSN + where EOI_GRI_SN=COLI_GRI_SN and EOI_Type=3 + ) as eva + ,COLD_StartDate + from BIZ_ConfirmLineInfo coli + inner join BIZ_ConfirmLineDetail cold on COLI_SN=COLD_COLI_SN INNER JOIN BIZ_GUEST g ON g.GUT_SN=COLI_GUT_SN and GUT_TEL is not null and GUT_TEL<>'' and GUT_POST<>'' INNER JOIN BIZ_PackageInfo pag ON pag.PAG_SN=COLD_ServiceSN - LEFT JOIN GroupCombineInfo gci ON COLI_GRI_SN=GCI_GRI_SN - LEFT JOIN GroupCombineOperationDetail ON GCOD_GCI_combineNo=GCI_combineNo - AND GCOD_operationType='guiderOperations' WHERE 1=1 + and COLI_State not in (30,40,50) $search_sql - AND GCI_combineNo not IN ('cancel','forbidden') AND '39009'<>PAG_ExtendType $send_state_sql - ORDER BY GCI_travelDate, COLI_SN - "; + and (exists ( + select top 1 1 from GroupCombineInfo + inner join GroupCombineOperationDetail on GCOD_GCI_combineNo=GCI_combineNo + AND GCI_combineNo not IN ('cancel','forbidden') + where GCI_GRI_SN=COLI_GRI_SN + AND GCOD_operationType='guiderOperations' + ) + OR exists ( + select top 1 1 from Eva_ObjectInfo + where EOI_GRI_SN=COLI_GRI_SN and EOI_Type=3 + ) + ) + ORDER BY COLD_StartDate, COLI_SN"; $query = $this->HT->query($sql); return $query->result(); } diff --git a/webht/third_party/trippestOrderSync/views/sms_log.php b/webht/third_party/trippestOrderSync/views/sms_log.php index 3a597c80..08c17eeb 100644 --- a/webht/third_party/trippestOrderSync/views/sms_log.php +++ b/webht/third_party/trippestOrderSync/views/sms_log.php @@ -93,7 +93,7 @@