陈德本 5 yıl önce
ebeveyn
işleme
164c8f0795
2 değiştirilmiş dosya ile 23 ekleme ve 7 silme
  1. 22 6
      App/Api/Controller/Msg.php
  2. 1 1
      App/Api/Template/Msg.phtml

+ 22 - 6
App/Api/Controller/Msg.php

@@ -24,8 +24,17 @@ class Msg extends Controller
             __DIR__, // Directory, where attachments will be saved (optional)
             'UTF-8' // Server encoding (optional)
         );
-
-        $mail_ids = $mailbox->searchMailbox('FROM txt.voice.google.com');
+        $num=$this->getQuery()->string("num","6288883915");
+        $from_google=false;
+        if ($num=="6288883915"){
+            $mail_ids = $mailbox->searchMailbox('FROM txt.voice.google.com');
+            $from_google=true;
+        }else{
+            if ($num=="6285000156"){
+                $mail_ids = $mailbox->searchMailbox('FROM textnow.me');
+                $from_google=false;
+            }
+        }
 //        $mail_info = $mailbox->getMailsInfo($mail_ids);
         $mail_info=[];
         $mail_ids=array_reverse($mail_ids);
@@ -46,14 +55,20 @@ class Msg extends Controller
                 $temp=$cache->get($key);
                 if (!$temp) {
                     $detail = $mailbox->getMail($mail_id);
-                    $txt = explode("\r\n", $detail->textPlain);
+                    if ($from_google){
+                        $from_num=$detail->fromName;
+                        $txt = explode("\r\n", $detail->textPlain)[1];
+                    }else{
+                        $from_num=str_replace("Message from ", "", $detail->subject);
+                        $txt=$detail->textPlain;
+                    }
                     $temp = [
                         'subject' => $detail->subject,
-                        'content' => $txt[1],
+                        'content' => $txt,
                         'from' => $detail->fromAddress,
-                        'fromName' => $detail->fromName,
+                        'fromName' => $from_num,
                         'replyTo' => $detail->replyTo,
-                        'date' => $detail->date,
+                        'date' =>$detail->date,
                         'cc' => $detail->cc,
                         'bcc' => $detail->bcc,
                     ];
@@ -66,6 +81,7 @@ class Msg extends Controller
 
         }
         $this->result=$mail_info;
+        $this->num=$num;
         $this->render();
     }
 }

+ 1 - 1
App/Api/Template/Msg.phtml

@@ -8,7 +8,7 @@
 <body>
 <div class="message-container">
     <div class="message-details">
-        当前接收号码:(+1)628 888 3915【仅展示最新5条短信,如果没有显示,请刷新几次】
+        当前接收号码:(+1)<?php echo $this->num;?>【仅展示最新5条短信,如果没有显示,请刷新几次】
         <?php
         foreach ($this->result as $item) {
         ?>