正在显示
3 个修改的文件
包含
15 行增加
和
15 行删除
@@ -254,6 +254,7 @@ trait DbQuery { | @@ -254,6 +254,7 @@ trait DbQuery { | ||
254 | * @time 2023/2/17 11:03 | 254 | * @time 2023/2/17 11:03 |
255 | */ | 255 | */ |
256 | public function value(string|array $sql){ | 256 | public function value(string|array $sql){ |
257 | + return $this->getCacheData($sql,null,\PDO::FETCH_COLUMN); | ||
257 | $query = $this->query($sql); | 258 | $query = $this->query($sql); |
258 | if($query){ | 259 | if($query){ |
259 | return $query->fetch(\PDO::FETCH_COLUMN); | 260 | return $query->fetch(\PDO::FETCH_COLUMN); |
@@ -251,7 +251,7 @@ class Mail { | @@ -251,7 +251,7 @@ class Mail { | ||
251 | $blacklist = redis()->get('blacklist:'.$email_id); | 251 | $blacklist = redis()->get('blacklist:'.$email_id); |
252 | $blackFolder = ''; | 252 | $blackFolder = ''; |
253 | if($blacklist){ | 253 | if($blacklist){ |
254 | - $blackFolder = $db->value(folderSql::originFolder($email_id,'垃圾箱')); | 254 | + $blackFolder = $db->cache(86400*30)->value(folderSql::originFolder($email_id,'垃圾箱')); |
255 | } | 255 | } |
256 | 256 | ||
257 | // | 257 | // |
@@ -281,13 +281,12 @@ class Mail { | @@ -281,13 +281,12 @@ class Mail { | ||
281 | 281 | ||
282 | 282 | ||
283 | $uids = array_column($uids,'UID'); | 283 | $uids = array_column($uids,'UID'); |
284 | - $existsUids = $db->all(listsSql::getUids($email_id,$folder_id,$uids)); | ||
285 | - if($existsUids){ | ||
286 | - $existsUids = array_column($existsUids,'uid'); | ||
287 | - // 获取不存在数据库的uid | ||
288 | - $uids = array_diff($uids,$existsUids); | 284 | + foreach ($uids as $k=>$uid){ |
285 | + if($db->cache(86400*30)->value(listsSql::first(dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'))){ | ||
286 | + unset($uids[$k]); | ||
287 | + } | ||
289 | } | 288 | } |
290 | - | 289 | + |
291 | 290 | ||
292 | $msgno += $nu; | 291 | $msgno += $nu; |
293 | 292 | ||
@@ -313,7 +312,7 @@ class Mail { | @@ -313,7 +312,7 @@ class Mail { | ||
313 | $unseen = $db->count(listsSql::listCount(dbWhere([ | 312 | $unseen = $db->count(listsSql::listCount(dbWhere([ |
314 | 'seen' => 0, | 313 | 'seen' => 0, |
315 | 'deleted' => 0, | 314 | 'deleted' => 0, |
316 | - 'email_id' => $email_id, | 315 | + // 'email_id' => $email_id, |
317 | 'folder_id' => $folder_id, | 316 | 'folder_id' => $folder_id, |
318 | ]))); | 317 | ]))); |
319 | $db->update( | 318 | $db->update( |
@@ -37,14 +37,14 @@ class MailFun { | @@ -37,14 +37,14 @@ class MailFun { | ||
37 | * @time 2023/3/27 13:55 | 37 | * @time 2023/3/27 13:55 |
38 | */ | 38 | */ |
39 | public static function mb_coding(string $str,array $appcode=[]){ | 39 | public static function mb_coding(string $str,array $appcode=[]){ |
40 | - $str = trim($str," \t\n\r"); | 40 | + $str = trim($str); |
41 | $str = (new Header())->decode($str); | 41 | $str = (new Header())->decode($str); |
42 | - try { | ||
43 | - $encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5')); | ||
44 | - if($encode && $encode != 'UTF-8'){ | ||
45 | - $str = mb_convert_encoding($str, 'UTF-8', $encode); | ||
46 | - } | ||
47 | - }catch (\Throwable $e){} | 42 | + // try { |
43 | + // $encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5')); | ||
44 | + // if($encode && $encode != 'UTF-8'){ | ||
45 | + // $str = mb_convert_encoding($str, 'UTF-8', $encode); | ||
46 | + // } | ||
47 | + // }catch (\Throwable $e){} | ||
48 | 48 | ||
49 | 49 | ||
50 | return $str; | 50 | return $str; |
-
请 注册 或 登录 后发表评论