<?php
/**
 * 批量删除章节
 * @author yzxh24
 */
class DelallAction extends BaseAction
{
    public function run()
    {
        $chapters = Yii::app()->request->getPost('chapters');
        if (empty($chapters))
        {
            Yii::app()->end();
        }
        
        foreach ($chapters as $id)
        {
            $chapter = Chapters::model()->findByPk($id);
            $chapter->delete();
        }
        
        echo json_encode(array('success' => 1));
        Yii::app()->end();
    }
}