ContractController::actionCreate PHP Метод

actionCreate() публичный Метод

public actionCreate ( )
    public function actionCreate()
    {
        Yii::import("xupload.models.XUploadForm");
        $biz_id = Yii::app()->request->getParam('biz_id');
        if (empty($biz_id)) {
            $this->go('请选择具体的商家', Yii::app()->request->urlReferrer);
        }
        $biz = ARBiz::model()->findByPk($biz_id);
        if ($biz == null) {
            $this->go('该商家不存在', Yii::app()->request->urlReferrer);
        }
        $model = new ARContract('sell');
        //        $attach = new ARGrouponAttach();
        $upload = new XUploadForm();
        $model->biz_id = $biz->id;
        //        $this->performAjaxValidation($model);
        if (Yii::app()->request->isPostRequest && !empty($_POST['ARContract'])) {
            //            dump($_POST);
            $model->attributes = $_POST['ARContract'];
            $model->create_id = Yii::app()->user->id;
            $model->sign_time = strtotime($model->sign_time);
            $model->online_time = strtotime($model->online_time);
            $model->end_time = strtotime($model->end_time);
            if ($model->save()) {
                $this->go('<strong>合同添加成功</strong>', $_POST['return_url'], 'success');
            }
        }
        $this->render('create', array('model' => $model, 'upload' => $upload, 'biz' => $biz));
    }