public function actionNewpsdset() { $session = Yii::$app->session; if (@$session['passwordstep']['code'] != "checkok") { throw new \yii\web\NotFoundHttpException(404); } $password = trim(Yii::$app->request->post("password")); if (!$password || strlen($password) < 6) { throw new \yii\web\NotFoundHttpException(404); } // 设置密码 // 检测密码设置类型 电话/邮箱 if ($session['passwordstep']['type'] == "email") { $res = Rz_user::find()->where(['email' => $session['passwordstep']['values']])->one(); $res->password = md5($password); $res = $res->save(); } else { if ($session['passwordstep']['type'] == "mobile") { $res = Rz_user::find()->where(['mobile' => $session['passwordstep']['values']])->one(); $res->password = md5($password); $res = $res->save(); } } $session['passwordstep'] = ""; return json_encode($this->makeRes("success", \yii\helpers\Url::toRoute('passwordstep/stepsuccess'))); }
public static function User_info($id) { return Rz_user::find()->where(['id' => $id])->asArray()->one(); }