/** * POST setting/feedback * return mixed */ public function feedback() { if (!$this->validation->passes($this->validation->feedbackRules)) { return ApiResponse::validation($this->validation); } $account_id = Input::header('account_id'); $content = Input::get('content'); $contact = Input::get('contact'); $version = Request::header('version'); $versionCode = Request::header('build'); $deviceId = Request::header('device_id'); $channelId = Request::header('channel_id'); $feedback = new Feedback(); $feedback->account_id = $account_id; $feedback->content = $content; $feedback->version = $version . '-' . $versionCode; $feedback->version_code = $versionCode; $feedback->device_id = $deviceId; $feedback->channel_id = $channelId; if (!is_null($contact)) { $feedback->contact = $contact; } $result = $feedback->save(); if ($result) { $message = config('quickcms.message_feedback_success'); if (!empty($message)) { return ApiResponse::responseSuccessWithMessage($message); } return ApiResponse::responseSuccess(); } else { return ApiResponse::responseFailure(); } }
/** * 获取语音验证码API * @return mixed */ public function verify() { if (!$this->validation->passes($this->validation->phoneRules)) { return ApiResponse::validation($this->validation); } $phone = Input::get('phone'); if (config('quickcms.sms_api_switch')) { $captcha = rand(1000, 9999); $sms = new LuoSiMaoSms(config('quickcms.sms_api_key_verify')); // 拨打语音电话至用户 $sms->sendVerify($phone, $captcha); } else { $captcha = '1234'; } $expiresAt = Carbon::now()->addMinutes(30); Cache::put($phone, $captcha, $expiresAt); return ApiResponse::responseSuccess(); }