作者 邓超

x

@@ -37,18 +37,24 @@ class Home extends Base { @@ -37,18 +37,24 @@ class Home extends Base {
37 37
38 $folder_ids = app()->request('folder_ids',[],['intval','abs']); 38 $folder_ids = app()->request('folder_ids',[],['intval','abs']);
39 39
40 - if(!is_array($folder_ids)){  
41 - app()->_json([]);  
42 - }  
43 -  
44 $where = ['email_id' => $this->getEmail('id')]; 40 $where = ['email_id' => $this->getEmail('id')];
45 41
  42 + // 默认查询 inbox
  43 + if(!is_array($folder_ids)){
  44 + $folder_ids = db()->value(
  45 + sprintf(
  46 + "select `id` from `%s` where `email_id` = %d and `origin_folder` = 'INBOX'",
  47 + folderSql::$table
  48 + ,$where['email_id']
  49 + )
  50 + );
  51 + }
46 //目录 52 //目录
47 $where['folder_id'] = $folder_ids; 53 $where['folder_id'] = $folder_ids;
48 54
49 $lists = db()->all( 55 $lists = db()->all(
50 sprintf( 56 sprintf(
51 - "select `id`,`subject` from `%s` where `id` > %d %s order by `id` asc limit %d" 57 + "select `id`,`subject`,`seen`,`udate` from `%s` where `id` > %d %s order by `id` asc limit %d"
52 ,listsSql::$table 58 ,listsSql::$table
53 ,$last_id 59 ,$last_id
54 ,dbWhere($where) 60 ,dbWhere($where)