<?php
/**
 * 给推广ID添加后台备注
 * @author yzxh24
 */
class RemarkAction extends BaseAction
{
    public function run()
    {
        $id = Yii::app()->request->getQuery('id');
        if (Yii::app()->request->getIsPostRequest())
        {
            $name = Yii::app()->request->getPost('name');
            if (empty($name))
            {
                throw new CHttpException('请输入备注名');
            }
            $sql = 'REPLACE INTO '.Ruidremark::model()->tableName()." (ruid, name) VALUES ('{$id}', '{$name}')";
            Yii::app()->getDb()->createCommand($sql)->execute();
            
            $this->getController()->redirect(array('/admin/flux/reward'));
        }
        
        $this->getController()->render('remark', array('id'=>$id));
    }
}