作者 邓超

x

@@ -418,31 +418,19 @@ class Mail { @@ -418,31 +418,19 @@ class Mail {
418 } 418 }
419 419
420 // 插入数据库 420 // 插入数据库
421 - try {  
422 // 主题太长了就截取掉 421 // 主题太长了就截取掉
423 $data['subject'] = mb_substr($data['subject'],0,3500); 422 $data['subject'] = mb_substr($data['subject'],0,3500);
424 - $id = $db->insert(listsSql::$table,$data); 423 + try {
  424 + $id = $db->throw()->insert(listsSql::$table,$data);
  425 + }catch (\Throwable $e){
425 // 插入失败,尝试更新 426 // 插入失败,尝试更新
426 - if(!$id){  
427 $db->update(listsSql::$table,$data,dbWhere([ 427 $db->update(listsSql::$table,$data,dbWhere([
428 'email_id'=> $data['email_id'], 428 'email_id'=> $data['email_id'],
429 'folder_id' => $data['folder_id'], 429 'folder_id' => $data['folder_id'],
430 'uid' => $data['uid'] 430 'uid' => $data['uid']
431 ])); 431 ]));
432 } 432 }
433 -// if($id){  
434 - // 同步body内容  
435 -// redis()->rPush('sync_email_body', [  
436 -// 'lists_id' => $id,  
437 -// 'email_id' => $email_id,  
438 -// 'folder_id' => $folder_id,  
439 -// 'folder' => $folder,  
440 -// 'uid' => $data['uid'],  
441 -// ]);  
442 -// }  
443 - }catch (\Throwable $e){  
444 433
445 - }  
446 434
447 $results[$key] = []; 435 $results[$key] = [];
448 } 436 }