From 16bf3af463a8c21e653d41ac05819dcb50eb90b7 Mon Sep 17 00:00:00 2001 From: cyc Date: Mon, 11 May 2020 09:43:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=89=E4=BB=B6=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trainsystem/controllers/api.php | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/application/third_party/trainsystem/controllers/api.php b/application/third_party/trainsystem/controllers/api.php index fc1c9598..9cbb365c 100644 --- a/application/third_party/trainsystem/controllers/api.php +++ b/application/third_party/trainsystem/controllers/api.php @@ -143,14 +143,37 @@ class api extends CI_Controller{ } //发邮件给外联 - function send_mail_to_wl($subject,$body,$coli_id){ + function send_mail_to_wl($subject=null,$body=null,$coli_id=null){ + header('Access-Control-Allow-Origin:*'); + header('Access-Control-Allow-Methods:POST, GET'); + header('Access-Control-Max-Age:0'); + header('Access-Control-Allow-Headers:x-requested-with, Content-Type'); + header('Access-Control-Allow-Credentials:true'); $fromName = "cyc"; $fromEmail = "cyc@hainatravel.com"; - //获取该订单的操作员的邮箱以及姓名 - $info = $this->BIZ_train_model->get_operatorInfo($coli_id); - $toName = $info[0]->OPI_Name; - $toEmail = $info[0]->OPI_Email; - $this->Sendmail_model->SendMailToTable($fromName,$fromEmail,$toName,$toEmail,$subject,$body); + if(empty($coli_id)){ + $toName = 'Sharon'; + $toEmail = 'Sharon@hainatravel.com'; + $fromEmail = $this->input->get_post('concatEmail'); + $body = $this->input->get_post('addrequest'); + if(empty($fromEmail) && empty($body)){ + exit('error'); + } + }else{ + //获取该订单的操作员的邮箱以及姓名 + $info = $this->BIZ_train_model->get_operatorInfo($coli_id); + $toName = $info[0]->OPI_Name; + $toEmail = $info[0]->OPI_Email; + } + + $obj = $this->Sendmail_model->SendMailToTable($fromName,$fromEmail,$toName,$toEmail,$subject,$body); + + if($obj){ + exit('{"status":"200","reason":"邮件发送成功"}'); + }else{ + header("HTTP/1.1 404 Not Found"); + exit('{"status":"404","reason":"邮件发送失败"}'); + } } //导出账单api