<?php /** * Created by PhpStorm. * User: ZCY * Date: 2018/12/17 * Time: 10:13 */ namespace backend\controllers; use common\models\psources\CoinApplicationCategory; use Yii; class WalletController extends BaseController { /** * @return string * 设置钱包密码 */ public function actionSetPasswd() { if (Yii::$app->request->isPost) { $old_passwd = Yii::$app->request->post('old_passwd'); $new_passwd = Yii::$app->request->post('new_passwd'); $confirm_passwd = Yii::$app->request->post('confirm_passwd'); $passwd = Yii::$app->redis->get('wallet_passwd'); if(!$passwd){ Yii::$app->redis->set('wallet_passwd',$new_passwd); $this->success('钱包密码设置成功', Yii::$app->request->getReferrer()); } if($passwd != $old_passwd){ $this->error('原始密码错误', Yii::$app->request->getReferrer()); } if($new_passwd != $confirm_passwd){ $this->error('确认密码和设置的密码不一致', Yii::$app->request->getReferrer()); } Yii::$app->redis->set('wallet_passwd',$new_passwd); $this->success('钱包密码设置成功', Yii::$app->request->getReferrer()); } return $this->render('set-passwd'); } }