作者 邓超

x

@@ -73,12 +73,16 @@ class HotMail { @@ -73,12 +73,16 @@ class HotMail {
73 private $folder = []; 73 private $folder = [];
74 74
75 private function run($id){ 75 private function run($id){
76 - $list = $this->db->all(\Model\listsSql::all(dbWhere(['id'=>$id,'is_hots'=>0]),'`id`,`from`,`to`,`folder_id`')); 76 + $list = $this->db->all(\Model\listsSql::all(dbWhere(['id'=>$id]),'`id`,`from`,`to`,`folder_id`,`is_hots`'));
77 foreach ($list as $item){ 77 foreach ($list as $item){
78 if(empty($this->folder[$item['folder_id']])){ 78 if(empty($this->folder[$item['folder_id']])){
79 $this->folder[$item['folder_id']] = folderAlias($this->db->value(\Model\folderSql::first($item['folder_id'],'folder'))); 79 $this->folder[$item['folder_id']] = folderAlias($this->db->value(\Model\folderSql::first($item['folder_id'],'folder')));
80 } 80 }
81 81
  82 + if(!in_array($this->folder[$item['folder_id']],['收件箱','发件箱'])){
  83 + continue;
  84 + }
  85 +
82 // 是否是发件箱 86 // 是否是发件箱
83 if($this->folder[$item['folder_id']] == '发件箱'){ 87 if($this->folder[$item['folder_id']] == '发件箱'){
84 $w = ['email' => array_map('strtolower',explode(',',$item['to']))]; 88 $w = ['email' => array_map('strtolower',explode(',',$item['to']))];
@@ -91,10 +95,17 @@ class HotMail { @@ -91,10 +95,17 @@ class HotMail {
91 $this->hotEmail[$mkey] = $this->db->count('select count(*) from `hot_mail` where '.dbWhere($w)); 95 $this->hotEmail[$mkey] = $this->db->count('select count(*) from `hot_mail` where '.dbWhere($w));
92 } 96 }
93 97
94 - if(!$this->hotEmail[$mkey]){  
95 - 98 + if($this->hotEmail[$mkey]){
  99 + if(!$item['is_hots']){
96 $ret = $this->db->update(listsSql::$table,['is_hots'=>1],dbWhere(['id'=>$item['id']])); 100 $ret = $this->db->update(listsSql::$table,['is_hots'=>1],dbWhere(['id'=>$item['id']]));
97 - echo date('d H:i:s').' ==》 '.$item['id'].':'.$ret."\n"; 101 + echo date('d H:i:s').' +==》 '.$item['id'].':'.$ret."\n";
  102 + }
  103 +
  104 + }else{
  105 + if($item['is_hots']){
  106 + $ret = $this->db->update(listsSql::$table,['is_hots'=>0],dbWhere(['id'=>$item['id']]));
  107 + echo date('d H:i:s').' -==》 '.$item['id'].':'.$ret."\n";
  108 + }
98 } 109 }
99 } 110 }
100 } 111 }