public function actionLogon() { $result = array('status' => -1, 'access_token' => -1, 'userid' => 0, 'message' => ''); $paras = Yii::$app->request->post(); //$query-> if (!isset($paras['password'], $paras['name'], $paras['email'], $paras['firstname'], $paras['lastname'], $paras['sex'], $paras['phone'], $paras['code'])) { $result['message'] = 'lack of parameters'; return $result; } if (!$this->checkInvitation($paras['code'])) { $result['message'] = 'wrong invitation code'; $result['status'] = '2'; return $result; } $user = new \app\models\User(); $user->password = md5($paras['password'], false); $user->name = $paras['name']; $user->email = $paras['email']; $user->firstname = $paras['firstname']; $user->lastname = $paras['lastname']; $user->sex = $paras['sex']; $user->phone = $paras['phone']; $user->access_token = $user->password; if ($user->validate()) { $user->save(); $result['access_token'] = $user->access_token; $result['status'] = 1; $result['userid'] = $user->id; $result['message'] = 'registered succesfully'; } else { $result['message'] = 'registered failed'; $result['status'] = 0; } return $result; }