/** * 我的投票 */ public function actionMy() { $uid = Yii::app()->user->id; $model = new Vote(); //初始化 $criteria = new CDbCriteria(); $criteria->order = 'ctime DESC'; $criteria->condition = "uid=:uid"; $criteria->params = array(':uid' => $uid); $mini = $model->find($criteria); $icon_list = Smile::model()->findAll(); $date = Yii::app()->request->getQuery('date'); if (!empty($date)) { $criteria = $model->fileaway($date, $criteria); } //取得数据总数,分页显示 $total = $model->count($criteria); $pages = new CPagination($total); $pages->pageSize = self::PAGE_SIZE; $pages->applyLimit($criteria); //获取数据集 $list = $model->findAll($criteria); $data = array('list' => $list, 'pages' => $pages, 'mini' => $mini, 'icon_list' => $icon_list); $this->render('my', $data); }
public function run() { $data = $this->items; $role = $data['role']; $type = $data['type']; $object_id = $data['object_id']; switch ($role) { case 2: echo "您无法评论,日志发布者设置好友可评论"; exit; break; case 3: echo "您无法评论,日志发布者已经关闭评论"; exit; break; } $model = new Comment(); $comments = $model->getComments($type, $object_id); $data['icon_list'] = Smile::model()->findAll(); $data['comments'] = $comments; $this->render('WComment', $data); }
public function actionDoAddMini() { $content = Yii::app()->request->getPost('content'); if (empty($content)) { echo -1; return false; } $model = new Mini(); //TODO 检测空白输入 $model->content = $content; $add = $model->save(); if ($add) { echo Smile::model()->replaceContent($content); } else { echo -1; } }