Exemplo n.º 1
0
 /**
  * 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]);
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 4
0
 public function actionUsers()
 {
     $model = UserService::findActiveUser(100);
     $count = User::find()->where(['status' => 10])->count();
     return $this->render('users', ['model' => $model, 'count' => $count]);
 }
Exemplo n.º 5
0
 public function run()
 {
     $notifyCount = UserService::findNotifyCount();
     return $this->render('nav', ['notifyCount' => $notifyCount]);
 }
Exemplo n.º 6
0
 public function userDoAction($id, $action)
 {
     $topic = Tweet::findTweet($id);
     $user = \Yii::$app->user->getIdentity();
     return UserService::TopicActionB($user, $topic, $action);
 }
Exemplo n.º 7
0
 public function actionAtUsers()
 {
     $model = UserService::findActiveUser(400);
     return Json::encode(Arr::getColumn($model, 'username'));
 }