跳转链接

@param number $code
@param string $msg
@param string $url
@param string $data
@param number $wait
@return mixed
508205
protected function jump($code = 1, $msg = '', $url = '', $data = '', $wait = 3)
    {
        $jump = Format::formatJump($code, $msg, $url, $data, $wait);
        if (Request::instance()->isAjax()) {
            responseReturn($jump, 'json', true);
        } else {
            $this->site_title || $this->site_title = $msg;
            
            $this->assign('jump', $jump);
            
            return $this->fetch('common/jump');
        }
    }
886351
public function forbidden($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_FORBIDDEN, $headers);
    }
387098
public function waitUntil($script, $seconds = null, $message = null)
    {
        if (! Str::startsWith($script, 'return ')) {
            $script = 'return '.$script;
        }

        if (! Str::endsWith($script, ';')) {
            $script = $script.';';
        }

        return $this->waitUsing($seconds, 100, function () use ($script) {
            return $this->driver->executeScript($script);
        }, $message);
    }
493238
protected function returnData($code, $msg = '', $data = '')
    {
        $object = new ReturnObject();

        // 设置状态码
        $object->setCode($code);

        // 设置消息
        $msgMapping = array_merge($this->_msgMapping, $this->getMsgMapping());
        if (empty($msg) && isset($msgMapping[$code])) {
            $msg = $msgMapping[$code];
        }
        $object->setMsg($msg);

        // 设置数据
        $object->setData($data);

        return $object;
    }
951300
public function setStatus($code = 200, $text = '')
    {
        if (empty($code) or !is_numeric($code)) {
            throw new ResponseException('Status codes must be numeric.');
        }

        if (empty($text)) {
            if (!is_int($code)) {
                $code = (int) $code;
            }

            if (isset($this->httpCode[$code])) {
                $text = $this->httpCode[$code];
            } else {
                throw new ResponseException('No status text available. Please check your status code number or supply your own message text.');
            }
        }

        if (strpos(PHP_SAPI, 'cgi') === 0) {
            header('Status: ' . $code . ' ' . $text, true);
        } else {
            $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
            header($protocol . ' ' . $code . ' ' . $text, true, $code);
        }
    }
527568
public function thirdAuthorizeCallback($code = '') {
        $component_access_token = $this->componentAccessToken();
        $data                   = array(
            "component_appid"    => C("wechat", "componentAppid"),
            "authorization_code" => $code['auth_code'],
        );
        #提交URL地址
        $url = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=$component_access_token";
        $res = to_array($this->httpPost($url, $data));
        if (isset($res['authorization_info'])) {
            $data = $res['authorization_info'];
            #设置存储信息
            $key = md5($code['uid'] . md5($code['uid'] . 'thirdAuthorizeCallback') . "_wechat");
            #设置缓存时间
            $data['expire_time'] = time() + 7000;
            F($key, to_json($data));
            if ($code['url'] != "-1") {
                $file = dirname(dirname(__FILE__)) . "/bin/successful.html";
                echo file_get_contents($file);
            } else {
                redirect($code['url']);
            }
        } else {
            echo "授权失败";
        }
        exit();
    }
1304215
protected function response($return, $url = '', $wait = 3, $header = [])
    {
        if ($return->isSuccess()) {
            $this->success($return->getMsg(), $url, $return->getData(), $wait, $header);
        } else {
            $this->error($return->getMsg(), $url, $return->getData(), $wait, $header);
        }
    }
549229
protected function success($msg = '', $url = '', $data = '', $wait = 3, $header = [])
    {
        $this->jump(CodeConstant::CODE_SUCCESS, $msg, $url, $data, $wait, $header);
    }
906604
public static function search($number, $code = '', $output = 'json')
    {
        if (!empty($number) && empty($code)) {
            $code = self::getCode($number, 'code');
        }
        if (!empty($number) && !empty($code)) {
            $data = array(
                'type' => trim($code),
                'postid' => trim($number)
            );
            //拼接url
            self::$url = self::$url . http_build_query($data);
            //请求接口
            $result = self::httpGet(self::$url);
            if (empty($result)) {
                $result = json_encode(array('status' => 400, 'message' => '请求错误'));
            }
        } else {
            $result = json_encode(array('status' => 400, 'message' => '快递单号不正确'));
        }
        return $output == 'json' ? $result : json_decode($result);
    }
913938
public function prepareSuccess($message, $data=[], $code=200) {
        $this->prepareResult(true, $message, $code, $data, null);
    }
1021436
public function notFound($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_NOT_FOUND, $headers);
    }
8240
protected function success($msg, $url = null)
    {
        return $this->msg($msg, self::MSG_GOOD, $url);
    }
477089
public function notAvailable($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_SERVICE_UNAVAILABLE, $headers);
    }
495332
public function requestToken($code)
    {
        $parameters = [
            'client_id' => config('twitch-api.client_id'),
            'client_secret' => config('twitch-api.client_secret'),
            'redirect_uri' => config('twitch-api.redirect_url'),
            'code' => $code,
            'grant_type' => 'authorization_code'
        ];

        try {
            $client = new Client();

            $response = $client->post(config('twitch-api.api_url') . '/kraken/oauth2/token', ['body' => $parameters]);

            $response = $response->json();

            if (isset($response[ 'access_token' ])) {

                return $response[ 'access_token' ];
            }

        } catch (\Exception $e) {

            throw $e;
        }
    }
448024
public function respondCreated($code = ApiResponse::CODE_SUCCESS, array $data = [], $message = null): JsonResponse
    {
        return $this->setStatusCode(IlluminateResponse::HTTP_CREATED)->respond([
            'status' => [
                'type' => 'success',
                'message' => $this->getDefaultMessage($code, $message),
                'code' => $code,
                'http_code' => $this->getStatusCode(),
            ],
            'data' => $data,
        ]);
    }
1060249
protected function redirect($url,$params=array(),$delay=0,$msg='') {
        $url    =   U($url,$params);
        redirect($url,$delay,$msg);
    }
465278
private function msg($msg): string
    {
        // 将数组转为字符串
        if (is_array($msg) or is_object($msg) or is_bool($msg)) {
            return json($msg);
        }

        // 返回可显示的字符串
        return (string)$msg;
    }