getCaptchaConfig(); $config = $config_info[ 'data' ][ 'value' ]; $register = new UserModel(); if (empty($this->params[ "username" ])) return $this->response($this->error([], "用户名不可为空!")); if (empty($this->params[ "password" ])) return $this->response($this->error([], "密码不可为空!")); // 校验验证码 if ($config[ "shop_login" ] == 1) { $captcha = new Captcha(); $check_res = $captcha->checkCaptcha(); if ($check_res[ 'code' ] < 0) return $this->response($check_res); } $data[ 'username' ] = $this->params[ 'username' ]; $data[ 'password' ] = $this->params[ 'password' ]; $data[ 'app_module' ] = $this->app_module; $data[ 'site_id' ] = 0; $res = $register->addUser($data); //生成access_token if ($res[ 'code' ] >= 0) { $token = $this->createToken($res[ 'data' ]); return $this->response($this->success([ 'token' => $token, 'site_id' => $res[ 'data' ][ 'site_id' ] ])); } return $this->response($res); } }