瀏覽代碼

Update PM\PMPost page

Visman 4 年之前
父節點
當前提交
cc781fc97c
共有 1 個文件被更改,包括 20 次插入4 次删除
  1. 20 4
      app/Models/Pages/PM/PMPost.php

+ 20 - 4
app/Models/Pages/PM/PMPost.php

@@ -233,19 +233,35 @@ class PMPost extends AbstractPM
             $topic->first_post_id = $post->id;
             $topic->first_post_id = $post->id;
         }
         }
 
 
-        $this->user->u_pm_last_post = $now;
-
         $this->pms->update(Cnst::PTOPIC, $topic->calcStat());
         $this->pms->update(Cnst::PTOPIC, $topic->calcStat());
-        $this->pms->updateFromPTopics(true, $topic);
 
 
-        if (null !== $v->archive) {
+        // новый диалог в архив
+        if (
+            $this->newTopic
+            && Cnst::PT_ARCHIVE === $topic->poster_status
+        ) {
             $message = 'PM to archive Redirect';
             $message = 'PM to archive Redirect';
+        // новый диалог в активные
         } elseif ($this->newTopic) {
         } elseif ($this->newTopic) {
             $message = 'PM created Redirect';
             $message = 'PM created Redirect';
+
+            $this->user->u_pm_num_all += 1;
+
+            $this->pms->recalculate($this->targetUser);
+        // сообщение в архивный диалог
+        } elseif (Cnst::PT_ARCHIVE === $topic->poster_status) {
+            $message = 'PM to archive Redirect';
+        // сообщение в активный диалог
         } else {
         } else {
             $message = 'PM sent Redirect';
             $message = 'PM sent Redirect';
+
+            $this->pms->recalculate($this->targetUser);
         }
         }
 
 
+        $this->user->u_pm_last_post = $now;
+
+        $this->c->users->update($this->user);
+
         return $this->c->Redirect->url($post->link)->message($message);
         return $this->c->Redirect->url($post->link)->message($message);
     }
     }
 }
 }