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)); }
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 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('删除成功'); }