public static function bizInfo($data) { $biz = ARBiz::model()->findByPk($data['biz_id']); if ($biz == null) { return '该商品没有对应商家'; } $str = $biz->title . '<span style="color:teal;">[商户ID:' . $biz->id . ']</span>'; return $str; }
public function actionCreate() { $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 ARBizShop('sell'); $model->biz_id = $biz->id; $this->performAjaxValidation($model); if (Yii::app()->request->isPostRequest && !empty($_POST['ARBizShop'])) { $model->attributes = $_POST['ARBizShop']; if ($model->save()) { $this->go('<strong>分店添加成功</strong>', $_POST['return_url'], 'success'); } } $this->render('create', array('model' => $model, 'biz' => $biz)); }
protected function loadBiz($id) { $model = ARBiz::model()->findByPk($id); if ($model == null) { throw new CHttpException(404, '找不到该商家'); } return $model; }
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)); }