作者 邓超

x

... ... @@ -73,12 +73,16 @@ class HotMail {
private $folder = [];
private function run($id){
$list = $this->db->all(\Model\listsSql::all(dbWhere(['id'=>$id,'is_hots'=>0]),'`id`,`from`,`to`,`folder_id`'));
$list = $this->db->all(\Model\listsSql::all(dbWhere(['id'=>$id]),'`id`,`from`,`to`,`folder_id`,`is_hots`'));
foreach ($list as $item){
if(empty($this->folder[$item['folder_id']])){
$this->folder[$item['folder_id']] = folderAlias($this->db->value(\Model\folderSql::first($item['folder_id'],'folder')));
}
if(!in_array($this->folder[$item['folder_id']],['收件箱','发件箱'])){
continue;
}
// 是否是发件箱
if($this->folder[$item['folder_id']] == '发件箱'){
$w = ['email' => array_map('strtolower',explode(',',$item['to']))];
... ... @@ -91,10 +95,17 @@ class HotMail {
$this->hotEmail[$mkey] = $this->db->count('select count(*) from `hot_mail` where '.dbWhere($w));
}
if(!$this->hotEmail[$mkey]){
if($this->hotEmail[$mkey]){
if(!$item['is_hots']){
$ret = $this->db->update(listsSql::$table,['is_hots'=>1],dbWhere(['id'=>$item['id']]));
echo date('d H:i:s').' ==》 '.$item['id'].':'.$ret."\n";
echo date('d H:i:s').' +==》 '.$item['id'].':'.$ret."\n";
}
}else{
if($item['is_hots']){
$ret = $this->db->update(listsSql::$table,['is_hots'=>0],dbWhere(['id'=>$item['id']]));
echo date('d H:i:s').' -==》 '.$item['id'].':'.$ret."\n";
}
}
}
}
... ...