<?php
/**
 * 删除表情下的图片
 * @author yzxh24
 */
class DeleteItemAction extends BaseAction
{
    public function run()
    {
        $id = intval($_GET['id']);
        $smile = Smiles::model()->findByPk($id);
        if (empty($smile))
        {
            throw new CHttpException(500, '要删除的表情不存在');
        }
        if ($smile->type == 0)
        {
            throw new CHttpException(500, '非法操作');
        }
        $smile->delete();
        
        $this->getController()->redirect(array('/admin/smiles/list','id'=>$smile->type));
    }
}