作者 邓超

x

@@ -58,25 +58,28 @@ class Home extends Base { @@ -58,25 +58,28 @@ class Home extends Base {
58 58
59 $where = ['email_id'=>$this->getEmails('id')]; 59 $where = ['email_id'=>$this->getEmails('id')];
60 60
61 - // 目录  
62 - $folder = app()->request('folder','收件箱');  
63 - $folderList = db()->all(folderSql::all($where['email_id'])); 61 +
64 $folder_id = []; 62 $folder_id = [];
65 - // 文件夹id  
66 - if($folderList){  
67 - foreach ($folderList as $item){  
68 - if(  
69 - // 数组文件夹  
70 - (is_array($folder) && in_array($item['folder'],$folder))  
71 - || $item['folder'] == $folder  
72 - ){  
73 - $folder_id[] = $item['id']; 63 + if (app()->requestArr('folder_id')){
  64 + $folder_id = app()->requestArr('folder_id');
  65 + }else{
  66 + // 目录
  67 + $folder = app()->request('folder','收件箱');
  68 + $folderList = db()->all(folderSql::all($where['email_id']));
  69 +
  70 + // 文件夹id
  71 + if($folderList){
  72 + foreach ($folderList as $item){
  73 + if(
  74 + // 数组文件夹
  75 + (is_array($folder) && in_array($item['folder'],$folder))
  76 + || $item['folder'] == $folder
  77 + ){
  78 + $folder_id[] = $item['id'];
  79 + }
74 } 80 }
75 } 81 }
76 } 82 }
77 - if (app()->requestArr('folder_id')){  
78 - $folder_id = array_merge($folder_id,app()->requestArr('folder_id'));  
79 - }  
80 83
81 if(!$folder_id){ 84 if(!$folder_id){
82 app()->e('folder_not_fount'); 85 app()->e('folder_not_fount');
@@ -45,7 +45,7 @@ class folderSql { @@ -45,7 +45,7 @@ class folderSql {
45 */ 45 */
46 public static function first(array|string|int $where,$filed = '*'):string { 46 public static function first(array|string|int $where,$filed = '*'):string {
47 $where = is_numeric($where) ? ['id'=>$where] : $where; 47 $where = is_numeric($where) ? ['id'=>$where] : $where;
48 - return "select {$filed} from `".self::$table."` where ".dbWhere($where)." order by `id` desc limit 1"; 48 + return "select {$filed} from `".self::$table."` where ".dbWhere($where)." limit 1";
49 } 49 }
50 50
51 /** 51 /**
@@ -57,7 +57,7 @@ class folderSql { @@ -57,7 +57,7 @@ class folderSql {
57 * @time 2023/5/8 11:01 57 * @time 2023/5/8 11:01
58 */ 58 */
59 public static function originFolder(int $email_id,string $folder){ 59 public static function originFolder(int $email_id,string $folder){
60 - return "select `origin_folder` from `".static::$table."` where `email_id` = {$email_id} and `folder` = '{$folder}' order by `id` desc limit 1"; 60 + return "select `origin_folder` from `".static::$table."` where `email_id` = {$email_id} and `folder` = '{$folder}' limit 1";
61 } 61 }
62 62
63 } 63 }