Esempio n. 1
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $_POST['id'];
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'delete':
             parent::_acl('attr_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '属性删除,ID:' . $ids));
             $attrModel = Attr::model()->findByPk($ids);
             Attr::clear(array('attrId' => $attrModel->id, 'attrName' => $attrModel->attr_name_alias, 'oldScope' => 'all'));
             parent::_delete(new Attr(), $ids, array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }