作者 邓超

x

... ... @@ -3,6 +3,7 @@
namespace Service;
use Event\Event;
use Lib\Imap\Fun;
use Lib\Imap\ImapConfig;
use Lib\Imap\ImapPool;
use Lib\Imap\Parse\Folder\Folder;
... ... @@ -429,12 +430,12 @@ class SyncMail {
$id = $this->db->throw()->insert(listsSql::$table,$data);
}catch (\Throwable $e){
// 字符串编码异常
if(stripos($e->getMessage(),'SQLSTATE[HY000]: General error: 1366 Incorrect string value:')!==false){
if(stripos($e->getMessage(),'Incorrect string value:')!==false){
// 编码异常的 字段
preg_match("/for column '([a-z0-9_]{2,})' at/",$e->getMessage(),$filed);
if(!empty($filed[1]) && isset($data[$filed[1]])){
// 进行编码转换 大概率会失败
$data[$filed[1]] = mb_convert_encoding($data[$filed[1]],'UTF-8');
$data[$filed[1]] = Fun::mb_convert_encoding($data[$filed[1]],'UTF-8');
}
$id = $this->insert($data,$num+1);
... ...