作者 邓超

1

@@ -44,7 +44,7 @@ class Home extends Base { @@ -44,7 +44,7 @@ class Home extends Base {
44 } 44 }
45 45
46 // 附件 46 // 附件
47 - $attachment = app()->request('attachment'); 47 + $attachment = app()->request('attachment',0,'bool_Val');
48 // 已读/未读 48 // 已读/未读
49 $seen = app()->request('seen',-1,'intval'); 49 $seen = app()->request('seen',-1,'intval');
50 // 软删 50 // 软删
@@ -375,13 +375,12 @@ class Home extends Base { @@ -375,13 +375,12 @@ class Home extends Base {
375 HOME_INFO_BODY: 375 HOME_INFO_BODY:
376 // 循环几次 376 // 循环几次
377 if($sync_num < 1){ 377 if($sync_num < 1){
  378 + $data['to_name'] = json_decode($data['to_name']??"[]",true);
378 $body = db()->first(bodySql::first($id)); 379 $body = db()->first(bodySql::first($id));
379 if($body){ 380 if($body){
  381 + $data['body'] = json_decode($body['text_html'],true);
380 return [ 382 return [
381 - 'data' => [  
382 - 'info' => $data,  
383 - 'body' => json_decode($body['text_html'],true)  
384 - ] 383 + 'data' => $data
385 ]; 384 ];
386 } 385 }
387 386
@@ -344,8 +344,28 @@ function folderAlias($folder){ @@ -344,8 +344,28 @@ function folderAlias($folder){
344 } 344 }
345 345
346 346
  347 +/**
  348 + * true false
  349 + * @param $val
  350 + * @return bool
  351 + * @author:dc
  352 + * @time 2023/4/1 17:42
  353 + */
  354 +function bool_Val($val):bool {
  355 + if($val == 'true'){
  356 + return true;
  357 + }
  358 + if($val == 'false'){
  359 + return false;
  360 + }
  361 +
  362 + if(is_numeric($val)){
  363 + return intval($val) ? true : false;
  364 + }
347 365
  366 + return $val ? true : false;
348 367
  368 +}
349 369
350 370
351 371
@@ -585,9 +585,15 @@ class Imap { @@ -585,9 +585,15 @@ class Imap {
585 } 585 }
586 586
587 587
588 - $result[$key]['HEADER.FIELDS']['Subject'] = MailFun::mb_coding($result[$key]['HEADER.FIELDS']['Subject'],$charset);  
589 - $result[$key]['HEADER.FIELDS']['From'] = MailFun::mb_coding($result[$key]['HEADER.FIELDS']['From'],$charset);  
590 - $result[$key]['HEADER.FIELDS']['To'] = MailFun::mb_coding($result[$key]['HEADER.FIELDS']['To'],$charset); 588 + if(!empty($result[$key]['HEADER.FIELDS']['Subject'])){
  589 + $result[$key]['HEADER.FIELDS']['Subject'] = MailFun::mb_coding($result[$key]['HEADER.FIELDS']['Subject'],$charset);
  590 + }
  591 + if(!empty($result[$key]['HEADER.FIELDS']['From'])){
  592 + $result[$key]['HEADER.FIELDS']['From'] = MailFun::mb_coding($result[$key]['HEADER.FIELDS']['From'],$charset);
  593 + }
  594 + if(!empty($result[$key]['HEADER.FIELDS']['To'])){
  595 + $result[$key]['HEADER.FIELDS']['To'] = MailFun::mb_coding($result[$key]['HEADER.FIELDS']['To'],$charset);
  596 + }
591 597
592 } 598 }
593 599
@@ -256,15 +256,21 @@ class Mail { @@ -256,15 +256,21 @@ class Mail {
256 foreach ($results as $insert){ 256 foreach ($results as $insert){
257 if(empty($uuids[$insert['uuid']])){ 257 if(empty($uuids[$insert['uuid']])){
258 // 新增 258 // 新增
259 - $id = $db->insert(listsSql::$table,$insert);  
260 - // 同步body内容  
261 - redis()->rPush('sync_email_body', [  
262 - 'lists_id' => $id,  
263 - 'email_id' => $email_id,  
264 - 'folder_id' => $folder_id,  
265 - 'folder' => $folder,  
266 - 'uid' => $insert['uid'],  
267 - ]); 259 + try {
  260 + $id = $db->insert(listsSql::$table,$insert);
  261 + // 同步body内容
  262 + redis()->rPush('sync_email_body', [
  263 + 'lists_id' => $id,
  264 + 'email_id' => $email_id,
  265 + 'folder_id' => $folder_id,
  266 + 'folder' => $folder,
  267 + 'uid' => $insert['uid'],
  268 + ]);
  269 + }catch (\Throwable $e){
  270 +
  271 + }
  272 +
  273 +
268 }else{ 274 }else{
269 // 修改 275 // 修改
270 $db->update( 276 $db->update(