diff --git a/source/application/api/controller/Controller.php b/source/application/api/controller/Controller.php index e4e4b23..6483278 100644 --- a/source/application/api/controller/Controller.php +++ b/source/application/api/controller/Controller.php @@ -26,8 +26,10 @@ class Controller extends \think\Controller */ public function _initialize() { - header("Access-Control-Allow-Origin: http://192.168.66.220:8080"); - header("Access-Control-Allow-Origin: http://192.168.66.220:8081"); + $config = config('api_config'); + foreach ($config['access_control_allow_origin'] as $value) { + header("Access-Control-Allow-Origin: ".$value); + } header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE"); header("Access-Control-Allow-Headers: Content-Type"); header("Access-Control-Allow-Credentials: true"); diff --git a/source/application/api/controller/stadium/Param.php b/source/application/api/controller/stadium/Param.php new file mode 100644 index 0000000..3ad996e --- /dev/null +++ b/source/application/api/controller/stadium/Param.php @@ -0,0 +1,26 @@ + $config['host'], + 'port' => $config['port'], + 'appkey' => $config['cid'], + 'secret' => $config['cskey'] + ]; + + $base64 = base64_encode(json_encode($returnArr)) . "=="; + $base64Two = base64_encode($base64); + + return $this->renderSuccess(compact('base64Two')); + } + +} \ No newline at end of file diff --git a/source/application/config.php b/source/application/config.php index de7d099..a368a38 100644 --- a/source/application/config.php +++ b/source/application/config.php @@ -243,11 +243,24 @@ return [ // | 自定义配置 // +---------------------------------------------------------------------- 'api_config' => [ - // 调用网址地址 - 'host_url' => 'https://192.168.66.13:443/artemis', + # 调用网址地址 + 'host' => '192.168.66.13', + # 端口号 'port' => '443', + # 请求key 'cid' => '29940726', + # 请求密钥 'cskey' => 'SkTCnQdFbNW4Z2suNj8P', - 'host_path' => 'http://btgym.xingtongworld.com/index.php?s=' + # 请求智慧景区接口地址 + 'host_url' => 'https://192.168.66.13:443/artemis', + # 脚本数据推送创建数据地址 + //'host_path' => 'http://btgym.xingtongworld.com/index.php?s=' + 'host_path' => 'http://192.168.66.16/index.php?s=', +// 'host_path' => 'http://www.stadium.com/index.php?s=' + # 允许跨域 请求的IP地址 + 'access_control_allow_origin' => [ + 'http://192.168.66.220:8080', + 'http://192.168.66.220:8081' + ] ] ];