<?php
class ViewAction extends BaseAction
{
    public function run()
    {
        $mid = Yii::app()->request->getQuery('mid');
        $message = Messages::model()->with('data')->findByPk($mid);
        if (empty($message))
        {
            throw new CHttpException(500,'不存在的短信');
        }

        if (1 == $message->msgtoid && $message->isnew)
        {
            $message->isnew = 0;
            $message->save();
            Front::updateNewCount($message->msgtoid);
        }

        $this->getController()->renderPartial('view',array('message'=>$message), false, true);
    }
}