| @@ 35-46 (lines=12) @@ | ||
| 32 | * 设置头像 |
|
| 33 | * @return string|yii\web\Response |
|
| 34 | */ |
|
| 35 | public function actionAvatar() |
|
| 36 | { |
|
| 37 | $model = Admin::findOne(Yii::$app->user->id); |
|
| 38 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
| 39 | Yii::$app->session->setFlash('success', '修改成功'); |
|
| 40 | return $this->redirect(['avatar']); |
|
| 41 | } else { |
|
| 42 | return $this->render('avatar', [ |
|
| 43 | 'model' => $model |
|
| 44 | ]); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * 修改密码 |
|
| @@ 69-80 (lines=12) @@ | ||
| 66 | * 设置个人信息 |
|
| 67 | * @return string|yii\web\Response |
|
| 68 | */ |
|
| 69 | public function actionProfile() |
|
| 70 | { |
|
| 71 | $model = Admin::findOne(Yii::$app->user->id); |
|
| 72 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
| 73 | Yii::$app->session->setFlash('success', '修改成功'); |
|
| 74 | return $this->redirect(['profile']); |
|
| 75 | } else { |
|
| 76 | return $this->render('profile', [ |
|
| 77 | 'model' => $model |
|
| 78 | ]); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||