public function actionLv() { $model = new VipPaymentModel(); $_priceList = PriceList::returnPriceList(); foreach ($_priceList as $l => $p) { $priceList[$p] = $l; } for ($i = 1; $i <= 12; $i++) { $mouth[$i] = $i . '个月'; } if (isset($_POST['VipPaymentModel'])) { $dateTime = time(); $model->attributes = $_POST['VipPaymentModel']; $model->uid = Yii::app()->session['userInfo']['uid']; $model->username = Yii::app()->session['userInfo']['username']; $model->created_at = $dateTime; $model->orderId = $this->_createOrderSns(); if ($model->validate()) { //校验价格 $price = $model->payCode; $count = $model->count; $amount = $price * $count; if ($amount != $model->amount) { ShowMessage::error('数据有误!'); } $model->payCode = $priceList[$model->payCode]; $model->save(); //ShowMessage::success('添加成功!',Yii::app()->createUrl('vip/index')); } } $this->render('lv', array('model' => $model, 'priceList' => $priceList, 'mouth' => $mouth)); }
public function actionCreate() { $model = new ActiveModel(); if (isset($_POST['ActiveModel'])) { $model->type = Globals::TYPE_REGISTRATION; $model->attributes = $_POST['ActiveModel']; $model->wechatId = $this->wechatInfo->id; //奖项处理 for ($i = 1; $i <= 3; $i++) { ${'award' . $i} = $_POST['award' . $i]; ${'isentity' . $i} = $_POST['isentity' . $i] ? $_POST['isentity' . $i] : 0; $awards[$i] = array('name' => ${'award' . $i}, 'isentity' => ${'isentity' . $i}); } $model->awards = serialize($awards); if ($model->validate()) { $model->save(); $keywords = $_POST['ActiveModel']['keywords']; $isAccurate = $_POST['ActiveModel']['isAccurate']; $keywordsArray = explode(',', $keywords); $this->saveKeywords($keywordsArray, $model->id, $isAccurate, Globals::TYPE_ACTIVE); ShowMessage::success('添加成功', Yii::app()->createUrl('registration')); } } Yii::app()->clientScript->scriptMap['jquery.js'] = false; $this->render('create', array('model' => $model, 'wechatId' => $this->wechatInfo->id, 'responseId' => 0)); }
protected function _getWechatInfo($id) { $wechatInfo = WechatModel::model()->findByPk($id); if (!$wechatInfo || $wechatInfo->uid != Yii::app()->session['userInfo']['uid']) { ShowMessage::error('公众帐号不存在!'); } return $wechatInfo; }
public function actionPswd() { $userInfo = Yii::app()->session['userInfo']; $model = UserModel::model()->find(array('condition' => 'uid=:uid', 'params' => array(':uid' => $userInfo['uid']))); $model->scenario = 'pswd'; if (isset($_POST['UserModel'])) { $model->attributes = $_POST['UserModel']; if ($model->validate()) { $model->pswd = md5($_POST['UserModel']['newpswd']); $model->save(); ShowMessage::success('修改成功!', Yii::app()->createUrl('user/pswd')); } } $this->render('pswd', array('model' => $model)); }
public function actionReplayDelete($id) { $model = OpenReplayModel::model()->findByPk($id); //删除关键字或者menu action switch ($model->type) { case GiftModel::TYPE_KEYWORDS: KeywordsModel::model()->deleteAll('responseId=:responseId and type=:type', array(':responseId' => $id, ':type' => OpenReplayModel::OPEN_TYPE)); break; case GiftModel::TYPE_MENU: MenuactionModel::model()->deleteAll('responseId=:responseId and type=:type', array(':responseId' => $id, ':type' => OpenReplayModel::OPEN_TYPE)); break; } $model->delete(); ShowMessage::success('删除成功', Yii::app()->createUrl('open/replay')); }
public function actionDelete($id) { $model = WechatModel::model()->find('id=:id and uid=:uid', array(':id' => $id, ':uid' => Yii::app()->session['userInfo']['uid'])); $model->delete(); ShowMessage::success('删除成功!', Yii::app()->createUrl('wechat/index')); }
public function actionDelete($id) { $model = WheelModel::model()->findByPk($id); //删除关键字或者menu action switch ($model->type) { case GiftModel::TYPE_KEYWORDS: KeywordsModel::model()->deleteAll('responseId=:responseId and type=:type', array(':responseId' => $id, ':type' => Globals::TYPE_SCRATCH)); break; case GiftModel::TYPE_MENU: $menuactionModel = MenuactionModel::model()->find('responseId=:responseId', array('responseId' => $model->id)); $menuactionModel->responseId = 0; $menuactionModel->save(); break; } $model->delete(); ShowMessage::success('删除成功', Yii::app()->createUrl('scratch')); }
public function actionShowMessage() { $model = new ShowMessage(); $model->attributes = isset($_POST) ? $_POST : ''; if ($model->validate()) { $model->show(); } else { echo json_encode($model->getErrors()); } }
public function actionDelete($id) { $sql = 'delete a,b from ' . MenuactionModel::model()->tableName() . ' as a left join ' . MenuModel::model()->tableName() . ' as b on a.menuId=b.id where b.id=' . $id . ' or b.parentId=' . $id; $command = Yii::app()->db->createCommand($sql); $command->execute(); ShowMessage::success('删除成功'); }
public function actionGiftCodeDelete($id) { $codeTable = sprintf(GiftModel::CREATE_CODE_TABLE_NAME, $this->wechatInfo->id); $whereSql = 'id=' . $id; $commond = Yii::app()->db->createCommand('DELETE FROM ' . $codeTable . ' where ' . $whereSql); $commond->execute(); ShowMessage::success('删除成功'); }