陈德本 преди 5 години
родител
ревизия
60cb175e36
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      App/Api/Controller/Msg.php

+ 5 - 1
App/Api/Controller/Msg.php

@@ -53,14 +53,18 @@ class Msg extends Controller
             }else{
                 $key="mails:".$mail_id;
                 $temp=$cache->get($key);
+                unset($temp);
                 if (!$temp) {
                     $detail = $mailbox->getMail($mail_id);
                     if ($from_google){
                         $from_num=$detail->fromName;
                         $txt = explode("\r\n", $detail->textPlain)[1];
+                        $date=$detail->date;
                     }else{
                         $from_num=str_replace("Message from ", "", $detail->subject);
                         $txt=$detail->textPlain;
+                        $rwn=explode("\r\n", $detail->headersRaw);
+                        $date=explode(": ", $rwn[2])[1];
                     }
                     $temp = [
                         'subject' => $detail->subject,
@@ -68,7 +72,7 @@ class Msg extends Controller
                         'from' => $detail->fromAddress,
                         'fromName' => $from_num,
                         'replyTo' => $detail->replyTo,
-                        'date' =>$detail->date,
+                        'date' =>date("Y-m-d H:i:s",strtotime($date)),
                         'cc' => $detail->cc,
                         'bcc' => $detail->bcc,
                     ];