作者 邓超

x

@@ -87,7 +87,7 @@ class Msg extends Request{ @@ -87,7 +87,7 @@ class Msg extends Request{
87 */ 87 */
88 public function uid(array|int $uids):static { 88 public function uid(array|int $uids):static {
89 $this->isUid = true; 89 $this->isUid = true;
90 - $this->number = is_array($uids) ? $uids : [$uids]; 90 + $this->setNumber($uids);
91 return $this; 91 return $this;
92 } 92 }
93 93
@@ -100,11 +100,23 @@ class Msg extends Request{ @@ -100,11 +100,23 @@ class Msg extends Request{
100 */ 100 */
101 public function msgno(array|int $msgno):static { 101 public function msgno(array|int $msgno):static {
102 $this->isUid = false; 102 $this->isUid = false;
103 - $this->number = is_array($msgno)?$msgno:[$msgno]; 103 + $this->setNumber($msgno);
104 return $this; 104 return $this;
105 } 105 }
106 106
107 /** 107 /**
  108 + * 设置邮件编号
  109 + * @param array|int $number
  110 + * @author:dc
  111 + * @time 2024/11/12 9:23
  112 + */
  113 + protected function setNumber(array|int $number){
  114 + $this->number = array_map(function ($n){
  115 + return intval($n);
  116 + },is_array($number) ? $number : [$number]);
  117 + }
  118 +
  119 + /**
108 * 搜索 120 * 搜索
109 * @param ImapSearch $search 121 * @param ImapSearch $search
110 * @return $this 122 * @return $this