陈德本 5 lat temu
rodzic
commit
60cb175e36
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      App/Api/Controller/Msg.php

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

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