/**
  * Lists all Notification models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Notification::find()->where(['user_id' => Yii::$app->user->id]), 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC, 'id' => SORT_ASC]]]);
     $notifyCount = UserService::findNotifyCount();
     UserService::clearNotifyCount();
     return $this->render('index', ['dataProvider' => $dataProvider, 'notifyCount' => $notifyCount]);
 }
Exemple #2
0
 public function userDoAction($id, $action)
 {
     $comment = PostComment::findComment($id);
     $user = \Yii::$app->user->getIdentity();
     if (in_array($action, ['like'])) {
         return UserService::CommentAction($user, $comment, $action);
     }
 }
Exemple #3
0
 public function userDoAction($id, $action)
 {
     $topic = Topic::findTopic($id);
     $user = \Yii::$app->user->getIdentity();
     if (in_array($action, ['like', 'hate'])) {
         return UserService::TopicActionA($user, $topic, $action);
     } else {
         return UserService::TopicActionB($user, $topic, $action);
     }
 }
Exemple #4
0
 public function actionUsers()
 {
     $model = UserService::findActiveUser(100);
     $count = User::find()->where(['status' => 10])->count();
     return $this->render('users', ['model' => $model, 'count' => $count]);
 }
Exemple #5
0
 public function run()
 {
     $notifyCount = UserService::findNotifyCount();
     return $this->render('nav', ['notifyCount' => $notifyCount]);
 }
Exemple #6
0
 public function userDoAction($id, $action)
 {
     $topic = Tweet::findTweet($id);
     $user = \Yii::$app->user->getIdentity();
     return UserService::TopicActionB($user, $topic, $action);
 }
Exemple #7
0
 public function actionAtUsers()
 {
     $model = UserService::findActiveUser(400);
     return Json::encode(Arr::getColumn($model, 'username'));
 }