diff --git a/webht/third_party/trippestOrderSync/controllers/send_operation.php b/webht/third_party/trippestOrderSync/controllers/send_operation.php index 21a70ac1..548da41e 100644 --- a/webht/third_party/trippestOrderSync/controllers/send_operation.php +++ b/webht/third_party/trippestOrderSync/controllers/send_operation.php @@ -82,6 +82,23 @@ class Send_operation extends CI_Controller { echo "已过期"; return; } + $has_send = false; + $send_history = $this->send_model->order_sms_list($order->COLI_SN); + if ( ! empty($send_history)) { + $has_send = true; + $new_number = mb_ereg_replace('[\D]', '', $order->GUT_POST) . real_phone_number($order->GUT_TEL, mb_ereg_replace('[\D]', '', $order->GUT_POST)); + $last_send = end($send_history); + $last_send_number = $last_send->TPSL_nationCode . $last_send->TPSL_mobile; + $last_send_cb = json_decode($last_send->TPSL_callbackJson); + if ($last_send_cb->result == 1016 && $new_number == $last_send_number) { + // 更新时间, 以免一直重复在这个订单 + $update_cb_db['TPSL_logTime'] = date("Y-m-d H:i:s"); + $update_where = " TPSL_SN=" . $last_send->TPSL_SN; + $ht_id = $this->send_model->update_trippest_sms_log($update_where, $update_cb_db); + echo "手机号错误且未变更"; + return; + } + } $last_update = ""; $guide_name = ""; if ($order->gcod != null) { @@ -125,31 +142,33 @@ class Send_operation extends CI_Controller { $ht_id = $this->send_model->update_trippest_sms_log($update_where, $update_cb_db); $send_cb_obj->errmsg!=="OK" ? $error_msg=$send_cb_obj->errmsg : null; } - if ($time_flag === "try1") { - return; - } - if ($guide_name == null || $error_msg !== "") { - // 没有调度或发送失败 - // to Alex - $operator_mailbody = "

Dear Alex:

" . - "

导游信息发送客人失败:

" . - "

订单号:" . $order->COLI_ID ."

" . - "

发团时间:" . substr($order->COLD_StartDate, 0, 10) ."

" . - "

导游信息:" . $guide_name . "(" . $guide_tel . ")" ."

" . - "

导游更新时间:" . $last_update ."

" . - "

发送时间:" . $send_time ."

"; - if ($error_msg !== "") { - $operator_mailbody .= "

发送失败信息:" . $error_msg . "

"; + // if ($time_flag === "try1") { + // return; + // } + if ($has_send == false) { + if ($guide_name == null || $error_msg !== "") { + // 没有调度或发送失败 + // to Alex + $operator_mailbody = "

Dear Alex:

" . + "

导游信息发送客人失败:

" . + "

订单号:" . $order->COLI_ID ."

" . + "

发团时间:" . substr($order->COLD_StartDate, 0, 10) ."

" . + "

导游信息:" . $guide_name . "(" . $guide_tel . ")" ."

" . + "

导游更新时间:" . $last_update ."

" . + "

发送时间:" . $send_time ."

"; + if ($error_msg !== "") { + $operator_mailbody .= "

发送失败信息:" . $error_msg . "

"; + } + $operator_mailbody .= "

Tracking Link.

"; + $operator_mailbody .= "

此邮件由系统自动发送, 请勿回复.

"; + $this->send_model->SendMail( + "chinahighlights", + "webform@chinahighlights.net", + "YSL", + "alex@chinahighlights.net", // ysl email alex@chinahighlights.net + '#SMS send fail# ' . $order->COLI_ID, + $operator_mailbody); } - $operator_mailbody .= "

Tracking Link.

"; - $operator_mailbody .= "

此邮件由系统自动发送, 请勿回复.

"; - $this->send_model->SendMail( - "chinahighlights", - "webform@chinahighlights.net", - "YSL", - "alex@chinahighlights.net", // ysl email alex@chinahighlights.net - '#SMS send fail# ' . $order->COLI_ID, - $operator_mailbody); } echo "已发送"; return;