作者 张关杰

x

... ... @@ -254,6 +254,7 @@ trait DbQuery {
* @time 2023/2/17 11:03
*/
public function value(string|array $sql){
return $this->getCacheData($sql,null,\PDO::FETCH_COLUMN);
$query = $this->query($sql);
if($query){
return $query->fetch(\PDO::FETCH_COLUMN);
... ...
... ... @@ -251,7 +251,7 @@ class Mail {
$blacklist = redis()->get('blacklist:'.$email_id);
$blackFolder = '';
if($blacklist){
$blackFolder = $db->value(folderSql::originFolder($email_id,'垃圾箱'));
$blackFolder = $db->cache(86400*30)->value(folderSql::originFolder($email_id,'垃圾箱'));
}
//
... ... @@ -281,13 +281,12 @@ class Mail {
$uids = array_column($uids,'UID');
$existsUids = $db->all(listsSql::getUids($email_id,$folder_id,$uids));
if($existsUids){
$existsUids = array_column($existsUids,'uid');
// 获取不存在数据库的uid
$uids = array_diff($uids,$existsUids);
foreach ($uids as $k=>$uid){
if($db->cache(86400*30)->value(listsSql::first(dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'))){
unset($uids[$k]);
}
}
$msgno += $nu;
... ... @@ -313,7 +312,7 @@ class Mail {
$unseen = $db->count(listsSql::listCount(dbWhere([
'seen' => 0,
'deleted' => 0,
'email_id' => $email_id,
// 'email_id' => $email_id,
'folder_id' => $folder_id,
])));
$db->update(
... ...
... ... @@ -37,14 +37,14 @@ class MailFun {
* @time 2023/3/27 13:55
*/
public static function mb_coding(string $str,array $appcode=[]){
$str = trim($str," \t\n\r");
$str = trim($str);
$str = (new Header())->decode($str);
try {
$encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
if($encode && $encode != 'UTF-8'){
$str = mb_convert_encoding($str, 'UTF-8', $encode);
}
}catch (\Throwable $e){}
// try {
// $encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
// if($encode && $encode != 'UTF-8'){
// $str = mb_convert_encoding($str, 'UTF-8', $encode);
// }
// }catch (\Throwable $e){}
return $str;
... ...