'application/javascript; charset=utf-8']); } $goUrl = rtrim($this->request->domain(), '/') . '/api/qywx-promotion/go/' . $key; $jsonKey = json_encode($key, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR); $jsonGo = json_encode($goUrl, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR); $javascript = << 'application/javascript; charset=utf-8', 'Cache-Control' => 'public, max-age=60', 'X-Content-Type-Options' => 'nosniff', ]); } public function redirect(string $key) { $picked = QywxPromotionRedirectService::pick($key, [ 'source_url' => (string) $this->request->get('from', ''), 'referer' => (string) $this->request->header('referer', ''), 'user_agent' => (string) $this->request->header('user-agent', ''), 'ip' => (string) $this->request->ip(), ]); if (!$picked) { return response('当前暂无可用的企业微信获客助手链接,请稍后再试。', 503, [ 'Content-Type' => 'text/plain; charset=utf-8', 'Cache-Control' => 'no-store', ]); } return redirect($picked['url'], 302)->header([ 'Cache-Control' => 'no-store', 'Referrer-Policy' => 'no-referrer', ]); } }