2025年4月

 function list(){
        $url = '接口地址';
        $sign = strtoupper(md5('0001加密字符'));
        $postData = [
           'deptId' => '0001',
           'sign' => $sign
        ];
        $options = [
            'http' => [
                'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                'method'  => 'POST',
                'content' => http_build_query($postData)
            ]
        ];
        $context = stream_context_create($options);
        // 发送请求并获取响应
        $response = file_get_contents($url, false, $context);
        if ($response === false) {
            // 处理错误
           JsonReturn(['code'=>1,'msg'=>'接口服务网络出错!']);
        } else {
            //$json = json_encode($response);
            //JsonReturn(['code'=>0,'data'=>$json]);
            echo $response;
        }
}

文件所在文件夹建立bat可执行文件,把以下代码粘贴进去执行,分两步操作
去掉空格
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in ('dir /s/b *.*') do (
    set "foo=%%~nxi"
    set foo=!foo: =!
    set foo=!foo: =!
    ren "%%~fi" "!foo!"
)
exit
 
 
去掉括号
@Echo Off&SetLocal ENABLEDELAYEDEXPANSION
FOR %%a in (*) do (
    set "name=%%a"
    set "name=!name:(=!"
    set "name=!name:)=!"
    ren "%%a" "!name!"
)
exit

服务端代理配置nginx(放伪静态配置或者站点配置文件都行)
 # Web服务API 代理
  location /_AMapService/ {
    set $args "$args&jscode=你的安全密钥";
    proxy_pass https://restapi.amap.com/;
  }
前端
<script type="text/javascript">
  window._AMapSecurityConfig = {
    serviceHost: "_AMapService"
  };
</script>
  <script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=你的key"></script>
  <script type="text/javascript">
AMap.plugin('AMap.Weather', function() {
var weather = new AMap.Weather();
weather.getForecast('上海市', function(err, data) {
    console.log(data);
    if(data.info=='OK'){
     
    }else{
   
    }
});
});    
</script>