正在显示
1 个修改的文件
包含
18 行增加
和
4 行删除
@@ -86,6 +86,20 @@ class MailListV2 extends Base { | @@ -86,6 +86,20 @@ class MailListV2 extends Base { | ||
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | + * 处理like条件 | ||
90 | + * @param $str | ||
91 | + * @return string | ||
92 | + * @author:dc | ||
93 | + * @time 2024/9/4 11:14 | ||
94 | + */ | ||
95 | + private function getLikeStr($str){ | ||
96 | + if(str_starts_with($str, '^')){ | ||
97 | + return addslashes($str).'%%'; | ||
98 | + } | ||
99 | + return '%%'.addslashes($str).'%%'; | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
89 | * 邮件列表 | 103 | * 邮件列表 |
90 | * 接收参数 | 104 | * 接收参数 |
91 | * page 分页 | 105 | * page 分页 |
@@ -182,7 +196,7 @@ class MailListV2 extends Base { | @@ -182,7 +196,7 @@ class MailListV2 extends Base { | ||
182 | if($subject){ | 196 | if($subject){ |
183 | $subject = is_array($subject) ? $subject : [$subject]; | 197 | $subject = is_array($subject) ? $subject : [$subject]; |
184 | foreach ($subject as $k=>$sub){ | 198 | foreach ($subject as $k=>$sub){ |
185 | - $subject[$k] = '`subject` '.(empty($is_auto_inbox)?' not ':'').'like "%%'.addslashes($sub).'%%"'; | 199 | + $subject[$k] = '`subject` '.(empty($is_auto_inbox)?' not ':'').'like "'.$this->getLikeStr($sub).'"'; |
186 | } | 200 | } |
187 | } | 201 | } |
188 | // 不在此邮箱中的 | 202 | // 不在此邮箱中的 |
@@ -190,7 +204,7 @@ class MailListV2 extends Base { | @@ -190,7 +204,7 @@ class MailListV2 extends Base { | ||
190 | if($from_not_in_like){ | 204 | if($from_not_in_like){ |
191 | $from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like]; | 205 | $from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like]; |
192 | foreach ($from_not_in_like as $k=>$sub){ | 206 | foreach ($from_not_in_like as $k=>$sub){ |
193 | - $from_not_in_like[$k] = '`from` '.(empty($is_auto_inbox)?' not ':'').'like "%%'.addslashes($sub).'%%"'; | 207 | + $from_not_in_like[$k] = '`from` '.(empty($is_auto_inbox)?' not ':'').'like "'.$this->getLikeStr($sub).'"'; |
194 | } | 208 | } |
195 | } | 209 | } |
196 | 210 | ||
@@ -291,7 +305,7 @@ class MailListV2 extends Base { | @@ -291,7 +305,7 @@ class MailListV2 extends Base { | ||
291 | if($subject){ | 305 | if($subject){ |
292 | $subject = is_array($subject) ? $subject : [$subject]; | 306 | $subject = is_array($subject) ? $subject : [$subject]; |
293 | foreach ($subject as $k=>$sub){ | 307 | foreach ($subject as $k=>$sub){ |
294 | - $subject[$k] = '`subject` not like "%%'.addslashes($sub).'%%"'; | 308 | + $subject[$k] = '`subject` not like "'.$this->getLikeStr($sub).'"'; |
295 | } | 309 | } |
296 | } | 310 | } |
297 | // 不在此邮箱中的 | 311 | // 不在此邮箱中的 |
@@ -299,7 +313,7 @@ class MailListV2 extends Base { | @@ -299,7 +313,7 @@ class MailListV2 extends Base { | ||
299 | if($from_not_in_like){ | 313 | if($from_not_in_like){ |
300 | $from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like]; | 314 | $from_not_in_like = is_array($from_not_in_like) ? $from_not_in_like : [$from_not_in_like]; |
301 | foreach ($from_not_in_like as $k=>$sub){ | 315 | foreach ($from_not_in_like as $k=>$sub){ |
302 | - $from_not_in_like[$k] = '`from` not like "%%'.addslashes($sub).'%%"'; | 316 | + $from_not_in_like[$k] = '`from` not like "'.$this->getLikeStr($sub).'"'; |
303 | } | 317 | } |
304 | } | 318 | } |
305 | 319 |
-
请 注册 或 登录 后发表评论