Exemple #1
0
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     if ($insert) {
         $recommendQueue = RecommendQueue::find()->andWhere(['type' => 'diary'])->andWhere(['sid' => $this->id])->one();
         if (empty($recommendQueue)) {
             $recommendQueue = new RecommendQueue();
         }
         $recommendQueue->type = 'diary';
         $recommendQueue->sid = $this->id;
         $recommendQueue->save();
     }
 }
Exemple #2
0
 public static function deleteAlbumById($albumId)
 {
     $recommendQueue = RecommendQueue::find()->andWhere(['type' => 'photo'])->andWhere(['sid' => $albumId])->one();
     $recommendQueue->delete();
 }