{
    "version": "https://jsonfeed.org/version/1",
    "title": "涛声依旧",
    "subtitle": "天下事有难易乎?为之,则难者亦易矣",
    "icon": "https://hitoli.com/images/favicon.ico",
    "description": "天生我材必有用",
    "home_page_url": "https://hitoli.com",
    "items": [
        {
            "id": "https://hitoli.com/2023/10/28/Windows%E4%B8%8B%E5%BF%AB%E9%80%9F%E9%83%A8%E7%BD%B2SpringBoot%E9%A1%B9%E7%9B%AE%E7%9A%84%E6%89%B9%E5%A4%84%E7%90%86/",
            "url": "https://hitoli.com/2023/10/28/Windows%E4%B8%8B%E5%BF%AB%E9%80%9F%E9%83%A8%E7%BD%B2SpringBoot%E9%A1%B9%E7%9B%AE%E7%9A%84%E6%89%B9%E5%A4%84%E7%90%86/",
            "title": "Windows下快速部署SpringBoot项目的批处理",
            "date_published": "2023-10-28T11:56:00.000Z",
            "content_html": "<h4 id=\"windows部署脚本\"><a class=\"anchor\" href=\"#windows部署脚本\">#</a> Windows 部署脚本</h4>\n<p>只需要把 jar 和 yml 跟批处理放在同一目录下即可点击快速启动。启动后再次点击会关闭上次启动的窗口并重新启动。</p>\n<div class=\"note info\">\n<p>拷贝以下代码放入 txt 文本，然后改为 start.bat</p>\n</div>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>@ECHO OFF</pre></td></tr><tr><td data-num=\"2\"></td><td><pre>setlocal enabledelayedexpansion</pre></td></tr><tr><td data-num=\"3\"></td><td><pre></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>REM 关闭上次进程</pre></td></tr><tr><td data-num=\"5\"></td><td><pre>SET <span class=\"token string\">\"pidFile=pid.txt\"</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre><span class=\"token keyword\">if</span> exist <span class=\"token string\">\"%pidFile%\"</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>\t<span class=\"token keyword\">for</span> /f <span class=\"token string\">\"usebackq\"</span> %%a <span class=\"token keyword\">in</span> <span class=\"token punctuation\">(</span><span class=\"token string\">\"pid.txt\"</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">do</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>\t\t<span class=\"token builtin class-name\">set</span> <span class=\"token assign-left variable\">PID</span><span class=\"token operator\">=</span>%%a</pre></td></tr><tr><td data-num=\"9\"></td><td><pre>\t<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>\t<span class=\"token keyword\">if</span> not <span class=\"token string\">\"!PID!\"</span><span class=\"token operator\">==</span><span class=\"token string\">\"\"</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>\t\ttaskkill /F /T /PID <span class=\"token operator\">!</span>pid<span class=\"token operator\">!</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>\t\tdel pid.txt</pre></td></tr><tr><td data-num=\"13\"></td><td><pre>\t<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>REM 存储当前进程</pre></td></tr><tr><td data-num=\"17\"></td><td><pre><span class=\"token keyword\">for</span> /f %%i <span class=\"token keyword\">in</span> <span class=\"token punctuation\">(</span><span class=\"token string\">'wmic process where \"name='</span>cmd.exe<span class=\"token string\">' and CommandLine like '</span>%%<span class=\"token operator\">&lt;</span>scriptname<span class=\"token operator\">></span>.bat%%<span class=\"token string\">'\" get ParentProcessId ^| findstr /r \"[0-9]\"'</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">do</span> <span class=\"token builtin class-name\">set</span> <span class=\"token assign-left variable\">pid</span><span class=\"token operator\">=</span>%%i</pre></td></tr><tr><td data-num=\"18\"></td><td><pre><span class=\"token builtin class-name\">echo</span> %PID% <span class=\"token operator\">></span> pid.txt</pre></td></tr><tr><td data-num=\"19\"></td><td><pre></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>REM 设置title</pre></td></tr><tr><td data-num=\"21\"></td><td><pre><span class=\"token keyword\">for</span> /f <span class=\"token string\">\"tokens=2\"</span> %%i <span class=\"token keyword\">in</span> <span class=\"token punctuation\">(</span><span class=\"token string\">'chcp'</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">do</span> <span class=\"token builtin class-name\">set</span> <span class=\"token assign-left variable\">codepage</span><span class=\"token operator\">=</span>%%i</pre></td></tr><tr><td data-num=\"22\"></td><td><pre>chcp <span class=\"token number\">65001</span> <span class=\"token operator\">></span> nul</pre></td></tr><tr><td data-num=\"23\"></td><td><pre>title 我的SpringBoot项目</pre></td></tr><tr><td data-num=\"24\"></td><td><pre>chcp %codepage% <span class=\"token operator\">></span> nul</pre></td></tr><tr><td data-num=\"25\"></td><td><pre></pre></td></tr><tr><td data-num=\"26\"></td><td><pre><span class=\"token builtin class-name\">cd</span> %~dp0</pre></td></tr><tr><td data-num=\"27\"></td><td><pre></pre></td></tr><tr><td data-num=\"28\"></td><td><pre>REM 获取jar</pre></td></tr><tr><td data-num=\"29\"></td><td><pre><span class=\"token builtin class-name\">set</span> <span class=\"token string\">\"jarFile=\"</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre><span class=\"token keyword\">for</span> %%i <span class=\"token keyword\">in</span> <span class=\"token punctuation\">(</span>*.jar<span class=\"token punctuation\">)</span> <span class=\"token keyword\">do</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre>    <span class=\"token keyword\">if</span> not defined jarFile <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"32\"></td><td><pre>        <span class=\"token builtin class-name\">set</span> <span class=\"token string\">\"jarFile=%%i\"</span></pre></td></tr><tr><td data-num=\"33\"></td><td><pre>    <span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"34\"></td><td><pre><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre></pre></td></tr><tr><td data-num=\"36\"></td><td><pre><span class=\"token keyword\">if</span> not defined jarFile <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"37\"></td><td><pre>    <span class=\"token builtin class-name\">echo</span> not <span class=\"token function\">find</span> jar</pre></td></tr><tr><td data-num=\"38\"></td><td><pre>    pause</pre></td></tr><tr><td data-num=\"39\"></td><td><pre>    <span class=\"token builtin class-name\">exit</span></pre></td></tr><tr><td data-num=\"40\"></td><td><pre><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"41\"></td><td><pre></pre></td></tr><tr><td data-num=\"42\"></td><td><pre>SET <span class=\"token assign-left variable\">JAVA_OPTS</span><span class=\"token operator\">=</span>-Djava.security.egd<span class=\"token operator\">=</span>file:/dev/./urandom <span class=\"token parameter variable\">-Dfile.encoding</span><span class=\"token operator\">=</span>UTF-8</pre></td></tr><tr><td data-num=\"43\"></td><td><pre><span class=\"token builtin class-name\">set</span> <span class=\"token assign-left variable\">JAVA_OPTS</span><span class=\"token operator\">=</span>%JAVA_OPTS% <span class=\"token parameter variable\">-Dsun.jnu.encoding</span><span class=\"token operator\">=</span>UTF8 <span class=\"token parameter variable\">-Xms512m</span> <span class=\"token parameter variable\">-Xmx1024m</span></pre></td></tr><tr><td data-num=\"44\"></td><td><pre><span class=\"token builtin class-name\">set</span> <span class=\"token assign-left variable\">JAVA_OPTS</span><span class=\"token operator\">=</span>%JAVA_OPTS% <span class=\"token parameter variable\">-agentlib:jdwp</span><span class=\"token operator\">=</span>transport<span class=\"token operator\">=</span>dt_socket,server<span class=\"token operator\">=</span>y,suspend<span class=\"token operator\">=</span>n,address<span class=\"token operator\">=</span><span class=\"token number\">5007</span></pre></td></tr><tr><td data-num=\"45\"></td><td><pre><span class=\"token builtin class-name\">set</span> <span class=\"token assign-left variable\">JAVA_OPTS</span><span class=\"token operator\">=</span>%JAVA_OPTS% <span class=\"token parameter variable\">-Dpid.path</span><span class=\"token operator\">=</span>./temp</pre></td></tr><tr><td data-num=\"46\"></td><td><pre></pre></td></tr><tr><td data-num=\"47\"></td><td><pre>REM 获取yml</pre></td></tr><tr><td data-num=\"48\"></td><td><pre><span class=\"token builtin class-name\">set</span> <span class=\"token string\">\"ymlFile=\"</span></pre></td></tr><tr><td data-num=\"49\"></td><td><pre><span class=\"token keyword\">for</span> %%i <span class=\"token keyword\">in</span> <span class=\"token punctuation\">(</span>*.yml<span class=\"token punctuation\">)</span> <span class=\"token keyword\">do</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"50\"></td><td><pre>    <span class=\"token keyword\">if</span> not defined ymlFile <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"51\"></td><td><pre>        <span class=\"token builtin class-name\">set</span> <span class=\"token string\">\"ymlFile=%%i\"</span></pre></td></tr><tr><td data-num=\"52\"></td><td><pre>    <span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"53\"></td><td><pre><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"54\"></td><td><pre></pre></td></tr><tr><td data-num=\"55\"></td><td><pre><span class=\"token keyword\">if</span> defined ymlFile <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"56\"></td><td><pre>\t<span class=\"token builtin class-name\">set</span> <span class=\"token assign-left variable\">JAVA_OPTS</span><span class=\"token operator\">=</span>%JAVA_OPTS% -Dspring.config.additional-location<span class=\"token operator\">=</span><span class=\"token operator\">!</span>ymlFile<span class=\"token operator\">!</span></pre></td></tr><tr><td data-num=\"57\"></td><td><pre><span class=\"token punctuation\">)</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"58\"></td><td><pre>\t<span class=\"token builtin class-name\">echo</span> not <span class=\"token function\">find</span> yml</pre></td></tr><tr><td data-num=\"59\"></td><td><pre><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"60\"></td><td><pre></pre></td></tr><tr><td data-num=\"61\"></td><td><pre>REM 启动服务</pre></td></tr><tr><td data-num=\"62\"></td><td><pre><span class=\"token function\">java</span> %JAVA_OPTS% <span class=\"token parameter variable\">-jar</span> <span class=\"token operator\">!</span>jarFile<span class=\"token operator\">!</span></pre></td></tr><tr><td data-num=\"63\"></td><td><pre>pause</pre></td></tr></table></figure><div class=\"note info\">\n<p>拷贝以下代码放入 txt 文本，然后改为 stop.bat</p>\n</div>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>@ECHO OFF</pre></td></tr><tr><td data-num=\"2\"></td><td><pre>setlocal enabledelayedexpansion</pre></td></tr><tr><td data-num=\"3\"></td><td><pre></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>REM 关闭上次进程</pre></td></tr><tr><td data-num=\"5\"></td><td><pre>SET <span class=\"token string\">\"pidFile=pid.txt\"</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre><span class=\"token keyword\">if</span> exist <span class=\"token string\">\"%pidFile%\"</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>\t<span class=\"token keyword\">for</span> /f <span class=\"token string\">\"usebackq\"</span> %%a <span class=\"token keyword\">in</span> <span class=\"token punctuation\">(</span><span class=\"token string\">\"pid.txt\"</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">do</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>\t\t<span class=\"token builtin class-name\">set</span> <span class=\"token assign-left variable\">PID</span><span class=\"token operator\">=</span>%%a</pre></td></tr><tr><td data-num=\"9\"></td><td><pre>\t<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>\t<span class=\"token keyword\">if</span> not <span class=\"token string\">\"!PID!\"</span><span class=\"token operator\">==</span><span class=\"token string\">\"\"</span> <span class=\"token punctuation\">(</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>\t\ttaskkill /F /T /PID <span class=\"token operator\">!</span>pid<span class=\"token operator\">!</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>\t\tdel pid.txt</pre></td></tr><tr><td data-num=\"13\"></td><td><pre>\t<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre></pre></td></tr><tr><td data-num=\"16\"></td><td><pre><span class=\"token builtin class-name\">exit</span></pre></td></tr></table></figure>",
            "tags": [
                "Windows",
                "工具",
                "SpringBoot",
                "Bat",
                "批处理",
                "快速部署"
            ]
        },
        {
            "id": "https://hitoli.com/2023/10/28/Centos%E6%8C%82%E8%BD%BD%E6%96%B0%E7%A1%AC%E7%9B%98/",
            "url": "https://hitoli.com/2023/10/28/Centos%E6%8C%82%E8%BD%BD%E6%96%B0%E7%A1%AC%E7%9B%98/",
            "title": "Centos挂载新硬盘",
            "date_published": "2023-10-28T11:26:00.000Z",
            "content_html": "<h4 id=\"查看磁盘信息\"><a class=\"anchor\" href=\"#查看磁盘信息\">#</a> 查看磁盘信息</h4>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">fdisk</span> <span class=\"token parameter variable\">-l</span> 查看当前磁盘的分区情况</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/4dc953fc5a5e.png\" alt=\"\" /><br />\n可从图中获取以下信息：<br />\n/dev/vdb 数据盘容量为 60GB，包含 MBR 分区 /dev/vdb1，容量为 50GB。<br />\n/dev/vdc 数据盘容量为 60GB，包含 GPT 分区 /dev/vdc1，容量为 50GB。</p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">df</span> <span class=\"token parameter variable\">-TH</span> 分区的文件系统类型</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/8996c9620632.png\" alt=\"\" /><br />\n可从图中获取以下信息：<br />\n/dev/vdb1 文件系统类型为 ext4，已挂载至 /mnt/disk1。<br />\n/dev/vdc1 文件系统类型为 xfs，已挂载至 /mnt/disk2。</p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">fdisk</span> /dev/vdb 查看新磁盘情况</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/0f1237aef57b.png\" alt=\"\" /></p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>lsbl 查看分区情况</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/8071a3832e29.png\" alt=\"\" /></p>\n<h4 id=\"挂载新硬盘\"><a class=\"anchor\" href=\"#挂载新硬盘\">#</a> 挂载新硬盘</h4>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>mkfs.ext4 /dev/vdb 格式化磁盘</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/9353dd85579f.png\" alt=\"\" /></p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token builtin class-name\">cd</span> /mnt</pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token function\">mkdir</span> data 新建挂载点</pre></td></tr><tr><td data-num=\"3\"></td><td><pre><span class=\"token function\">mount</span> /dev/vdb /mnt/data 挂载</pre></td></tr></table></figure><figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">df</span> <span class=\"token parameter variable\">-h</span> 查看挂载情况</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/ead4f7b1323f.png\" alt=\"\" /><br />\n查看 UUID 有三种方式：</p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>blkid</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/236412bc1e3f.png\" alt=\"\" /></p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>lsblk <span class=\"token parameter variable\">-f</span></pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/35d7182c5647.png\" alt=\"\" /></p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>ll /dev/disk/by-uuid/</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/10/28/3f9d4f69d8ea.png\" alt=\"\" /></p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>设置自动挂载：</pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token builtin class-name\">echo</span> <span class=\"token string\">\"UUID=c8ac09ca-fd4d-4511-bd2c-4fdf96f08168 /data                 ext4    defaults        0 0\"</span> <span class=\"token operator\">>></span> /etc/fstab</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>自动挂载/etc/fstab里面的东西</pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token function\">mount</span> <span class=\"token parameter variable\">-a</span></pre></td></tr></table></figure><h4 id=\"临时卸载\"><a class=\"anchor\" href=\"#临时卸载\">#</a> 临时卸载</h4>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">umount</span> /dev/vdb 重启机器之后又恢复到挂载状态</pre></td></tr></table></figure><h4 id=\"永久卸载\"><a class=\"anchor\" href=\"#永久卸载\">#</a> 永久卸载</h4>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">vim</span> /etc/fstab 把添加的磁盘信息删除即可。</pre></td></tr></table></figure>",
            "tags": [
                "Linux",
                "Centos",
                "Centos",
                "Linux",
                "Mount"
            ]
        },
        {
            "id": "https://hitoli.com/2023/09/09/squid-stunnel-%E7%A7%91%E5%AD%A6%E4%B8%8A%E7%BD%91/",
            "url": "https://hitoli.com/2023/09/09/squid-stunnel-%E7%A7%91%E5%AD%A6%E4%B8%8A%E7%BD%91/",
            "title": "squid+stunnel 科学上网",
            "date_published": "2023-09-09T08:48:00.000Z",
            "content_html": "<h4 id=\"前言\"><a class=\"anchor\" href=\"#前言\">#</a> 前言</h4>\n<p>科学上网的方法有多种，有很多第三方提供的免费方案，这些方案优缺点暂时不予讨论。实际工作生活中还是会有需要自己搭建的情况，这次介绍的是使用 squid+stunnel 方案进行搭建。</p>\n<h4 id=\"准备\"><a class=\"anchor\" href=\"#准备\">#</a> 准备</h4>\n<p>一台可以访问外网的服务器，如香港的云主机并安装 Ubuntu 系统。</p>\n<h5 id=\"squid部分\"><a class=\"anchor\" href=\"#squid部分\">#</a> squid 部分</h5>\n<ul>\n<li>1、安装</li>\n</ul>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">apt-get</span> <span class=\"token function\">install</span> <span class=\"token parameter variable\">-y</span> squid</pre></td></tr></table></figure><ul>\n<li>2、配置</li>\n</ul>\n<div class=\"note info\">\n<p>生成用户文件</p>\n</div>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">apt-get</span> <span class=\"token function\">install</span> apache2-utils</pre></td></tr><tr><td data-num=\"2\"></td><td><pre>htpasswd <span class=\"token parameter variable\">-c</span> /etc/squid/squid_user.txt 用户名</pre></td></tr></table></figure><div class=\"note info\">\n<p>修改 squid 配置<br />\n 1、直接修改 /etc/squid/squid.conf 文件<br />\n 2、修改 /etc/squid/conf.d/debian.conf 文件<br />\n两种方式都一样，在底部加入以下代码</p>\n</div>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token comment\">#dns 服务器地址</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>dns_nameservers 8.8.8.8 8.8.4.4</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>dns_v4_first on</pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token comment\"># 监听端口</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>http_port 3128</pre></td></tr><tr><td data-num=\"6\"></td><td><pre><span class=\"token comment\"># 定义 squid 密码文件与 ncsa_auth 文件位置</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/squid_user.txt</pre></td></tr><tr><td data-num=\"8\"></td><td><pre><span class=\"token comment\"># 认证进程的数量</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>auth_param basic children 15</pre></td></tr><tr><td data-num=\"10\"></td><td><pre><span class=\"token comment\"># 认证对话框显示提示信息</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>auth_param basic realm Squid proxy<span class=\"token punctuation\">-</span>caching web server</pre></td></tr><tr><td data-num=\"12\"></td><td><pre><span class=\"token comment\"># 认证有效期</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>auth_param basic credentialsttl 24 hours</pre></td></tr><tr><td data-num=\"14\"></td><td><pre><span class=\"token comment\"># 是否区分用户名大小，off 为不区分</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>auth_param basic casesensitive off</pre></td></tr><tr><td data-num=\"16\"></td><td><pre><span class=\"token comment\"># 对定义的 squid_user 文件内的用户开启认证访问</span></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>acl 用户名 proxy_auth REQUIRED</pre></td></tr><tr><td data-num=\"18\"></td><td><pre><span class=\"token comment\"># 允许 squid_user 文件内用户进行代理</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>http_access allow 用户名</pre></td></tr><tr><td data-num=\"20\"></td><td><pre><span class=\"token comment\"># 顺序匹配，最后添加拒绝所有未允许的规则。不添加会发现，未匹配到的规则会被放行</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>http_access deny all</pre></td></tr><tr><td data-num=\"22\"></td><td><pre><span class=\"token comment\"># 缓存设置</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>cache_dir ufs /var/spool/squid 100 16 256 read<span class=\"token punctuation\">-</span>only</pre></td></tr><tr><td data-num=\"24\"></td><td><pre>cache_mem 0 MB</pre></td></tr><tr><td data-num=\"25\"></td><td><pre>coredump_dir /var/spool/squid</pre></td></tr><tr><td data-num=\"26\"></td><td><pre><span class=\"token comment\"># 配置高匿，不允许设置任何多余头信息，保持原请求 header。</span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre>header_access Via deny all</pre></td></tr><tr><td data-num=\"28\"></td><td><pre>header_access X<span class=\"token punctuation\">-</span>Forwarded<span class=\"token punctuation\">-</span>For deny all</pre></td></tr><tr><td data-num=\"29\"></td><td><pre>header_access Server deny all</pre></td></tr><tr><td data-num=\"30\"></td><td><pre>header_access X<span class=\"token punctuation\">-</span>Cache deny all</pre></td></tr><tr><td data-num=\"31\"></td><td><pre>header_access X<span class=\"token punctuation\">-</span>Cache<span class=\"token punctuation\">-</span>Lookup deny all</pre></td></tr><tr><td data-num=\"32\"></td><td><pre>forwarded_for off</pre></td></tr><tr><td data-num=\"33\"></td><td><pre>via off</pre></td></tr><tr><td data-num=\"34\"></td><td><pre><span class=\"token comment\"># logs 相关配置</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre>emulate_httpd_log on</pre></td></tr><tr><td data-num=\"36\"></td><td><pre>logformat squid %<span class=\"token punctuation\">&#123;</span>X<span class=\"token punctuation\">-</span>Forwarded<span class=\"token punctuation\">-</span>For<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">></span>h %ui %un <span class=\"token punctuation\">[</span>%tl<span class=\"token punctuation\">]</span> \"%rm %ru HTTP/%rv\" %Hs %&lt;st \"%<span class=\"token punctuation\">&#123;</span>Referer<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">></span>h\" \"%<span class=\"token punctuation\">&#123;</span>User<span class=\"token punctuation\">-</span>Agent<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">></span>h\" %Ss<span class=\"token punctuation\">:</span>%Sh</pre></td></tr><tr><td data-num=\"37\"></td><td><pre>access_log /var/log/squid/access.log squid</pre></td></tr><tr><td data-num=\"38\"></td><td><pre>cache_log /var/log/squid/cache.log</pre></td></tr><tr><td data-num=\"39\"></td><td><pre>cache_store_log /var/log/squid/store.log</pre></td></tr><tr><td data-num=\"40\"></td><td><pre>logfile_rotate 20</pre></td></tr></table></figure><div class=\"note primary\">\n<p>至次已经可以通过填写安装 squid 的服务器 ip 加端口 3128 加用户名密码进行代理访问了（通过访问<span class=\"blue\"><span class=\"exturl\" data-url=\"aHR0cHM6Ly93d3cuaXAuY24v\"> https://www.ip.cn/</span></span> 查看 ip 就会发现自己的出口 ip 已经变成了 squid 服务器的 ip 了）。但是要想科学上网还必须对代理的数据进行加密，否则访问外网还是会被我国的长城防火墙阻挡，所以还需要安装 stunnel 来实现此目的。</p>\n</div>\n<h5 id=\"stunnel服务端部分\"><a class=\"anchor\" href=\"#stunnel服务端部分\">#</a> stunnel 服务端部分</h5>\n<ul>\n<li>1、安装（和 squid 装在一起）</li>\n</ul>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">apt-get</span> <span class=\"token function\">install</span> <span class=\"token parameter variable\">-y</span> stunnel</pre></td></tr></table></figure><ul>\n<li>2、生成 TLS/SSL 证书</li>\n</ul>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>openssl req <span class=\"token parameter variable\">-new</span> <span class=\"token parameter variable\">-x509</span> <span class=\"token parameter variable\">-days</span> <span class=\"token number\">3650</span> <span class=\"token parameter variable\">-nodes</span> <span class=\"token parameter variable\">-out</span> stunnel.pem <span class=\"token parameter variable\">-keyout</span> stunnel.pem</pre></td></tr></table></figure><ul>\n<li>\n<p>3、将证书 stunnel.pem 放到 /etc/stunnel/ 目录下</p>\n</li>\n<li>\n<p>4、修改 stunnel 配置 (/etc/stunnle/stunnle.conf)</p>\n</li>\n</ul>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>; 设置stunnel的pid文件路径</pre></td></tr><tr><td data-num=\"2\"></td><td><pre>pid = /etc/stunnel/stunnel.pid</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>; 设置stunnel工作的用户（组）</pre></td></tr><tr><td data-num=\"4\"></td><td><pre>setuid = root</pre></td></tr><tr><td data-num=\"5\"></td><td><pre>setgid = root</pre></td></tr><tr><td data-num=\"6\"></td><td><pre></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>; 开启日志等级：emerg (0)<span class=\"token punctuation\">,</span> alert (1)<span class=\"token punctuation\">,</span> crit (2)<span class=\"token punctuation\">,</span> err (3)<span class=\"token punctuation\">,</span> warning (4)<span class=\"token punctuation\">,</span> notice (5)<span class=\"token punctuation\">,</span> info (6)<span class=\"token punctuation\">,</span> or debug (7)</pre></td></tr><tr><td data-num=\"8\"></td><td><pre>debug = 7</pre></td></tr><tr><td data-num=\"9\"></td><td><pre>; 日志文件路径</pre></td></tr><tr><td data-num=\"10\"></td><td><pre>output = /etc/stunnel/stunnel.log</pre></td></tr><tr><td data-num=\"11\"></td><td><pre></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>; 证书文件</pre></td></tr><tr><td data-num=\"13\"></td><td><pre>cert = /etc/stunnel/stunnel.pem</pre></td></tr><tr><td data-num=\"14\"></td><td><pre>; 私钥文件</pre></td></tr><tr><td data-num=\"15\"></td><td><pre>key = /etc/stunnel/stunnel.pem</pre></td></tr><tr><td data-num=\"16\"></td><td><pre></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>; 自定义服务名squid<span class=\"token punctuation\">-</span>proxy</pre></td></tr><tr><td data-num=\"18\"></td><td><pre><span class=\"token punctuation\">[</span>squid<span class=\"token punctuation\">-</span>proxy<span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>; 服务监听的端口，client要连接这个端口与server通信</pre></td></tr><tr><td data-num=\"20\"></td><td><pre>accept = 1234（自定义）</pre></td></tr><tr><td data-num=\"21\"></td><td><pre>; 服务要连接的端口，连接到squid的3128端口，将数据发给squid</pre></td></tr><tr><td data-num=\"22\"></td><td><pre>connect = 3128</pre></td></tr></table></figure><h5 id=\"stunnel客户端部分\"><a class=\"anchor\" href=\"#stunnel客户端部分\">#</a> stunnel 客户端部分</h5>\n<div class=\"note info\">\n<p>可以安装在要代理的机器上，在需要代理的情况下再开启（代理地址填 127.0.0.1 加客户端监听端口）。也可以安装在国内的服务器上一直保持连接（代理信息填国内服务器 ip 加客户端监听端口）。本示例客户端为 windows 系统</p>\n</div>\n<ul>\n<li>1、下载地址</li>\n</ul>\n<p><span class=\"blue\"><span class=\"exturl\" data-url=\"aHR0cHM6Ly93d3cuc3R1bm5lbC5vcmcvZG93bmxvYWRzLmh0bWw=\">https://www.stunnel.org/downloads.html</span></span></p>\n<ul>\n<li>2、修改配置（C:\\Program Files (x86)\\stunnel\\config\\stunnel.conf）</li>\n</ul>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token punctuation\">[</span>squid<span class=\"token punctuation\">-</span>proxy<span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>client = yes</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>; 监听3128端口，那么用户浏览器的代理设置就是 stunnel<span class=\"token punctuation\">-</span>client<span class=\"token punctuation\">-</span>ip<span class=\"token punctuation\">:</span><span class=\"token number\">3128</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>accept = 3128</pre></td></tr><tr><td data-num=\"5\"></td><td><pre>; 要连接到的stunnel server的ip与端口</pre></td></tr><tr><td data-num=\"6\"></td><td><pre>connect = stunnel服务端ip<span class=\"token punctuation\">:</span>1234（服务端自定义端口）</pre></td></tr><tr><td data-num=\"7\"></td><td><pre></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>; 需要验证对方发过来的证书</pre></td></tr><tr><td data-num=\"9\"></td><td><pre>verify = 2</pre></td></tr><tr><td data-num=\"10\"></td><td><pre>; 用来进行证书验证的文件（stunnel服务端生成的证书复制到以下目录并改名为stunnel<span class=\"token punctuation\">-</span>server.pem）</pre></td></tr><tr><td data-num=\"11\"></td><td><pre>CAfile = C<span class=\"token punctuation\">:</span>\\Program Files (x86)\\stunnel\\config\\stunnel<span class=\"token punctuation\">-</span>server.pem</pre></td></tr></table></figure><div class=\"note primary\">\n<p>至次配置好代理 ip 为 stunnel 客户端 ip 加端口 3128 就可以正式科学上网了。如果只想对需要科学的 url 进行代理，可以通过安装 Proxy SwitchyOmega 插件实现（规则地址可通过<span class=\"blue\"><span class=\"exturl\" data-url=\"aHR0cHM6Ly9naXRodWIuY29tL2dmd2xpc3QvZ2Z3bGlzdA==\"> https://github.com/gfwlist/gfwlist</span></span> 获取）。</p>\n</div>\n<p><img data-src=\"https://nas.hitoli.com:18014/images/2023/09/09/6a38fcb32752.png\" alt=\"\" /><br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/09/09/72892168bfeb.png\" alt=\"\" /></p>\n",
            "tags": [
                "生活",
                "技术分享",
                "squid",
                "stunnel",
                "科学上网",
                "代理"
            ]
        },
        {
            "id": "https://hitoli.com/2023/09/09/Windows-11%E5%8F%B3%E9%94%AE%E8%8F%9C%E5%8D%95%E6%81%A2%E5%A4%8D%E8%80%81%E7%89%88%E6%9C%AC/",
            "url": "https://hitoli.com/2023/09/09/Windows-11%E5%8F%B3%E9%94%AE%E8%8F%9C%E5%8D%95%E6%81%A2%E5%A4%8D%E8%80%81%E7%89%88%E6%9C%AC/",
            "title": "Windows 11右键菜单恢复老版本",
            "date_published": "2023-09-09T08:38:00.000Z",
            "content_html": "<h4 id=\"恢复方法\"><a class=\"anchor\" href=\"#恢复方法\">#</a> 恢复方法</h4>\n<p>1、按【Win+X】</p>\n<p>2、选择【终端管理员】</p>\n<p>3、输入以下命令并回车：<br />\n <code>reg add &quot;HKCU\\Software\\Classes\\CLSID\\&#123;86ca1aa0-34aa-4e8b-a509-50c905bae2a2&#125;\\InprocServer32&quot; /f /ve</code></p>\n<p>4、重启电脑</p>\n",
            "tags": [
                "Windows ",
                "系统优化",
                "Windows 11"
            ]
        },
        {
            "id": "https://hitoli.com/2023/07/08/%E8%A7%A3%E5%86%B3Lombok%E6%8A%A5%E9%94%99/",
            "url": "https://hitoli.com/2023/07/08/%E8%A7%A3%E5%86%B3Lombok%E6%8A%A5%E9%94%99/",
            "title": "解决Lombok报错",
            "date_published": "2023-07-08T02:51:00.000Z",
            "content_html": "<h4 id=\"问题描述\"><a class=\"anchor\" href=\"#问题描述\">#</a> 问题描述</h4>\n<ol>\n<li>报错详情</li>\n</ol>\n<div class=\"note info\">\n<p>java: You aren’t using a compiler supported by lombok, so lombok will not work and has been disabled.<br />\nYour processor is: com.sun.proxy.$Proxy26<br />\nLombok supports: OpenJDK javac, ECJ</p>\n</div>\n<p><img data-src=\"https://nas.hitoli.com:18014/images/2023/07/08/393a238856e4.png\" alt=\"\" /></p>\n<ol start=\"2\">\n<li>\n<p>问题分析<br />\n属于 lombok 编译不通过，原因可能是因为依赖没有更到最新版本</p>\n</li>\n<li>\n<p>解决办法<br />\n在 IntelliJ IDEA 的全局配置 Compiler 中添加如下配置：</p>\n</li>\n</ol>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token punctuation\">-</span>Djps.track.ap.dependencies=false</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/07/08/34bac08a5d10.png\" alt=\"\" /></p>\n",
            "tags": [
                "工作",
                "解决问题",
                "Lombok",
                "IntelliJ",
                "IDEA"
            ]
        },
        {
            "id": "https://hitoli.com/2023/07/01/shoka%E4%B8%BB%E9%A2%98%E9%80%9F%E5%BA%A6%E4%BC%98%E5%8C%96-%E6%8B%86%E5%88%86jsdelivr/",
            "url": "https://hitoli.com/2023/07/01/shoka%E4%B8%BB%E9%A2%98%E9%80%9F%E5%BA%A6%E4%BC%98%E5%8C%96-%E6%8B%86%E5%88%86jsdelivr/",
            "title": "shoka主题速度优化-拆分jsdelivr",
            "date_published": "2023-06-30T17:15:00.000Z",
            "content_html": "<h4 id=\"前言\"><a class=\"anchor\" href=\"#前言\">#</a> 前言</h4>\n<div class=\"note primary\">\n<p>该篇文章介绍了如何对 shoka 主题进行 jsdelivr 聚合拆分，以便使用国内镜像源和异步加载，从而优化网站速度。具体操作包括更改模板、注册 helper 和更改配置。其中，推荐使用 advVendors 配置，可自定义加载源和 js 文件名，同时支持异步加载、pjax 刷新和 integrity 防 XXS 等特性。</p>\n</div>\n<p>众所周知，jsdelivr 在国内的速度可以用慢的一批来形容而 shoka 主题使用了 jsdelivr 的 combine 功能加载第三方 js, 而 combine 在国内没有镜像源并且阻断了使用 CDN 并发加速的道路，本篇博文会将 jsdelivr 聚合拆分为几个独立的 js, 以便使用国内镜像源和异步加载。</p>\n<div class=\"note info\">\n<p>此方案相较于本地化而言有较大速度优势，尤其在 CDN 并发加持下</p>\n</div>\n<h4 id=\"拆分-jsdelivr\"><a class=\"anchor\" href=\"#拆分-jsdelivr\">#</a> 拆分 jsdelivr</h4>\n<ol>\n<li>更改模板</li>\n</ol>\n<p>打开 <span class=\"red\">shoka\\layout_partials\\layout.njk</span>，找到第 144 行左右:</p>\n<figure class=\"highlight html\"><figcaption data-lang=\"HTML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>script</span> <span class=\"token attr-name\">src</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://cdn.polyfill.io/v3/polyfill.js<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span><span class=\"token script\"></span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>script</span><span class=\"token punctuation\">></span></span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>&#123;&#123; _vendor_js() &#125;&#125;</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>&#123;&#123; _js('app.js') &#125;&#125;</pre></td></tr><tr><td data-num=\"4\"></td><td><pre>&#123;&#123; partial('_partials/third-party/baidu-analytics.njk', &#123;&#125;, &#123;cache: true&#125;) &#125;&#125;</pre></td></tr></table></figure><p>更改为如下内容:</p>\n<figure class=\"highlight html\"><figcaption data-lang=\"HTML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>script</span> <span class=\"token attr-name\">src</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>https://cdn.polyfill.io/v3/polyfill.js<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span><span class=\"token script\"></span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>script</span><span class=\"token punctuation\">></span></span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>&#123;%- if theme.advVendors.enable %&#125;</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>\t&#123;% for i in _list_vendor_js() %&#125;</pre></td></tr><tr><td data-num=\"4\"></td><td><pre>\t\t&#123;&#123; _adv_vendor_js(i) &#125;&#125;</pre></td></tr><tr><td data-num=\"5\"></td><td><pre>\t&#123;% endfor %&#125;</pre></td></tr><tr><td data-num=\"6\"></td><td><pre>&#123;%- else %&#125;</pre></td></tr><tr><td data-num=\"7\"></td><td><pre>&#123;&#123; _vendor_js() &#125;&#125;</pre></td></tr><tr><td data-num=\"8\"></td><td><pre>&#123;%- endif %&#125;</pre></td></tr><tr><td data-num=\"9\"></td><td><pre>&#123;&#123; _js('app.js')&#125;&#125;</pre></td></tr><tr><td data-num=\"10\"></td><td><pre>&#123;&#123; partial('_partials/third-party/baidu-analytics.njk', &#123;&#125;, &#123;cache: true&#125;) &#125;&#125;</pre></td></tr></table></figure><ol start=\"2\">\n<li>注册 helper</li>\n</ol>\n<p>打开 <span class=\"red\">shoka\\scripts\\helpers\\asset.js</span>, 最后一行新建空行，增加如下内容:</p>\n<figure class=\"highlight javascript\"><figcaption data-lang=\"javascript\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>hexo<span class=\"token punctuation\">.</span>extend<span class=\"token punctuation\">.</span>helper<span class=\"token punctuation\">.</span><span class=\"token function\">register</span><span class=\"token punctuation\">(</span><span class=\"token string\">'_list_vendor_js'</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>    <span class=\"token keyword\">return</span> hexo<span class=\"token punctuation\">.</span>theme<span class=\"token punctuation\">.</span>config<span class=\"token punctuation\">.</span>vendorsList<span class=\"token punctuation\">.</span>js<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre><span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>hexo<span class=\"token punctuation\">.</span>extend<span class=\"token punctuation\">.</span>helper<span class=\"token punctuation\">.</span><span class=\"token function\">register</span><span class=\"token punctuation\">(</span><span class=\"token string\">'_adv_vendor_js'</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">js_name</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>    <span class=\"token keyword\">const</span> config <span class=\"token operator\">=</span> hexo<span class=\"token punctuation\">.</span>theme<span class=\"token punctuation\">.</span>config<span class=\"token punctuation\">.</span>advVendors<span class=\"token punctuation\">.</span>js<span class=\"token punctuation\">[</span>js_name<span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>    <span class=\"token keyword\">const</span> src <span class=\"token operator\">=</span> config<span class=\"token punctuation\">[</span><span class=\"token string\">\"src\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>    <span class=\"token keyword\">let</span> result<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>src<span class=\"token punctuation\">.</span><span class=\"token function\">indexOf</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"http\"</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">!==</span> <span class=\"token operator\">-</span><span class=\"token number\">1</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>        result <span class=\"token operator\">=</span> src<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span> <span class=\"token keyword\">else</span> <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>src<span class=\"token punctuation\">.</span><span class=\"token function\">indexOf</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"combine\"</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">!==</span> <span class=\"token operator\">-</span><span class=\"token number\">1</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>        console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"The combine feature is not recommended!\"</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>        result <span class=\"token operator\">=</span> hexo<span class=\"token punctuation\">.</span>theme<span class=\"token punctuation\">.</span>config<span class=\"token punctuation\">.</span>advVendors<span class=\"token punctuation\">.</span>combine <span class=\"token operator\">+</span> src<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span> <span class=\"token keyword\">else</span> <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>src<span class=\"token punctuation\">.</span><span class=\"token function\">indexOf</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"npm\"</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">!==</span> <span class=\"token operator\">-</span><span class=\"token number\">1</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>        result <span class=\"token operator\">=</span> hexo<span class=\"token punctuation\">.</span>theme<span class=\"token punctuation\">.</span>config<span class=\"token punctuation\">.</span>advVendors<span class=\"token punctuation\">.</span>npm <span class=\"token operator\">+</span> src<span class=\"token punctuation\">.</span><span class=\"token function\">slice</span><span class=\"token punctuation\">(</span><span class=\"token number\">4</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span> <span class=\"token keyword\">else</span> <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>src<span class=\"token punctuation\">.</span><span class=\"token function\">indexOf</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"gh\"</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">!==</span> <span class=\"token operator\">-</span><span class=\"token number\">1</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>        result <span class=\"token operator\">=</span> hexo<span class=\"token punctuation\">.</span>theme<span class=\"token punctuation\">.</span>config<span class=\"token punctuation\">.</span>advVendors<span class=\"token punctuation\">.</span>github <span class=\"token operator\">+</span> src<span class=\"token punctuation\">.</span><span class=\"token function\">slice</span><span class=\"token punctuation\">(</span><span class=\"token number\">3</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>        result <span class=\"token operator\">=</span> <span class=\"token string\">\"/\"</span> <span class=\"token operator\">+</span> src<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>    <span class=\"token keyword\">let</span> attr <span class=\"token operator\">=</span> <span class=\"token punctuation\">&#123;</span><span class=\"token literal-property property\">src</span><span class=\"token operator\">:</span> result<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>config<span class=\"token punctuation\">[</span><span class=\"token string\">\"async\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> attr<span class=\"token punctuation\">[</span><span class=\"token string\">\"async\"</span><span class=\"token punctuation\">]</span> <span class=\"token operator\">=</span> <span class=\"token string\">\"async\"</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>config<span class=\"token punctuation\">[</span><span class=\"token string\">\"data-pjax\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> attr<span class=\"token punctuation\">[</span><span class=\"token string\">\"data-pjax\"</span><span class=\"token punctuation\">]</span> <span class=\"token operator\">=</span> <span class=\"token string\">\"data-pjax\"</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>config<span class=\"token punctuation\">[</span><span class=\"token string\">\"hash-value\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> attr<span class=\"token punctuation\">[</span><span class=\"token string\">\"integrity\"</span><span class=\"token punctuation\">]</span><span class=\"token operator\">=</span>config<span class=\"token punctuation\">[</span><span class=\"token string\">\"hash-value\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre>    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>config<span class=\"token punctuation\">[</span><span class=\"token string\">\"deferLoad\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>        <span class=\"token keyword\">return</span> <span class=\"token function\">htmlTag</span><span class=\"token punctuation\">(</span><span class=\"token string\">'script'</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">&#123;</span><span class=\"token string-property property\">\"data-pjax\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span> <span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\"></pre></td></tr><tr><td data-num=\"27\"></td><td><pre>        const script=document.createElement(\"script\");script.src=\"</span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">$&#123;</span>result<span class=\"token interpolation-punctuation punctuation\">&#125;</span></span><span class=\"token string\">\",script.async=true,document.body.appendChild(script)</pre></td></tr><tr><td data-num=\"28\"></td><td><pre>        </span><span class=\"token template-punctuation string\">`</span></span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre>    <span class=\"token keyword\">return</span> <span class=\"token function\">htmlTag</span><span class=\"token punctuation\">(</span><span class=\"token string\">'script'</span><span class=\"token punctuation\">,</span> attr<span class=\"token punctuation\">,</span> <span class=\"token string\">''</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre><span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr></table></figure><ol start=\"3\">\n<li>更改配置</li>\n</ol>\n<p>在 shoka 目录下 <span class=\"red\">_config.yml</span> 增加如下内容:</p>\n<div class=\"note info\">\n<p>推荐内容，可根据自己情况更改</p>\n</div>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token key atrule\">advVendors</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>  <span class=\"token key atrule\">enable</span><span class=\"token punctuation\">:</span> <span class=\"token boolean important\">true</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>  <span class=\"token key atrule\">github</span><span class=\"token punctuation\">:</span> <span class=\"token string\">\"https://cdn.jsdelivr.net/gh/\"</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>  <span class=\"token key atrule\">combine</span><span class=\"token punctuation\">:</span> <span class=\"token string\">\"https://cdn.jsdelivr.net/\"</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>  <span class=\"token key atrule\">npm</span><span class=\"token punctuation\">:</span> <span class=\"token string\">\"https://unpkg.com/\"</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>  <span class=\"token key atrule\">js</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>    <span class=\"token key atrule\">pace</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lf9<span class=\"token punctuation\">-</span>cdn<span class=\"token punctuation\">-</span>tos.bytecdntp.com/cdn/expire<span class=\"token punctuation\">-</span>1<span class=\"token punctuation\">-</span>M/pace/1.0.2/pace.min.js</pre></td></tr><tr><td data-num=\"9\"></td><td><pre>    <span class=\"token key atrule\">pjax</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lib.baomitu.com/pjax/0.2.8/pjax.min.js</pre></td></tr><tr><td data-num=\"11\"></td><td><pre>    <span class=\"token key atrule\">fetch</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> npm/whatwg<span class=\"token punctuation\">-</span>fetch@3.4.0/dist/fetch.umd.js</pre></td></tr><tr><td data-num=\"13\"></td><td><pre>    <span class=\"token key atrule\">anime</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lf9<span class=\"token punctuation\">-</span>cdn<span class=\"token punctuation\">-</span>tos.bytecdntp.com/cdn/expire<span class=\"token punctuation\">-</span>1<span class=\"token punctuation\">-</span>M/animejs/3.2.0/anime.min.js</pre></td></tr><tr><td data-num=\"15\"></td><td><pre>    <span class=\"token key atrule\">algolia</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lf9<span class=\"token punctuation\">-</span>cdn<span class=\"token punctuation\">-</span>tos.bytecdntp.com/cdn/expire<span class=\"token punctuation\">-</span>1<span class=\"token punctuation\">-</span>M/algoliasearch/4.12.1/algoliasearch<span class=\"token punctuation\">-</span>lite.umd.min.js</pre></td></tr><tr><td data-num=\"17\"></td><td><pre>    <span class=\"token key atrule\">instantsearch</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lf9<span class=\"token punctuation\">-</span>cdn<span class=\"token punctuation\">-</span>tos.bytecdntp.com/cdn/expire<span class=\"token punctuation\">-</span>1<span class=\"token punctuation\">-</span>M/instantsearch.js/4.39.0/instantsearch.production.min.js</pre></td></tr><tr><td data-num=\"19\"></td><td><pre>    <span class=\"token key atrule\">lazyload</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lf9<span class=\"token punctuation\">-</span>cdn<span class=\"token punctuation\">-</span>tos.bytecdntp.com/cdn/expire<span class=\"token punctuation\">-</span>1<span class=\"token punctuation\">-</span>M/lozad.js/1.16.0/lozad.min.js</pre></td></tr><tr><td data-num=\"21\"></td><td><pre>    <span class=\"token key atrule\">quicklink</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lf9<span class=\"token punctuation\">-</span>cdn<span class=\"token punctuation\">-</span>tos.bytecdntp.com/cdn/expire<span class=\"token punctuation\">-</span>1<span class=\"token punctuation\">-</span>M/quicklink/2.2.0/quicklink.umd.min.js</pre></td></tr><tr><td data-num=\"23\"></td><td><pre>    <span class=\"token key atrule\">fancybox</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lf26<span class=\"token punctuation\">-</span>cdn<span class=\"token punctuation\">-</span>tos.bytecdntp.com/cdn/expire<span class=\"token punctuation\">-</span>1<span class=\"token punctuation\">-</span>M/<span class=\"token punctuation\">?</span><span class=\"token punctuation\">?</span>jquery/3.5.1/jquery.min.js<span class=\"token punctuation\">,</span>fancybox/3.5.7/jquery.fancybox.min.js<span class=\"token punctuation\">,</span>justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js</pre></td></tr><tr><td data-num=\"25\"></td><td><pre>      <span class=\"token key atrule\">async</span><span class=\"token punctuation\">:</span> <span class=\"token boolean important\">true</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>    <span class=\"token key atrule\">valine</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> gh/amehime/MiniValine@4.2.2<span class=\"token punctuation\">-</span>beta10/dist/MiniValine.min.js</pre></td></tr><tr><td data-num=\"28\"></td><td><pre>    <span class=\"token key atrule\">copy_tex</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> https<span class=\"token punctuation\">:</span>//lf9<span class=\"token punctuation\">-</span>cdn<span class=\"token punctuation\">-</span>tos.bytecdntp.com/cdn/expire<span class=\"token punctuation\">-</span>1<span class=\"token punctuation\">-</span>M/KaTeX/0.12.0/contrib/copy<span class=\"token punctuation\">-</span>tex.min.js</pre></td></tr><tr><td data-num=\"30\"></td><td><pre>      <span class=\"token key atrule\">async</span><span class=\"token punctuation\">:</span> <span class=\"token boolean important\">true</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre>    <span class=\"token key atrule\">chart</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"32\"></td><td><pre>      <span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> npm/frappe<span class=\"token punctuation\">-</span>charts@1.5.0/dist/frappe<span class=\"token punctuation\">-</span>charts.min.iife.js</pre></td></tr><tr><td data-num=\"33\"></td><td><pre></pre></td></tr><tr><td data-num=\"34\"></td><td><pre><span class=\"token key atrule\">vendorsList</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre>  <span class=\"token key atrule\">js</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"36\"></td><td><pre>    <span class=\"token punctuation\">-</span> pace</pre></td></tr><tr><td data-num=\"37\"></td><td><pre>    <span class=\"token punctuation\">-</span> pjax</pre></td></tr><tr><td data-num=\"38\"></td><td><pre>    <span class=\"token punctuation\">-</span> fetch</pre></td></tr><tr><td data-num=\"39\"></td><td><pre>    <span class=\"token punctuation\">-</span> anime</pre></td></tr><tr><td data-num=\"40\"></td><td><pre>    <span class=\"token punctuation\">-</span> algolia</pre></td></tr><tr><td data-num=\"41\"></td><td><pre>    <span class=\"token punctuation\">-</span> instantsearch</pre></td></tr><tr><td data-num=\"42\"></td><td><pre>    <span class=\"token punctuation\">-</span> lazyload</pre></td></tr><tr><td data-num=\"43\"></td><td><pre>    <span class=\"token punctuation\">-</span> quicklink</pre></td></tr><tr><td data-num=\"44\"></td><td><pre>    <span class=\"token punctuation\">-</span> fancybox</pre></td></tr><tr><td data-num=\"45\"></td><td><pre>    <span class=\"token punctuation\">-</span> valine</pre></td></tr><tr><td data-num=\"46\"></td><td><pre>    <span class=\"token punctuation\">-</span> copy_tex</pre></td></tr><tr><td data-num=\"47\"></td><td><pre>    <span class=\"token punctuation\">-</span> chart</pre></td></tr></table></figure><p>下面为结构详解:</p>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token key atrule\">advVendors</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>\t<span class=\"token key atrule\">enable</span><span class=\"token punctuation\">:</span> <span class=\"token boolean important\">true</span> <span class=\"token comment\">#是否开启，关闭使用主题默认加载</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>\t<span class=\"token key atrule\">github</span><span class=\"token punctuation\">:</span> <span class=\"token comment\">#github 使用的加载源，需要协议头和末尾斜杠</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>\t<span class=\"token key atrule\">combine</span><span class=\"token punctuation\">:</span> <span class=\"token comment\">#聚合 js 使用的加载源 (不建议使用)</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>\t<span class=\"token key atrule\">npm</span><span class=\"token punctuation\">:</span> <span class=\"token comment\">#npm 的加载源</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>\t<span class=\"token key atrule\">js</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>\t\t<span class=\"token key atrule\">jspackage</span><span class=\"token punctuation\">:</span> <span class=\"token comment\">#js 名，可以与文件名不一致</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>\t\t\t<span class=\"token key atrule\">src</span><span class=\"token punctuation\">:</span> <span class=\"token string\">\"资源地址,详情见后面\"</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>\t\t\t<span class=\"token comment\"># async: true 异步加载此 js</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>\t\t\t<span class=\"token comment\"># data-pjax: true 在 pjax 加载时刷新此 js</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>\t\t\t<span class=\"token comment\"># hash-value: 这个资源的 integrity 值，用于防 XXS</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>\t\t\t<span class=\"token comment\"># deferLoad: true 使用动态 DOM 节点添加延迟 js 加载 (实验性)</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre></pre></td></tr><tr><td data-num=\"14\"></td><td><pre><span class=\"token key atrule\">vendorsList</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>  <span class=\"token key atrule\">js</span><span class=\"token punctuation\">:</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>  \t<span class=\"token punctuation\">-</span> jspackage <span class=\"token comment\">#与上方 jspackage 一致即可</span></pre></td></tr></table></figure><p>资源地址格式如下:</p>\n<p><span class=\"red\"><span class=\"exturl\" data-url=\"aHR0cHM6Ly9leGFtcGxlLmNvbS94eHguanM=\">https://example.com/xxx.js</span></span> 使用 http (s) 地址加载 js<br />\n<span class=\"red\">combine/xxx.js,xxx.js</span> 使用 jsdelivr 的 combine 功能加载 (不推荐)<br />\n<span class=\"red\">npm/xxx/xxx.js</span> 使用 npm 源加载 js<br />\n<span class=\"red\">gh/xxx/xxx.js</span> 使用 gh 源加载 js<br />\n<span class=\"red\">xxx.js</span> 从本地加载 js<br />\n 优先级如下:<br />\n<span class=\"red\">http&gt;combine&gt;npm&gt;gh &gt; 本地</span></p>\n",
            "tags": [
                "极空间",
                "Docker",
                "Hexo",
                "Hexo",
                "Shoka",
                "jsdelivr"
            ]
        },
        {
            "id": "https://hitoli.com/2023/05/30/http%E8%AF%B7%E6%B1%82%E4%B9%8BrestTemplate%E9%85%8D%E7%BD%AE%E8%B6%85%E6%97%B6%E6%97%B6%E9%97%B4/",
            "url": "https://hitoli.com/2023/05/30/http%E8%AF%B7%E6%B1%82%E4%B9%8BrestTemplate%E9%85%8D%E7%BD%AE%E8%B6%85%E6%97%B6%E6%97%B6%E9%97%B4/",
            "title": "http请求之restTemplate配置超时时间",
            "date_published": "2023-05-30T09:20:00.000Z",
            "content_html": "<h4 id=\"问题\"><a class=\"anchor\" href=\"#问题\">#</a> 问题</h4>\n<p>http 请求发起后接收不到返回数据！！！【测试环境没出问题，发到正式环境就有问题】</p>\n<p>项目中通过 restTemplate 发起请求：</p>\n<figure class=\"highlight java\"><figcaption data-lang=\"java\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>log<span class=\"token punctuation\">.</span><span class=\"token function\">info</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"请求入参:&#123;&#125;\"</span><span class=\"token punctuation\">,</span><span class=\"token constant\">JSON</span><span class=\"token punctuation\">.</span><span class=\"token function\">toJSONString</span><span class=\"token punctuation\">(</span>request<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span><span class=\"token comment\">// 打印日志 1</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token comment\">// 配置 http 请求的连接超时时间和读取超时时间</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre><span class=\"token class-name\">HttpsClientRequestFactory</span> factory <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">HttpsClientRequestFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>factory<span class=\"token punctuation\">.</span><span class=\"token function\">setConnectTimeout</span><span class=\"token punctuation\">(</span><span class=\"token number\">60</span> <span class=\"token operator\">*</span> <span class=\"token number\">1000</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>factory<span class=\"token punctuation\">.</span><span class=\"token function\">setReadTimeout</span><span class=\"token punctuation\">(</span><span class=\"token number\">5</span> <span class=\"token operator\">*</span> <span class=\"token number\">60</span> <span class=\"token operator\">*</span> <span class=\"token number\">1000</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre><span class=\"token class-name\">RestTemplate</span> restTemplate <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">RestTemplate</span><span class=\"token punctuation\">(</span>factory<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre><span class=\"token class-name\">Result</span><span class=\"token generics\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">InventoryResult</span><span class=\"token punctuation\">></span></span> result <span class=\"token operator\">=</span> restTemplate<span class=\"token punctuation\">.</span><span class=\"token function\">postForObject</span><span class=\"token punctuation\">(</span>address<span class=\"token punctuation\">.</span><span class=\"token function\">concat</span><span class=\"token punctuation\">(</span>inventoryUrl<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> request<span class=\"token punctuation\">,</span> <span class=\"token class-name\">Result</span><span class=\"token punctuation\">.</span><span class=\"token keyword\">class</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>log<span class=\"token punctuation\">.</span><span class=\"token function\">info</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"库存同步，返回数据: &#123;&#125;\"</span><span class=\"token punctuation\">,</span> result<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span><span class=\"token comment\">// 打印日志 2</span></pre></td></tr></table></figure><ul>\n<li>打印日志 1 内容为：</li>\n</ul>\n<p>http 请求入参:{data=[{ productStatus=10,skuCode=null}], messageId=ewpfpr1t6ey5r6qj0su0w1h6rt73hr,token=vgvU5EJKuZbuHii7WH6pTINp40ZRicaqLz4dq5P7L6pDzWir8EEGZhCKPucQjljsw69EHasEy+iJfdTofDg==}</p>\n<ul>\n<li>\n<p>打印日志 2 内容为：没有打印内容！！！</p>\n</li>\n<li>\n<p>最后发现是因为测试环境中数据量较小，http 请求后，很快能得到相应，而正式环境数据量较大，没有及时得到响应，连接或者读取超时！！！</p>\n</li>\n</ul>\n<h4 id=\"解决方式\"><a class=\"anchor\" href=\"#解决方式\">#</a> 解决方式</h4>\n<h6 id=\"第一种\"><a class=\"anchor\" href=\"#第一种\">#</a> 第一种</h6>\n<ol>\n<li>添加 HttpsClientRequestFactory 类，并继承 SimpleClientHttpRequestFactory</li>\n</ol>\n<figure class=\"highlight java\"><figcaption data-lang=\"java\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token comment\">/**</pre></td></tr><tr><td data-num=\"2\"></td><td><pre> * 兼容调 Https 接口</pre></td></tr><tr><td data-num=\"3\"></td><td><pre> */</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token keyword\">public</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">HttpsClientRequestFactory</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">SimpleClientHttpRequestFactory</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre> </pre></td></tr><tr><td data-num=\"6\"></td><td><pre>    <span class=\"token annotation punctuation\">@Override</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>    <span class=\"token keyword\">protected</span> <span class=\"token keyword\">void</span> <span class=\"token function\">prepareConnection</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">HttpURLConnection</span> connection<span class=\"token punctuation\">,</span> <span class=\"token class-name\">String</span> httpMethod<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>            <span class=\"token keyword\">throws</span> <span class=\"token class-name\">IOException</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>connection <span class=\"token keyword\">instanceof</span> <span class=\"token class-name\">HttpsURLConnection</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>            <span class=\"token function\">prepareHttpsConnection</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">HttpsURLConnection</span><span class=\"token punctuation\">)</span> connection<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>        <span class=\"token keyword\">super</span><span class=\"token punctuation\">.</span><span class=\"token function\">prepareConnection</span><span class=\"token punctuation\">(</span>connection<span class=\"token punctuation\">,</span> httpMethod<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre> </pre></td></tr><tr><td data-num=\"15\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token keyword\">void</span> <span class=\"token function\">prepareHttpsConnection</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">HttpsURLConnection</span> connection<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>        connection<span class=\"token punctuation\">.</span><span class=\"token function\">setHostnameVerifier</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">new</span> <span class=\"token class-name\">SkipHostnameVerifier</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>        <span class=\"token keyword\">try</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>            connection<span class=\"token punctuation\">.</span><span class=\"token function\">setSSLSocketFactory</span><span class=\"token punctuation\">(</span><span class=\"token function\">createSslSocketFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>        <span class=\"token keyword\">catch</span> <span class=\"token punctuation\">(</span><span class=\"token class-name\">Exception</span> ex<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>            <span class=\"token comment\">// Ignore</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre> </pre></td></tr><tr><td data-num=\"25\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token class-name\">SSLSocketFactory</span> <span class=\"token function\">createSslSocketFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">throws</span> <span class=\"token class-name\">Exception</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>        <span class=\"token class-name\">SSLContext</span> context <span class=\"token operator\">=</span> <span class=\"token class-name\">SSLContext</span><span class=\"token punctuation\">.</span><span class=\"token function\">getInstance</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"TLS\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre>        context<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">null</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">TrustManager</span><span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">SkipX509TrustManager</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"28\"></td><td><pre>                <span class=\"token keyword\">new</span> <span class=\"token class-name\">SecureRandom</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre>        <span class=\"token keyword\">return</span> context<span class=\"token punctuation\">.</span><span class=\"token function\">getSocketFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre> </pre></td></tr><tr><td data-num=\"32\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">SkipHostnameVerifier</span> <span class=\"token keyword\">implements</span> <span class=\"token class-name\">HostnameVerifier</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"33\"></td><td><pre> </pre></td></tr><tr><td data-num=\"34\"></td><td><pre>        <span class=\"token annotation punctuation\">@Override</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre>        <span class=\"token keyword\">public</span> <span class=\"token keyword\">boolean</span> <span class=\"token function\">verify</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">String</span> s<span class=\"token punctuation\">,</span> <span class=\"token class-name\">SSLSession</span> sslSession<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"36\"></td><td><pre>            <span class=\"token keyword\">return</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"37\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"38\"></td><td><pre> </pre></td></tr><tr><td data-num=\"39\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"40\"></td><td><pre> </pre></td></tr><tr><td data-num=\"41\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token keyword\">static</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">SkipX509TrustManager</span> <span class=\"token keyword\">implements</span> <span class=\"token class-name\">X509TrustManager</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"42\"></td><td><pre> </pre></td></tr><tr><td data-num=\"43\"></td><td><pre>        <span class=\"token annotation punctuation\">@Override</span></pre></td></tr><tr><td data-num=\"44\"></td><td><pre>        <span class=\"token keyword\">public</span> <span class=\"token class-name\">X509Certificate</span><span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span> <span class=\"token function\">getAcceptedIssuers</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"45\"></td><td><pre>            <span class=\"token keyword\">return</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">X509Certificate</span><span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"46\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"47\"></td><td><pre> </pre></td></tr><tr><td data-num=\"48\"></td><td><pre>        <span class=\"token annotation punctuation\">@Override</span></pre></td></tr><tr><td data-num=\"49\"></td><td><pre>        <span class=\"token keyword\">public</span> <span class=\"token keyword\">void</span> <span class=\"token function\">checkClientTrusted</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">X509Certificate</span><span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span> chain<span class=\"token punctuation\">,</span> <span class=\"token class-name\">String</span> authType<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"50\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"51\"></td><td><pre> </pre></td></tr><tr><td data-num=\"52\"></td><td><pre>        <span class=\"token annotation punctuation\">@Override</span></pre></td></tr><tr><td data-num=\"53\"></td><td><pre>        <span class=\"token keyword\">public</span> <span class=\"token keyword\">void</span> <span class=\"token function\">checkServerTrusted</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">X509Certificate</span><span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span> chain<span class=\"token punctuation\">,</span> <span class=\"token class-name\">String</span> authType<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"54\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"55\"></td><td><pre> </pre></td></tr><tr><td data-num=\"56\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"57\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><ol start=\"2\">\n<li>使用 restTemplate 发起请求前先设置连接和超时时间或者通过容器加载配置类然后设置超时时间</li>\n</ol>\n<figure class=\"highlight java\"><figcaption data-lang=\"java\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token comment\">// 配置 http 请求的连接超时时间和读取超时时间</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token class-name\">HttpsClientRequestFactory</span> factory <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">HttpsClientRequestFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>factory<span class=\"token punctuation\">.</span><span class=\"token function\">setConnectTimeout</span><span class=\"token punctuation\">(</span><span class=\"token number\">60</span> <span class=\"token operator\">*</span> <span class=\"token number\">1000</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>factory<span class=\"token punctuation\">.</span><span class=\"token function\">setReadTimeout</span><span class=\"token punctuation\">(</span><span class=\"token number\">5</span> <span class=\"token operator\">*</span> <span class=\"token number\">60</span> <span class=\"token operator\">*</span> <span class=\"token number\">1000</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre><span class=\"token class-name\">RestTemplate</span> restTemplate <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">RestTemplate</span><span class=\"token punctuation\">(</span>factory<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre><span class=\"token class-name\">BaseResult</span><span class=\"token generics\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">QueryInventoryResult</span><span class=\"token punctuation\">></span></span> result <span class=\"token operator\">=</span> restTemplate<span class=\"token punctuation\">.</span><span class=\"token function\">postForObject</span><span class=\"token punctuation\">(</span>address<span class=\"token punctuation\">.</span><span class=\"token function\">concat</span><span class=\"token punctuation\">(</span>inventoryUrl<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> request<span class=\"token punctuation\">,</span> <span class=\"token class-name\">Result</span><span class=\"token punctuation\">.</span><span class=\"token keyword\">class</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr></table></figure><figure class=\"highlight java\"><figcaption data-lang=\"java\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token annotation punctuation\">@Configuration</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token keyword\">public</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">RestConfig</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre> </pre></td></tr><tr><td data-num=\"4\"></td><td><pre>    <span class=\"token comment\">//60 * 1000</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>    <span class=\"token annotation punctuation\">@Value</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"$&#123;rest.connectTimeout:60000&#125;\"</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token keyword\">int</span> connectTimeout<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre> </pre></td></tr><tr><td data-num=\"8\"></td><td><pre>    <span class=\"token comment\">//5 * 60 * 1000</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>    <span class=\"token annotation punctuation\">@Value</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"$&#123;rest.readTimeout:300000&#125;\"</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token keyword\">int</span> readTimeout<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre> </pre></td></tr><tr><td data-num=\"12\"></td><td><pre>    <span class=\"token annotation punctuation\">@Bean</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>    <span class=\"token keyword\">public</span> <span class=\"token class-name\">RestTemplate</span> <span class=\"token function\">restTemplate</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>        <span class=\"token class-name\">SimpleClientHttpRequestFactory</span> simpleClientHttpRequestFactory <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">SimpleClientHttpRequestFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>        simpleClientHttpRequestFactory<span class=\"token punctuation\">.</span><span class=\"token function\">setConnectTimeout</span><span class=\"token punctuation\">(</span>connectTimeout<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>        simpleClientHttpRequestFactory<span class=\"token punctuation\">.</span><span class=\"token function\">setReadTimeout</span><span class=\"token punctuation\">(</span>readTimeout<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>        <span class=\"token class-name\">RestTemplate</span> restTemplate <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">RestTemplate</span><span class=\"token punctuation\">(</span>simpleClientHttpRequestFactory<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>        <span class=\"token keyword\">return</span> restTemplate<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><h6 id=\"第二种\"><a class=\"anchor\" href=\"#第二种\">#</a> 第二种</h6>\n<figure class=\"highlight java\"><figcaption data-lang=\"java\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token annotation punctuation\">@Configuration</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token keyword\">public</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">RestConfig</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre> </pre></td></tr><tr><td data-num=\"4\"></td><td><pre>    <span class=\"token comment\">//60 * 1000</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>    <span class=\"token annotation punctuation\">@Value</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"$&#123;rest.connectTimeout:60000&#125;\"</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token keyword\">int</span> connectTimeout<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre> </pre></td></tr><tr><td data-num=\"8\"></td><td><pre>    <span class=\"token comment\">//5 * 60 * 1000</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>    <span class=\"token annotation punctuation\">@Value</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"$&#123;rest.readTimeout:300000&#125;\"</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token keyword\">int</span> readTimeout<span class=\"token punctuation\">;</span>  </pre></td></tr><tr><td data-num=\"11\"></td><td><pre> </pre></td></tr><tr><td data-num=\"12\"></td><td><pre>    <span class=\"token annotation punctuation\">@Value</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"$&#123;rest.connectionRequestTimeout:300000&#125;\"</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>    <span class=\"token keyword\">private</span> <span class=\"token keyword\">int</span> connectionRequestTimeout<span class=\"token punctuation\">;</span>  </pre></td></tr><tr><td data-num=\"14\"></td><td><pre> </pre></td></tr><tr><td data-num=\"15\"></td><td><pre>  <span class=\"token comment\">/**</pre></td></tr><tr><td data-num=\"16\"></td><td><pre>     * 使用 HttpComponentsClientHttpRequestFactory 创建 http 请求（推荐）</pre></td></tr><tr><td data-num=\"17\"></td><td><pre>     */</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>    <span class=\"token annotation punctuation\">@Bean</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>    <span class=\"token keyword\">public</span> <span class=\"token class-name\">RestTemplate</span> <span class=\"token function\">restTemplate</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>        <span class=\"token class-name\">HttpComponentsClientHttpRequestFactory</span> httpRequestFactory <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">HttpComponentsClientHttpRequestFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>        httpRequestFactory<span class=\"token punctuation\">.</span><span class=\"token function\">setConnectionRequestTimeout</span><span class=\"token punctuation\">(</span>connectionRequestTimeout<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>        httpRequestFactory<span class=\"token punctuation\">.</span><span class=\"token function\">setConnectTimeout</span><span class=\"token punctuation\">(</span>connectTimeout<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>        httpRequestFactory<span class=\"token punctuation\">.</span><span class=\"token function\">setReadTimeout</span><span class=\"token punctuation\">(</span>readTimeout<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>        <span class=\"token keyword\">return</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">RestTemplate</span><span class=\"token punctuation\">(</span>httpRequestFactory<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre> </pre></td></tr><tr><td data-num=\"26\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><h6 id=\"第三种基于第二种升级\"><a class=\"anchor\" href=\"#第三种基于第二种升级\">#</a> 第三种（基于第二种升级）</h6>\n<figure class=\"highlight java\"><figcaption data-lang=\"java\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token annotation punctuation\">@Configuration</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token keyword\">public</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">RestConfig</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre> </pre></td></tr><tr><td data-num=\"4\"></td><td><pre>  </pre></td></tr><tr><td data-num=\"5\"></td><td><pre>    <span class=\"token comment\">/**</pre></td></tr><tr><td data-num=\"6\"></td><td><pre>     * 高并发采用 HttpClient 连接池</pre></td></tr><tr><td data-num=\"7\"></td><td><pre>     */</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>    <span class=\"token annotation punctuation\">@Bean</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>    <span class=\"token keyword\">public</span> <span class=\"token class-name\">RestTemplate</span> <span class=\"token function\">restTemplate</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>        <span class=\"token keyword\">return</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">RestTemplate</span><span class=\"token punctuation\">(</span><span class=\"token function\">httpRequestFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre> </pre></td></tr><tr><td data-num=\"13\"></td><td><pre> </pre></td></tr><tr><td data-num=\"14\"></td><td><pre>    <span class=\"token annotation punctuation\">@Bean</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>    <span class=\"token keyword\">public</span> <span class=\"token class-name\">ClientHttpRequestFactory</span> <span class=\"token function\">httpRequestFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>        <span class=\"token keyword\">return</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">HttpComponentsClientHttpRequestFactory</span><span class=\"token punctuation\">(</span><span class=\"token function\">httpClient</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre> </pre></td></tr><tr><td data-num=\"19\"></td><td><pre> </pre></td></tr><tr><td data-num=\"20\"></td><td><pre>    <span class=\"token annotation punctuation\">@Bean</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>    <span class=\"token keyword\">public</span> <span class=\"token class-name\">HttpClient</span> <span class=\"token function\">httpClient</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>        <span class=\"token class-name\">Registry</span><span class=\"token generics\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">ConnectionSocketFactory</span><span class=\"token punctuation\">></span></span> registry <span class=\"token operator\">=</span> <span class=\"token class-name\">RegistryBuilder</span><span class=\"token punctuation\">.</span><span class=\"token generics\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">ConnectionSocketFactory</span><span class=\"token punctuation\">></span></span><span class=\"token function\">create</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">register</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"http\"</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">PlainConnectionSocketFactory</span><span class=\"token punctuation\">.</span><span class=\"token function\">getSocketFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">register</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"https\"</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">SSLConnectionSocketFactory</span><span class=\"token punctuation\">.</span><span class=\"token function\">getSocketFactory</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">build</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>        <span class=\"token class-name\">PoolingHttpClientConnectionManager</span> connectionManager <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">PoolingHttpClientConnectionManager</span><span class=\"token punctuation\">(</span>registry<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre>        <span class=\"token comment\">// 设置整个连接池最大连接数</span></pre></td></tr><tr><td data-num=\"28\"></td><td><pre>        connectionManager<span class=\"token punctuation\">.</span><span class=\"token function\">setMaxTotal</span><span class=\"token punctuation\">(</span><span class=\"token number\">1000</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre> \t\t\t<span class=\"token comment\">// 路由是对 maxTotal 的细分</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre>        connectionManager<span class=\"token punctuation\">.</span><span class=\"token function\">setDefaultMaxPerRoute</span><span class=\"token punctuation\">(</span><span class=\"token number\">100</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre>        <span class=\"token comment\">// 定义不活动的时间（毫秒），超过的连接从连接池拿取需要重新验证</span></pre></td></tr><tr><td data-num=\"32\"></td><td><pre>        connectionManager<span class=\"token punctuation\">.</span><span class=\"token function\">setValidateAfterInactivity</span><span class=\"token punctuation\">(</span><span class=\"token number\">200</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"33\"></td><td><pre>        <span class=\"token class-name\">RequestConfig</span> requestConfig <span class=\"token operator\">=</span> <span class=\"token class-name\">RequestConfig</span><span class=\"token punctuation\">.</span><span class=\"token function\">custom</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"34\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">setSocketTimeout</span><span class=\"token punctuation\">(</span><span class=\"token number\">30000</span><span class=\"token punctuation\">)</span>  <span class=\"token comment\">// 返回数据的超时时间</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">setConnectTimeout</span><span class=\"token punctuation\">(</span><span class=\"token number\">20000</span><span class=\"token punctuation\">)</span> <span class=\"token comment\">// 连接上服务器的超时时间</span></pre></td></tr><tr><td data-num=\"36\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">setConnectionRequestTimeout</span><span class=\"token punctuation\">(</span><span class=\"token number\">1000</span><span class=\"token punctuation\">)</span> <span class=\"token comment\">// 从连接池中获取连接的超时时间</span></pre></td></tr><tr><td data-num=\"37\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">build</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"38\"></td><td><pre>        <span class=\"token keyword\">return</span> <span class=\"token class-name\">HttpClientBuilder</span><span class=\"token punctuation\">.</span><span class=\"token function\">create</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"39\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">setDefaultRequestConfig</span><span class=\"token punctuation\">(</span>requestConfig<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"40\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">setConnectionManager</span><span class=\"token punctuation\">(</span>connectionManager<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"41\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">evictIdleConnections</span><span class=\"token punctuation\">(</span><span class=\"token number\">2</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">TimeUnit</span><span class=\"token punctuation\">.</span><span class=\"token constant\">SECONDS</span><span class=\"token punctuation\">)</span> <span class=\"token comment\">// 保持空闲的最大时间</span></pre></td></tr><tr><td data-num=\"42\"></td><td><pre>                <span class=\"token punctuation\">.</span><span class=\"token function\">build</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"43\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"44\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure>",
            "tags": [
                "工作",
                "解决问题",
                "RestTemplate"
            ]
        },
        {
            "id": "https://hitoli.com/2023/05/25/%E8%A7%A3%E5%86%B3MySQL%E6%8A%A5only-full-group-by%E9%94%99%E8%AF%AF/",
            "url": "https://hitoli.com/2023/05/25/%E8%A7%A3%E5%86%B3MySQL%E6%8A%A5only-full-group-by%E9%94%99%E8%AF%AF/",
            "title": "解决MySQL报only_full_group_by错误",
            "date_published": "2023-05-25T10:25:00.000Z",
            "content_html": "<h4 id=\"问题描述\"><a class=\"anchor\" href=\"#问题描述\">#</a> 问题描述</h4>\n<p>当我们迁移到 MySQL 5.7+ 的版本时，常会碰到 ERROR 1055 only_full_group_by 错误，这是 5.7 之后 SQL_MODE 默认打开了严格模式导致的错误。说明你代码里有地方写的不严谨。</p>\n<h4 id=\"解决方法\"><a class=\"anchor\" href=\"#解决方法\">#</a> 解决方法</h4>\n<ol>\n<li>重写 sql</li>\n<li>返回宽松模式</li>\n</ol>\n<figure class=\"highlight sql\"><figcaption data-lang=\"SQL\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token comment\">#查询 sql_mode</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token keyword\">select</span> @<span class=\"token variable\">@GLOBAL.sql_mode</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre><span class=\"token comment\">#删除 ONLY_FULL_GROUP_BY</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token comment\">#设置 sql_mode</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre><span class=\"token keyword\">set</span> @<span class=\"token variable\">@GLOBAL.sql_mode</span><span class=\"token operator\">=</span><span class=\"token string\">'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'</span><span class=\"token punctuation\">;</span></pre></td></tr></table></figure><ol start=\"3\">\n<li>使用聚合函数<br />\n如果某些特别的原因就是要查询未分组字段，但你又没空改代码，那么我们可使用聚合函数来规避这类错误，算是一种折中的方案了，语法改严谨了，代码又不需要大动。如 ANY_VALUE ()、MAX ()、MIN () 或者 GROUP_CONCAT () 等聚合函数。</li>\n</ol>\n",
            "tags": [
                "工作",
                "解决问题",
                "mysql"
            ]
        },
        {
            "id": "https://hitoli.com/2023/05/25/MySQL%E4%B8%AD%E7%9A%84any-value-%E5%87%BD%E6%95%B0/",
            "url": "https://hitoli.com/2023/05/25/MySQL%E4%B8%AD%E7%9A%84any-value-%E5%87%BD%E6%95%B0/",
            "title": "MySQL中的any_value()函数",
            "date_published": "2023-05-25T10:07:00.000Z",
            "content_html": "<h4 id=\"问题\"><a class=\"anchor\" href=\"#问题\">#</a> 问题</h4>\n<p>业务要求：查询所有省份：<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/05/25/778f34f5670d.png\" alt=\"\" /></p>\n<h4 id=\"方法\"><a class=\"anchor\" href=\"#方法\">#</a> 方法</h4>\n<ol>\n<li>distinct 排除重复</li>\n</ol>\n<figure class=\"highlight sql\"><figcaption data-lang=\"SQL\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token keyword\">SELECT</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>\t<span class=\"token keyword\">DISTINCT</span><span class=\"token punctuation\">(</span>province_code<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>\tprovince_name</pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token keyword\">FROM</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>\tt_mip_base_area</pre></td></tr></table></figure><ol start=\"2\">\n<li>group by 根据身份编码分组</li>\n</ol>\n<figure class=\"highlight sql\"><figcaption data-lang=\"SQL\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token keyword\">SELECT</span> </pre></td></tr><tr><td data-num=\"2\"></td><td><pre>\tprovince_code<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>\tany_value<span class=\"token punctuation\">(</span>province_name<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token keyword\">FROM</span> t_mip_base_area</pre></td></tr><tr><td data-num=\"5\"></td><td><pre><span class=\"token keyword\">GROUP</span> <span class=\"token keyword\">BY</span> province_code</pre></td></tr></table></figure><h6 id=\"若这样写\"><a class=\"anchor\" href=\"#若这样写\">#</a> 若这样写</h6>\n<figure class=\"highlight sql\"><figcaption data-lang=\"SQL\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token keyword\">SELECT</span> </pre></td></tr><tr><td data-num=\"2\"></td><td><pre>    province_code<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>    province_name</pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token keyword\">FROM</span> t_mip_base_area</pre></td></tr><tr><td data-num=\"5\"></td><td><pre><span class=\"token keyword\">GROUP</span> <span class=\"token keyword\">BY</span> province_code</pre></td></tr></table></figure><p>则会报错<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/05/25/c57a8e811928.png\" alt=\"\" /></p>\n<h4 id=\"总结\"><a class=\"anchor\" href=\"#总结\">#</a> 总结：</h4>\n<ol>\n<li>\n<p>MySQL5.7 之后，sql_mode 中 ONLY_FULL_GROUP_BY 模式默认设置为打开状态。</p>\n</li>\n<li>\n<p>ONLY_FULL_GROUP_BY 的语义就是确定 select target list 中的所有列的值都是明确语义，简单的说来，在此模式下，target list 中的值要么是来自于聚合函数（sum、avg、max 等）的结果，要么是来自于 group by list 中的表达式的值</p>\n</li>\n<li>\n<p>MySQL 提供了 any_value () 函数来抑制 ONLY_FULL_GROUP_BY 值被拒绝</p>\n</li>\n<li>\n<p>any_value () 会选择被分到同一组的数据里第一条数据的指定列值作为返回数据</p>\n</li>\n</ol>\n",
            "tags": [
                "工作",
                "解决问题",
                "mysql"
            ]
        },
        {
            "id": "https://hitoli.com/2023/04/16/%E5%91%BD%E4%BB%A4%E5%A4%A7%E6%9D%82%E7%83%A9/",
            "url": "https://hitoli.com/2023/04/16/%E5%91%BD%E4%BB%A4%E5%A4%A7%E6%9D%82%E7%83%A9/",
            "title": "命令大杂烩",
            "date_published": "2023-04-16T05:32:00.000Z",
            "content_html": "<h4 id=\"日常命令记录\"><a class=\"anchor\" href=\"#日常命令记录\">#</a> 日常命令记录</h4>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token comment\">#windows 系统修复</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>DISM.exe /Online /Cleanup-image /Scanhealth</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>DISM.exe /Online /Cleanup-image /Restorehealth     </pre></td></tr><tr><td data-num=\"4\"></td><td><pre>sfc /scannow</pre></td></tr><tr><td data-num=\"5\"></td><td><pre></pre></td></tr><tr><td data-num=\"6\"></td><td><pre><span class=\"token comment\">#windows 网络修复</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>netsh winsock reset</pre></td></tr><tr><td data-num=\"8\"></td><td><pre></pre></td></tr><tr><td data-num=\"9\"></td><td><pre><span class=\"token comment\">#合并 ts 文件</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>copy /b c:<span class=\"token punctuation\">\\</span>Users<span class=\"token punctuation\">\\</span>hito<span class=\"token punctuation\">\\</span>Downloads<span class=\"token punctuation\">\\</span>*.ts d:<span class=\"token punctuation\">\\</span><span class=\"token number\">50</span>.mp4</pre></td></tr><tr><td data-num=\"11\"></td><td><pre></pre></td></tr><tr><td data-num=\"12\"></td><td><pre><span class=\"token comment\">#windows11 家庭版安装 Hyper-V（以下命令拷贝到 txt 文本后重命名为 bat 文件然后用管理员权限运行）</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre><span class=\"token function\">pushd</span> <span class=\"token string\">\"%~dp0\"</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre><span class=\"token function\">dir</span> /b %SystemRoot%<span class=\"token punctuation\">\\</span>servicing<span class=\"token punctuation\">\\</span>Packages<span class=\"token punctuation\">\\</span>*Hyper-V*.mum <span class=\"token operator\">>></span> hyper-v.txt</pre></td></tr><tr><td data-num=\"15\"></td><td><pre><span class=\"token keyword\">for</span> /f %%i <span class=\"token keyword\">in</span> <span class=\"token punctuation\">(</span><span class=\"token string\">'findstr /i . hyper-v.txt 2^>nul'</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">do</span> dism /online /norestart /add-package:<span class=\"token string\">\"%SystemRoot%\\servicing\\Packages\\%%i\"</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>del hyper-v.txt</pre></td></tr><tr><td data-num=\"17\"></td><td><pre>Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL</pre></td></tr><tr><td data-num=\"18\"></td><td><pre></pre></td></tr><tr><td data-num=\"19\"></td><td><pre><span class=\"token comment\">#mysql 查看索引使用情况</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>EXPLAIN SELECT A.XXX, B.XXX FROM TABLE1 A, TABLE2 B ON A.XXX <span class=\"token operator\">=</span> B.XXX<span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre></pre></td></tr><tr><td data-num=\"22\"></td><td><pre><span class=\"token comment\">#mysql 使用触发器插入数据自动生产 uuid 主键</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>insert_before  BEFORE  插入</pre></td></tr><tr><td data-num=\"24\"></td><td><pre>BEGIN</pre></td></tr><tr><td data-num=\"25\"></td><td><pre>\t\t\tSET NEW.ID <span class=\"token operator\">=</span> REPLACE<span class=\"token punctuation\">(</span>UUID<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>,<span class=\"token string\">\"-\"</span>,<span class=\"token string\">\"\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>END</pre></td></tr><tr><td data-num=\"27\"></td><td><pre></pre></td></tr><tr><td data-num=\"28\"></td><td><pre><span class=\"token comment\">#excel</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre><span class=\"token comment\">#合并</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre><span class=\"token operator\">=</span>CONCATENATE<span class=\"token punctuation\">(</span><span class=\"token string\">\"EX010\"</span>,D2,C2,<span class=\"token string\">\"1\"</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre><span class=\"token comment\">#截断</span></pre></td></tr><tr><td data-num=\"32\"></td><td><pre><span class=\"token operator\">=</span>LEFT<span class=\"token punctuation\">(</span>E2,6<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"33\"></td><td><pre><span class=\"token comment\">#判断取值</span></pre></td></tr><tr><td data-num=\"34\"></td><td><pre><span class=\"token operator\">=</span>IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"宜都市\"</span>,<span class=\"token string\">\"420500000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"高新区\"</span>,<span class=\"token string\">\"420592000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"枝江市\"</span>,<span class=\"token string\">\"420583000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"当阳市\"</span>,<span class=\"token string\">\"420582000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"远安县\"</span>,<span class=\"token string\">\"420525000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"兴山县\"</span>,<span class=\"token string\">\"420526000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"秭归县\"</span>,<span class=\"token string\">\"420527000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"长阳\"</span>,<span class=\"token string\">\"420528000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"五峰县\"</span>,<span class=\"token string\">\"420529000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"夷陵区\"</span>,<span class=\"token string\">\"420506000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"点军区\"</span>,<span class=\"token string\">\"420504000000000\"</span>,IF<span class=\"token punctuation\">(</span>O2<span class=\"token operator\">=</span><span class=\"token string\">\"西陵区\"</span>,<span class=\"token string\">\"420502000000000\"</span>,IF<span class=\"token punctuation\">(</span>OR<span class=\"token punctuation\">(</span>ISNUMBER<span class=\"token punctuation\">(</span>FIND<span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span><span class=\"token string\">\"伍家\"</span><span class=\"token punctuation\">;</span><span class=\"token string\">\"伍家区\"</span><span class=\"token punctuation\">;</span><span class=\"token string\">\"伍家岗区\"</span><span class=\"token punctuation\">&#125;</span>,O2<span class=\"token punctuation\">))</span><span class=\"token punctuation\">)</span>,<span class=\"token string\">\"420503000000000\"</span>,IF<span class=\"token punctuation\">(</span>OR<span class=\"token punctuation\">(</span>ISNUMBER<span class=\"token punctuation\">(</span>FIND<span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span><span class=\"token string\">\"猇亭\"</span><span class=\"token punctuation\">;</span><span class=\"token string\">\"猇亭区\"</span><span class=\"token punctuation\">&#125;</span>,O2<span class=\"token punctuation\">))</span><span class=\"token punctuation\">)</span>,<span class=\"token string\">\"420505000000000\"</span><span class=\"token punctuation\">))</span><span class=\"token punctuation\">))</span><span class=\"token punctuation\">))</span><span class=\"token punctuation\">))</span><span class=\"token punctuation\">))</span><span class=\"token punctuation\">))</span><span class=\"token punctuation\">))</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre><span class=\"token comment\">#经纬度计算</span></pre></td></tr><tr><td data-num=\"36\"></td><td><pre><span class=\"token operator\">=</span>LEFT<span class=\"token punctuation\">(</span>T2,FIND<span class=\"token punctuation\">(</span><span class=\"token string\">\"°\"</span>,T2<span class=\"token punctuation\">)</span>-1<span class=\"token punctuation\">)</span>+MID<span class=\"token punctuation\">(</span>T2,FIND<span class=\"token punctuation\">(</span><span class=\"token string\">\"°\"</span>,T2<span class=\"token punctuation\">)</span>+1,FIND<span class=\"token punctuation\">(</span><span class=\"token string\">\"′\"</span>,T2<span class=\"token punctuation\">)</span>-FIND<span class=\"token punctuation\">(</span><span class=\"token string\">\"°\"</span>,T2<span class=\"token punctuation\">)</span>-1<span class=\"token punctuation\">)</span>/60+MID<span class=\"token punctuation\">(</span>T2,FIND<span class=\"token punctuation\">(</span><span class=\"token string\">\"′\"</span>,T2<span class=\"token punctuation\">)</span>+1,FIND<span class=\"token punctuation\">(</span><span class=\"token string\">\"″\"</span>,T2<span class=\"token punctuation\">)</span>-FIND<span class=\"token punctuation\">(</span><span class=\"token string\">\"′\"</span>,T2<span class=\"token punctuation\">)</span>-1<span class=\"token punctuation\">)</span>/3600</pre></td></tr></table></figure>",
            "tags": [
                "生活",
                "技术分享",
                "命令"
            ]
        },
        {
            "id": "https://hitoli.com/2023/04/16/K8S%E9%A1%B9%E7%9B%AE%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2%E6%AD%A5%E9%AA%A4/",
            "url": "https://hitoli.com/2023/04/16/K8S%E9%A1%B9%E7%9B%AE%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2%E6%AD%A5%E9%AA%A4/",
            "title": "K8S项目本地部署步骤",
            "date_published": "2023-04-16T04:39:00.000Z",
            "content_html": "<h4 id=\"本地部署步骤\"><a class=\"anchor\" href=\"#本地部署步骤\">#</a> 本地部署步骤</h4>\n<ol>\n<li>本机安装 wsl_update_x64.msi  （已安装可忽略）</li>\n<li>本机安装 Docker Desktop Installer.exe  （已安装可忽略）</li>\n<li>安装成功后，打开设置<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/ab557bae79bf.png\" alt=\"\" /></li>\n<li>选择 Docker Engine，粘贴进如下配置后重启</li>\n</ol>\n<figure class=\"highlight json\"><figcaption data-lang=\"JSON\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>  <span class=\"token property\">\"builder\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>    <span class=\"token property\">\"gc\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>      <span class=\"token property\">\"defaultKeepStorage\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"20GB\"</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>      <span class=\"token property\">\"enabled\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>  <span class=\"token property\">\"experimental\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>  <span class=\"token property\">\"features\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>    <span class=\"token property\">\"buildkit\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>  <span class=\"token property\">\"insecure-registries\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>    <span class=\"token string\">\"http://192.168.86.117\"</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>  <span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/93533dd8e043.png\" alt=\"\" /><br />\n5. 本项目 clean、compile、package<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/c14b2405a234.jpg\" alt=\"\" /><br />\n6. 添加一个 DockerFile 的启动配置<br />\n 192.168.86.117/zhsl/ys-zhslsgcgl:0.0.1<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/66f152c95d6e.png\" alt=\"\" /><br />\n7. 保证代码是最新的之后，运行上步的配置，会把刚才 install 生成的 jar 包上传到本机 Docker 生成一个本机 docker 镜像<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/4b915691271f.png\" alt=\"\" /><br />\n 8. 命令行登录本地的 KUBESPHERE，把本机 docker 镜像上传到 KUBESPHERE</p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">docker</span> login <span class=\"token number\">192.168</span>.86.117</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/d1acb4e8e336.png\" alt=\"\" /></p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">docker</span> images命令也可以看到本机docker镜像</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/2b22d19f4649.png\" alt=\"\" /></p>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>把本机docker镜像上传到KUBESPHERE</pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token function\">docker</span> push <span class=\"token number\">192.168</span>.86.117/zhsl/ys-zhslsgcgl:0.0.1</pre></td></tr></table></figure><p><img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/f1d792024e54.png\" alt=\"\" /><br />\n9. 网页登录本地的 KUBESPHERE。<br />\n<span class=\"exturl\" data-url=\"aHR0cDovLzE5Mi4xNjguODYuMTE3OjMwODgwLyVFRiVCQyU4QyVFOCVCRiU5QiVFNSU4NSVBNSVFMiU4MCU5QyVFNSVCNyVBNSVFNCVCRCU5QyVFOCVCNCU5RiVFOCVCRCVCRCVFMiU4MCU5RCVFNiU4OSVCRSVFNSU4OCVCMCVFNSU4OCU5QSVFNCVCOCU4QSVFNCVCQyVBMERvY2tlciVFNiU5QyU4RCVFNSU4QSVBMSVFOSU5NSU5QyVFNSU4MyU4RiVFRiVCQyU4QyVFNSVCOSVCNiVFNSU5MCVBRiVFNSU4QSVBOCVFMyU4MCU4Mg==\">http://192.168.86.117:30880/，进入 “工作负载” 找到刚上传 Docker 服务镜像，并启动。</span><br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/fcd7e6459555.png\" alt=\"\" /></p>\n<h4 id=\"通过导出镜像部署\"><a class=\"anchor\" href=\"#通过导出镜像部署\">#</a> 通过导出镜像部署</h4>\n<ol>\n<li>docker images 查看要导出的镜像 id<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/1edd4bacf81c.png\" alt=\"\" /></li>\n<li>docker save 58310865054f &gt; szy.tar 导出到用户目录下 C:\\Users\\hito</li>\n<li>docker load -i szy.tar 载入镜像<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/04/16/32154204eff2.png\" alt=\"\" /></li>\n<li>docker tag 58310865054f harbor.zhsl.local:30881/zhsl/ys-zhslszy:0.0.1 标记镜像</li>\n<li>docker push harbor.zhsl.local:30881/zhsl/ys-zhslszy:0.0.1 上传镜像</li>\n</ol>\n",
            "tags": [
                "工作",
                "项目部署",
                "项目部署",
                "K8S"
            ]
        },
        {
            "id": "https://hitoli.com/2023/04/16/%E7%83%BD%E7%81%AB10G-ONU%E5%A4%A9%E7%BF%BC%E7%BD%91%E5%85%B34-0%E7%A0%B4%E8%A7%A3%EF%BC%88HG5143F/",
            "url": "https://hitoli.com/2023/04/16/%E7%83%BD%E7%81%AB10G-ONU%E5%A4%A9%E7%BF%BC%E7%BD%91%E5%85%B34-0%E7%A0%B4%E8%A7%A3%EF%BC%88HG5143F/",
            "title": "烽火10G-ONU天翼网关4.0破解（HG5143F)",
            "date_published": "2023-04-16T03:03:00.000Z",
            "content_html": "<h4 id=\"开启telent\"><a class=\"anchor\" href=\"#开启telent\">#</a> 开启 telent</h4>\n<p>注意：54XXXXXXXXC8 为光猫背后 ONU MAC：54-XX-XX-XX-XX-C8</p>\n<ol>\n<li>打开 http://192.168.X.X:8080 (网关地址)  使用密码登陆</li>\n<li>执行 http://192.168.X.X:8080/cgi-bin/telnetenable.cgi?key=54XXXXXXXXC8&amp;telnetenable=1</li>\n<li>用 telent 命令登陆<br />\n用户名：telecom 密码：nE7jA%5m</li>\n<li>获取 telnet 用户名密码</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>获取telnet的用户名</pre></td></tr><tr><td data-num=\"2\"></td><td><pre>cfg_cmd get InternetGatewayDevice.DeviceInfo.X_CT-COM_ServiceManage.TelnetUserName</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>获取telnet的密码</pre></td></tr><tr><td data-num=\"4\"></td><td><pre>cfg_cmd get InternetGatewayDevice.DeviceInfo.X_CT-COM_ServiceManage.TelnetPassword</pre></td></tr></table></figure><ol start=\"5\">\n<li>转为 root 用户</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token function\">su</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>密码：Fh@XXXXXX<span class=\"token punctuation\">(</span>X为mac地址的后6位<span class=\"token punctuation\">)</span></pre></td></tr></table></figure><ol start=\"6\">\n<li>获取 web 超级密码</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd get InternetGatewayDevice.DeviceInfo.X_CT-COM_TeleComAccount.Password <span class=\"token operator\">|</span> <span class=\"token function\">grep</span> <span class=\"token string\">'get success'</span> <span class=\"token operator\">|</span> <span class=\"token function\">cut</span> <span class=\"token parameter variable\">-d</span> <span class=\"token operator\">=</span> <span class=\"token parameter variable\">-f</span> <span class=\"token number\">2</span></pre></td></tr></table></figure><p>7、访问 http://192.168.1.1:8080/html/logoffaccount.html 把隐藏用户打开，其它选项改为可修改</p>\n<p>两种命令模式：</p>\n<h4 id=\"工厂模式\"><a class=\"anchor\" href=\"#工厂模式\">#</a> 工厂模式</h4>\n<ol>\n<li>进入工厂模式</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>load_cli factory</pre></td></tr></table></figure><ol start=\"2\">\n<li>显示管理员密码</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>show admin_pwd</pre></td></tr></table></figure><ol start=\"3\">\n<li>显示所有命令</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>?</pre></td></tr></table></figure><ol start=\"4\">\n<li>显示所有 show 命令</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>show ?</pre></td></tr></table></figure><ol start=\"5\">\n<li>显示所有 set 命令</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token builtin class-name\">set</span> ?</pre></td></tr></table></figure><ol start=\"6\">\n<li>显示所有信息</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>show allinfo</pre></td></tr></table></figure><h4 id=\"cfg_cmd命令模式\"><a class=\"anchor\" href=\"#cfg_cmd命令模式\">#</a> cfg_cmd 命令模式</h4>\n<ol>\n<li>开启 TELNET</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.DeviceInfo.X_CT-COM_ServiceManage.TelnetEnable <span class=\"token number\">1</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.DeviceInfo.X_CT-COM_ServiceManage.TelnetUserName 用户名</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.DeviceInfo.X_CT-COM_ServiceManage.TelnetPassword 密码</pre></td></tr></table></figure><ol start=\"2\">\n<li>打开 FTP 功能</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.DeviceInfo.X_CT-COM_ServiceManage.FtpEnable <span class=\"token number\">1</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.DeviceInfo.X_CT-COM_ServiceManage.FtpUserName 用户名</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.DeviceInfo.X_CT-COM_ServiceManage.FtpPassword 密码</pre></td></tr></table></figure><ol start=\"3\">\n<li>获取 LOID</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd get InternetGatewayDevice.X_CT-COM_UserInfo.UserName <span class=\"token operator\">|</span><span class=\"token function\">grep</span> <span class=\"token string\">'value'</span> <span class=\"token operator\">|</span><span class=\"token function\">cut</span> <span class=\"token parameter variable\">-d</span> <span class=\"token string\">'='</span> <span class=\"token parameter variable\">-f</span> <span class=\"token number\">2</span></pre></td></tr></table></figure><ol start=\"4\">\n<li>TR069</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd get InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_WANEponLinkConfig.Enable</pre></td></tr><tr><td data-num=\"2\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_WANEponLinkConfig.Enable <span class=\"token number\">0</span> <span class=\"token comment\">#0 禁用，1 启用</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>cfg_cmd get InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_WANEponLinkConfig.VLANIDMark</pre></td></tr><tr><td data-num=\"4\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_WANEponLinkConfig.VLANIDMark <span class=\"token number\">99</span> <span class=\"token comment\">#默认 46</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>cfg_cmd get InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_WANEponLinkConfig.Mode</pre></td></tr><tr><td data-num=\"6\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_WANEponLinkConfig.Mode <span class=\"token number\">2</span> <span class=\"token comment\">#默认 2</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>cfg_cmd get InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_AccessControl.Enabled</pre></td></tr><tr><td data-num=\"8\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_AccessControl.Enabled <span class=\"token number\">0</span> <span class=\"token comment\">#0 禁用，1 启用</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>cfg_cmd get InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.Enable</pre></td></tr><tr><td data-num=\"10\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.Enable <span class=\"token number\">0</span> <span class=\"token comment\">#0 禁用，1 启用</span></pre></td></tr></table></figure><ol start=\"5\">\n<li>关闭 TR069 中间件</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.DeviceInfo.X_CT-COM_MiddlewareMgt.Tr069Enable <span class=\"token number\">0</span></pre></td></tr></table></figure><ol start=\"6\">\n<li>删除 1_TR069_R_VID_46</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_CT-COM_WANEponLinkConfig.IP_Routed<span class=\"token operator\">=</span><span class=\"token string\">''</span></pre></td></tr></table></figure><ol start=\"7\">\n<li>查看设备目前的连接数</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd get InternetGatewayDevice.Services.X_CT-COM_MWBAND.TotalTerminalNumber</pre></td></tr></table></figure><ol start=\"8\">\n<li>设置设备连接数</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">set</span> InternetGatewayDevice.Services.X_CT-COM_MWBAND.TotalTerminalNumber <span class=\"token number\">255</span></pre></td></tr></table></figure><ol start=\"9\">\n<li>用户信息</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd get InternetGatewayDevice.X_CT-COM_UserInfo.UserName</pre></td></tr></table></figure><ol start=\"10\">\n<li>获取 cfg_cmd 帮助</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd <span class=\"token builtin class-name\">help</span></pre></td></tr></table></figure><ol start=\"11\">\n<li>获取指定节点后的节点</li>\n</ol>\n<figure class=\"highlight bash\"><figcaption data-lang=\"bash\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>cfg_cmd shownode InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1. <span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token operator\">|</span><span class=\"token number\">1</span><span class=\"token punctuation\">]</span> </pre></td></tr><tr><td data-num=\"2\"></td><td><pre>（如cfg_cmd shownode InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1. <span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span>）</pre></td></tr></table></figure>",
            "tags": [
                "生活",
                "技术分享",
                "烽火",
                "天翼网关",
                "破解",
                "HG5143F"
            ]
        },
        {
            "id": "https://hitoli.com/2023/02/18/%E4%BF%AE%E6%94%B9IntellIJ-IDE%E8%83%8C%E6%99%AF%E8%89%B2%E5%92%8C%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F/",
            "url": "https://hitoli.com/2023/02/18/%E4%BF%AE%E6%94%B9IntellIJ-IDE%E8%83%8C%E6%99%AF%E8%89%B2%E5%92%8C%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F/",
            "title": "修改IntellIJ IDE背景色和字体大小",
            "date_published": "2023-02-18T09:42:00.000Z",
            "content_html": "<h4 id=\"引言\"><a class=\"anchor\" href=\"#引言\">#</a> 引言</h4>\n<p>网上搜索了几个修改 IDE 背景色和字体大小的方法，记录一下方便以后查看。</p>\n<h4 id=\"操作截图\"><a class=\"anchor\" href=\"#操作截图\">#</a> 操作截图</h4>\n<ol>\n<li>\n<p>修改代码区颜色<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/02/18/bb050e7e4c3b3ff2968b0a1be311d31f.png\" alt=\"bb050e7e4c3b3ff2968b0a1be311d31f.png\" /></p>\n</li>\n<li>\n<p>修改代码区字体大小<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/02/18/af92e69249a74978f56a5b2f8bf792a8.png\" alt=\"af92e69249a74978f56a5b2f8bf792a8.png\" /></p>\n</li>\n<li>\n<p>修改控制台背景色<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/02/18/80dd5d82bfc6d0380ce34a590d8beeb4.png\" alt=\"80dd5d82bfc6d0380ce34a590d8beeb4.png\" /></p>\n</li>\n<li>\n<p>修改控制台字体大小<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/02/18/86bd97d1937b77faa27d31db7c2abb91.png\" alt=\"86bd97d1937b77faa27d31db7c2abb91.png\" /></p>\n</li>\n<li>\n<p>修改左侧背景色<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/02/18/4875f8006144733c0e6710a2b04bc2be.jpg\" alt=\"4875f8006144733c0e6710a2b04bc2be.jpg\" /></p>\n</li>\n<li>\n<p>修改 UI 字体大小<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/03/02/UI.png\" alt=\"UI.png\" /></p>\n</li>\n</ol>\n",
            "tags": [
                "工作",
                "IDE",
                "IDE",
                "intellIJ"
            ]
        },
        {
            "id": "https://hitoli.com/2023/01/31/KLineChart%E7%94%BB%E6%B3%A2%E6%AE%B5%E9%AB%98%E4%BD%8E%E4%BB%B7%E5%9B%BE/",
            "url": "https://hitoli.com/2023/01/31/KLineChart%E7%94%BB%E6%B3%A2%E6%AE%B5%E9%AB%98%E4%BD%8E%E4%BB%B7%E5%9B%BE/",
            "title": "KLineChart画波段高低价图",
            "date_published": "2023-01-31T01:44:00.000Z",
            "content_html": "<h4 id=\"引言\"><a class=\"anchor\" href=\"#引言\">#</a> 引言</h4>\n<p>使用指定数据方式得到的线条总是不能达到想要的效果，一是阶梯线在价格发生变化的点存在倾斜，二是高低价的线很难完美显示，所以只能自己动手画了。代码仅供参考，如有错误的地方请指正！<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/01/31/ee3c75b472c5869794e205747703d888.png\" alt=\"ee3c75b472c5869794e205747703d888.png\" /></p>\n<h4 id=\"模版代码\"><a class=\"anchor\" href=\"#模版代码\">#</a> 模版代码</h4>\n<figure class=\"highlight js\"><figcaption data-lang=\"JavaScript\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>chart<span class=\"token punctuation\">.</span><span class=\"token function\">addTechnicalIndicatorTemplate</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>\t<span class=\"token literal-property property\">name</span><span class=\"token operator\">:</span> <span class=\"token string\">'BandHighLowInd'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>    <span class=\"token literal-property property\">shortName</span><span class=\"token operator\">:</span> <span class=\"token string\">'波段高低价'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>    <span class=\"token literal-property property\">calcParams</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">&#123;</span> <span class=\"token literal-property property\">value</span><span class=\"token operator\">:</span> <span class=\"token number\">10</span> <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>    <span class=\"token literal-property property\">precision</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>    <span class=\"token literal-property property\">plots</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>      <span class=\"token punctuation\">&#123;</span> <span class=\"token literal-property property\">key</span><span class=\"token operator\">:</span> <span class=\"token string\">'high'</span><span class=\"token punctuation\">,</span> <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'高: '</span><span class=\"token punctuation\">,</span> <span class=\"token function-variable function\">color</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">data<span class=\"token punctuation\">,</span> options</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span> <span class=\"token keyword\">return</span> options<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span> <span class=\"token punctuation\">&#125;</span> <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>      <span class=\"token punctuation\">&#123;</span> <span class=\"token literal-property property\">key</span><span class=\"token operator\">:</span> <span class=\"token string\">'low'</span><span class=\"token punctuation\">,</span> <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'低: '</span><span class=\"token punctuation\">,</span> <span class=\"token function-variable function\">color</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">data<span class=\"token punctuation\">,</span> options</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span> <span class=\"token keyword\">return</span> options<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">1</span><span class=\"token punctuation\">]</span> <span class=\"token punctuation\">&#125;</span> <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>      <span class=\"token punctuation\">&#123;</span> <span class=\"token literal-property property\">key</span><span class=\"token operator\">:</span> <span class=\"token string\">'highLow'</span><span class=\"token punctuation\">,</span> <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'高低: '</span><span class=\"token punctuation\">,</span> <span class=\"token function-variable function\">color</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">data<span class=\"token punctuation\">,</span> options</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span> <span class=\"token keyword\">return</span> options<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">2</span><span class=\"token punctuation\">]</span> <span class=\"token punctuation\">&#125;</span> <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>    <span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>    <span class=\"token function-variable function\">calcTechnicalIndicator</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">dataList<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">&#123;</span> params <span class=\"token punctuation\">&#125;</span></span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>      <span class=\"token keyword\">let</span> compareKlineSize <span class=\"token operator\">=</span> params<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span> <span class=\"token comment\">// 取前后 k 的范围</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>      <span class=\"token keyword\">let</span> highs <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>      <span class=\"token keyword\">let</span> lows <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>      <span class=\"token keyword\">let</span> highLows <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>      <span class=\"token keyword\">let</span> findHigh <span class=\"token comment\">// 高低价当前查找标识</span></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>      dataList<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">kLineData<span class=\"token punctuation\">,</span> i</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>        <span class=\"token keyword\">let</span> frontIndex <span class=\"token operator\">=</span> i <span class=\"token operator\">-</span> compareKlineSize</pre></td></tr><tr><td data-num=\"19\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>frontIndex <span class=\"token operator\">&lt;=</span> <span class=\"token number\">0</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>          frontIndex <span class=\"token operator\">=</span> <span class=\"token number\">0</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>        <span class=\"token keyword\">let</span> frontDatas <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>frontIndex <span class=\"token operator\">&lt;</span> i<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>          frontDatas <span class=\"token operator\">=</span> dataList<span class=\"token punctuation\">.</span><span class=\"token function\">slice</span><span class=\"token punctuation\">(</span>frontIndex<span class=\"token punctuation\">,</span> i<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>        <span class=\"token keyword\">let</span> afterIndex <span class=\"token operator\">=</span> i <span class=\"token operator\">+</span> compareKlineSize <span class=\"token operator\">+</span> <span class=\"token number\">1</span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre>        <span class=\"token keyword\">let</span> afterDatas <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"28\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">&lt;</span> dataList<span class=\"token punctuation\">.</span>length <span class=\"token operator\">-</span> <span class=\"token number\">1</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre>          afterDatas <span class=\"token operator\">=</span> dataList<span class=\"token punctuation\">.</span><span class=\"token function\">slice</span><span class=\"token punctuation\">(</span>i <span class=\"token operator\">+</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span> afterIndex<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>frontDatas<span class=\"token punctuation\">.</span>length <span class=\"token operator\">===</span> compareKlineSize <span class=\"token operator\">&amp;&amp;</span> afterDatas<span class=\"token punctuation\">.</span>length <span class=\"token operator\">===</span> compareKlineSize<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 前后 K 线数据必须都找到要比较的条数</span></pre></td></tr><tr><td data-num=\"32\"></td><td><pre>          <span class=\"token keyword\">let</span> high <span class=\"token operator\">=</span> <span class=\"token keyword\">null</span></pre></td></tr><tr><td data-num=\"33\"></td><td><pre>          <span class=\"token keyword\">let</span> low <span class=\"token operator\">=</span> <span class=\"token keyword\">null</span></pre></td></tr><tr><td data-num=\"34\"></td><td><pre>          frontDatas<span class=\"token punctuation\">.</span><span class=\"token function\">concat</span><span class=\"token punctuation\">(</span>afterDatas<span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">kLineData<span class=\"token punctuation\">,</span> i</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 找出前后 k 线中的最高和最低价</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre>            <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>high <span class=\"token operator\">===</span> <span class=\"token keyword\">null</span> <span class=\"token operator\">||</span> kLineData<span class=\"token punctuation\">.</span>high <span class=\"token operator\">></span> high<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"36\"></td><td><pre>              high <span class=\"token operator\">=</span> kLineData<span class=\"token punctuation\">.</span>high</pre></td></tr><tr><td data-num=\"37\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"38\"></td><td><pre>            <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>low <span class=\"token operator\">===</span> <span class=\"token keyword\">null</span> <span class=\"token operator\">||</span> kLineData<span class=\"token punctuation\">.</span>low <span class=\"token operator\">&lt;</span> low<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"39\"></td><td><pre>              low <span class=\"token operator\">=</span> kLineData<span class=\"token punctuation\">.</span>low</pre></td></tr><tr><td data-num=\"40\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"41\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"42\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>kLineData<span class=\"token punctuation\">.</span>high <span class=\"token operator\">></span> high<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 当前 k 的高大于前后 k 中找出的高，则放入高价集合中</span></pre></td></tr><tr><td data-num=\"43\"></td><td><pre>            highs<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"44\"></td><td><pre>              <span class=\"token literal-property property\">time</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"45\"></td><td><pre>              <span class=\"token literal-property property\">value</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>high<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"46\"></td><td><pre>              <span class=\"token literal-property property\">index</span><span class=\"token operator\">:</span> i</pre></td></tr><tr><td data-num=\"47\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"48\"></td><td><pre>            <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>findHigh<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"49\"></td><td><pre>              <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>findHigh <span class=\"token operator\">&amp;&amp;</span> highLows<span class=\"token punctuation\">[</span>highLows<span class=\"token punctuation\">.</span>length <span class=\"token operator\">-</span> <span class=\"token number\">1</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">.</span>value <span class=\"token operator\">!==</span> kLineData<span class=\"token punctuation\">.</span>high<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"50\"></td><td><pre>                highLows<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"51\"></td><td><pre>                  <span class=\"token literal-property property\">time</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"52\"></td><td><pre>                  <span class=\"token literal-property property\">value</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>high<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"53\"></td><td><pre>                  <span class=\"token literal-property property\">index</span><span class=\"token operator\">:</span> i</pre></td></tr><tr><td data-num=\"54\"></td><td><pre>                <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"55\"></td><td><pre>                findHigh <span class=\"token operator\">=</span> <span class=\"token boolean\">false</span></pre></td></tr><tr><td data-num=\"56\"></td><td><pre>              <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"57\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"58\"></td><td><pre>              highLows<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"59\"></td><td><pre>                <span class=\"token literal-property property\">time</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"60\"></td><td><pre>                <span class=\"token literal-property property\">value</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>high<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"61\"></td><td><pre>                <span class=\"token literal-property property\">index</span><span class=\"token operator\">:</span> i</pre></td></tr><tr><td data-num=\"62\"></td><td><pre>              <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"63\"></td><td><pre>              findHigh <span class=\"token operator\">=</span> <span class=\"token boolean\">false</span></pre></td></tr><tr><td data-num=\"64\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"65\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"66\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>kLineData<span class=\"token punctuation\">.</span>low <span class=\"token operator\">&lt;</span> low<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 当前 k 的低小于前后 k 中找出的低，则放入低价集合中</span></pre></td></tr><tr><td data-num=\"67\"></td><td><pre>            lows<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"68\"></td><td><pre>              <span class=\"token literal-property property\">time</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"69\"></td><td><pre>              <span class=\"token literal-property property\">value</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>low<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"70\"></td><td><pre>              <span class=\"token literal-property property\">index</span><span class=\"token operator\">:</span> i</pre></td></tr><tr><td data-num=\"71\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"72\"></td><td><pre>            <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>findHigh<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"73\"></td><td><pre>              <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token operator\">!</span>findHigh <span class=\"token operator\">&amp;&amp;</span> highLows<span class=\"token punctuation\">[</span>highLows<span class=\"token punctuation\">.</span>length <span class=\"token operator\">-</span> <span class=\"token number\">1</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">.</span>value <span class=\"token operator\">!==</span> kLineData<span class=\"token punctuation\">.</span>low<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"74\"></td><td><pre>                highLows<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"75\"></td><td><pre>                  <span class=\"token literal-property property\">time</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"76\"></td><td><pre>                  <span class=\"token literal-property property\">value</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>low<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"77\"></td><td><pre>                  <span class=\"token literal-property property\">index</span><span class=\"token operator\">:</span> i</pre></td></tr><tr><td data-num=\"78\"></td><td><pre>                <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"79\"></td><td><pre>                findHigh <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"80\"></td><td><pre>              <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"81\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"82\"></td><td><pre>              highLows<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"83\"></td><td><pre>                <span class=\"token literal-property property\">time</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"84\"></td><td><pre>                <span class=\"token literal-property property\">value</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>low<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"85\"></td><td><pre>                <span class=\"token literal-property property\">index</span><span class=\"token operator\">:</span> i</pre></td></tr><tr><td data-num=\"86\"></td><td><pre>              <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"87\"></td><td><pre>              findHigh <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"88\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"89\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"90\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"91\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"92\"></td><td><pre>      <span class=\"token keyword\">let</span> high<span class=\"token punctuation\">,</span> low<span class=\"token punctuation\">,</span> highLow</pre></td></tr><tr><td data-num=\"93\"></td><td><pre>      <span class=\"token keyword\">return</span> dataList<span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">kLineData<span class=\"token punctuation\">,</span> i</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"94\"></td><td><pre>        <span class=\"token keyword\">let</span> item <span class=\"token operator\">=</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"95\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"96\"></td><td><pre>        highs<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">data</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"97\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>kLineData<span class=\"token punctuation\">.</span>timestamp <span class=\"token operator\">===</span> data<span class=\"token punctuation\">.</span>time<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"98\"></td><td><pre>            high <span class=\"token operator\">=</span> data<span class=\"token punctuation\">.</span>value</pre></td></tr><tr><td data-num=\"99\"></td><td><pre>            item<span class=\"token punctuation\">.</span>highOrigin <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"100\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"101\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"102\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>high<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 持续先前的高，画出阶梯线</span></pre></td></tr><tr><td data-num=\"103\"></td><td><pre>          item<span class=\"token punctuation\">.</span>timestamp <span class=\"token operator\">=</span> kLineData<span class=\"token punctuation\">.</span>timestamp</pre></td></tr><tr><td data-num=\"104\"></td><td><pre>          item<span class=\"token punctuation\">.</span>high <span class=\"token operator\">=</span> high</pre></td></tr><tr><td data-num=\"105\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"106\"></td><td><pre>        lows<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">data</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"107\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>kLineData<span class=\"token punctuation\">.</span>timestamp <span class=\"token operator\">===</span> data<span class=\"token punctuation\">.</span>time<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"108\"></td><td><pre>            low <span class=\"token operator\">=</span> data<span class=\"token punctuation\">.</span>value</pre></td></tr><tr><td data-num=\"109\"></td><td><pre>            item<span class=\"token punctuation\">.</span>lowOrigin <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"110\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"111\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"112\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>low<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 持续先前的低，画出阶梯线</span></pre></td></tr><tr><td data-num=\"113\"></td><td><pre>          item<span class=\"token punctuation\">.</span>timestamp <span class=\"token operator\">=</span> kLineData<span class=\"token punctuation\">.</span>timestamp</pre></td></tr><tr><td data-num=\"114\"></td><td><pre>          item<span class=\"token punctuation\">.</span>low <span class=\"token operator\">=</span> low</pre></td></tr><tr><td data-num=\"115\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"116\"></td><td><pre>        highLows<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">data</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"117\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>kLineData<span class=\"token punctuation\">.</span>timestamp <span class=\"token operator\">===</span> data<span class=\"token punctuation\">.</span>time<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"118\"></td><td><pre>            highLow <span class=\"token operator\">=</span> data<span class=\"token punctuation\">.</span>value</pre></td></tr><tr><td data-num=\"119\"></td><td><pre>            item<span class=\"token punctuation\">.</span>highLowOrigin <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"120\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"121\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"122\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>highLow<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 持续先前的高低，方便 title 显示</span></pre></td></tr><tr><td data-num=\"123\"></td><td><pre>          item<span class=\"token punctuation\">.</span>timestamp <span class=\"token operator\">=</span> kLineData<span class=\"token punctuation\">.</span>timestamp</pre></td></tr><tr><td data-num=\"124\"></td><td><pre>          item<span class=\"token punctuation\">.</span>highLow <span class=\"token operator\">=</span> highLow</pre></td></tr><tr><td data-num=\"125\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"126\"></td><td><pre>        <span class=\"token keyword\">return</span> item</pre></td></tr><tr><td data-num=\"127\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"128\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"129\"></td><td><pre>    <span class=\"token function-variable function\">render</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\"><span class=\"token punctuation\">&#123;</span> ctx<span class=\"token punctuation\">,</span> dataSource<span class=\"token punctuation\">,</span> viewport<span class=\"token punctuation\">,</span> styles<span class=\"token punctuation\">,</span> xAxis<span class=\"token punctuation\">,</span> yAxis <span class=\"token punctuation\">&#125;</span></span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"130\"></td><td><pre>      <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>dataSource<span class=\"token punctuation\">.</span>technicalIndicatorDataList<span class=\"token punctuation\">.</span>length <span class=\"token operator\">&lt;=</span> <span class=\"token number\">0</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"131\"></td><td><pre>        <span class=\"token keyword\">return</span></pre></td></tr><tr><td data-num=\"132\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"133\"></td><td><pre>      <span class=\"token keyword\">let</span> x <span class=\"token operator\">=</span> xAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span><span class=\"token number\">0</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"134\"></td><td><pre>      <span class=\"token keyword\">let</span> high<span class=\"token punctuation\">,</span> low<span class=\"token punctuation\">,</span> highLow<span class=\"token punctuation\">,</span> highLowX</pre></td></tr><tr><td data-num=\"135\"></td><td><pre>      dataSource<span class=\"token punctuation\">.</span>technicalIndicatorDataList<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">data<span class=\"token punctuation\">,</span> i</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"136\"></td><td><pre>        <span class=\"token comment\">// 画高线</span></pre></td></tr><tr><td data-num=\"137\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span>textBaseline <span class=\"token operator\">=</span> <span class=\"token string\">'middle'</span></pre></td></tr><tr><td data-num=\"138\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span>textAlign <span class=\"token operator\">=</span> <span class=\"token string\">'center'</span></pre></td></tr><tr><td data-num=\"139\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"140\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span>strokeStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"141\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>styles<span class=\"token punctuation\">.</span>line <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"142\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"143\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>strokeStyle <span class=\"token operator\">=</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"144\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"145\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>high<span class=\"token punctuation\">)</span> <span class=\"token operator\">&amp;&amp;</span> data<span class=\"token punctuation\">.</span>high <span class=\"token operator\">!==</span> high<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"146\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">beginPath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"147\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>high<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"148\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>high<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"149\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">stroke</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"150\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">closePath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"151\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"152\"></td><td><pre>        high <span class=\"token operator\">=</span> data<span class=\"token punctuation\">.</span>high</pre></td></tr><tr><td data-num=\"153\"></td><td><pre>        <span class=\"token keyword\">let</span> y <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>high<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"154\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">beginPath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"155\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> y<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"156\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> y<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"157\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">stroke</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"158\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">closePath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"159\"></td><td><pre>        <span class=\"token comment\">// 画低线</span></pre></td></tr><tr><td data-num=\"160\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"161\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span>strokeStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"162\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>styles<span class=\"token punctuation\">.</span>line <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">1</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"163\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">1</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"164\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>strokeStyle <span class=\"token operator\">=</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">1</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"165\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"166\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>low<span class=\"token punctuation\">)</span> <span class=\"token operator\">&amp;&amp;</span> data<span class=\"token punctuation\">.</span>low <span class=\"token operator\">!==</span> low<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"167\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">beginPath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"168\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>low<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"169\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>low<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"170\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">stroke</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"171\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">closePath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"172\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"173\"></td><td><pre>        low <span class=\"token operator\">=</span> data<span class=\"token punctuation\">.</span>low</pre></td></tr><tr><td data-num=\"174\"></td><td><pre>        y <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>low<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"175\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">beginPath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"176\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> y<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"177\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> y<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"178\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">stroke</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"179\"></td><td><pre>        ctx<span class=\"token punctuation\">.</span><span class=\"token function\">closePath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"180\"></td><td><pre>        <span class=\"token comment\">// 画高低线</span></pre></td></tr><tr><td data-num=\"181\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>highLow<span class=\"token punctuation\">)</span> <span class=\"token operator\">&amp;&amp;</span> data<span class=\"token punctuation\">.</span>highLowOrigin <span class=\"token operator\">===</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"182\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>highLow<span class=\"token punctuation\">)</span> <span class=\"token operator\">&amp;&amp;</span> <span class=\"token function\">isNotEmpty</span><span class=\"token punctuation\">(</span>highLowX<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"183\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"184\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span>strokeStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"185\"></td><td><pre>            <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>styles<span class=\"token punctuation\">.</span>line <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">2</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"186\"></td><td><pre>              ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">2</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"187\"></td><td><pre>              ctx<span class=\"token punctuation\">.</span>strokeStyle <span class=\"token operator\">=</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">2</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"188\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"189\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">beginPath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"190\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>highLowX<span class=\"token punctuation\">,</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>highLow<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"191\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>highLow<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"192\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">stroke</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"193\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">closePath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"194\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"195\"></td><td><pre>          highLow <span class=\"token operator\">=</span> data<span class=\"token punctuation\">.</span>highLow</pre></td></tr><tr><td data-num=\"196\"></td><td><pre>          highLowX <span class=\"token operator\">=</span> x</pre></td></tr><tr><td data-num=\"197\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"198\"></td><td><pre>        <span class=\"token comment\">// 画价格</span></pre></td></tr><tr><td data-num=\"199\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>high <span class=\"token operator\">!==</span> <span class=\"token keyword\">undefined</span> <span class=\"token operator\">&amp;&amp;</span> data<span class=\"token punctuation\">.</span>highOrigin <span class=\"token operator\">===</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 画高价</span></pre></td></tr><tr><td data-num=\"200\"></td><td><pre>          <span class=\"token keyword\">let</span> text <span class=\"token operator\">=</span> Number<span class=\"token punctuation\">.</span><span class=\"token function\">parseFloat</span><span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>high<span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">toFixed</span><span class=\"token punctuation\">(</span><span class=\"token number\">2</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"201\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"202\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>styles<span class=\"token punctuation\">.</span>line <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"203\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"204\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"205\"></td><td><pre>          <span class=\"token keyword\">let</span> offset <span class=\"token operator\">=</span> <span class=\"token number\">10</span></pre></td></tr><tr><td data-num=\"206\"></td><td><pre>          <span class=\"token keyword\">let</span> y <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>high<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"207\"></td><td><pre>          <span class=\"token keyword\">for</span> <span class=\"token punctuation\">(</span><span class=\"token keyword\">let</span> i <span class=\"token operator\">=</span> <span class=\"token number\">2</span><span class=\"token punctuation\">;</span> i <span class=\"token operator\">&lt;</span> offset <span class=\"token operator\">-</span> <span class=\"token number\">1</span><span class=\"token punctuation\">;</span> i <span class=\"token operator\">+=</span> <span class=\"token number\">2</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"208\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span><span class=\"token string\">'.'</span><span class=\"token punctuation\">,</span> x<span class=\"token punctuation\">,</span> y <span class=\"token operator\">-</span> i<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"209\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"210\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>text<span class=\"token punctuation\">,</span> x<span class=\"token punctuation\">,</span> y <span class=\"token operator\">-</span> offset<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"211\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"212\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>low <span class=\"token operator\">!==</span> <span class=\"token keyword\">undefined</span> <span class=\"token operator\">&amp;&amp;</span> data<span class=\"token punctuation\">.</span>lowOrigin <span class=\"token operator\">===</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 画低价</span></pre></td></tr><tr><td data-num=\"213\"></td><td><pre>          <span class=\"token keyword\">let</span> text <span class=\"token operator\">=</span> Number<span class=\"token punctuation\">.</span><span class=\"token function\">parseFloat</span><span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>low<span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">toFixed</span><span class=\"token punctuation\">(</span><span class=\"token number\">2</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"214\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"215\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>styles<span class=\"token punctuation\">.</span>line <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors <span class=\"token operator\">&amp;&amp;</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">1</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"216\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> styles<span class=\"token punctuation\">.</span>line<span class=\"token punctuation\">.</span>colors<span class=\"token punctuation\">[</span><span class=\"token number\">1</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"217\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"218\"></td><td><pre>          <span class=\"token keyword\">let</span> offset <span class=\"token operator\">=</span> <span class=\"token number\">15</span></pre></td></tr><tr><td data-num=\"219\"></td><td><pre>          <span class=\"token keyword\">let</span> y <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>low<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"220\"></td><td><pre>          <span class=\"token keyword\">for</span> <span class=\"token punctuation\">(</span><span class=\"token keyword\">let</span> i <span class=\"token operator\">=</span> <span class=\"token number\">2</span><span class=\"token punctuation\">;</span> i <span class=\"token operator\">&lt;</span> offset <span class=\"token operator\">-</span> <span class=\"token number\">5</span><span class=\"token punctuation\">;</span> i <span class=\"token operator\">+=</span> <span class=\"token number\">2</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"221\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span><span class=\"token string\">'.'</span><span class=\"token punctuation\">,</span> x<span class=\"token punctuation\">,</span> y <span class=\"token operator\">+</span> i<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"222\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"223\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>text<span class=\"token punctuation\">,</span> x<span class=\"token punctuation\">,</span> y <span class=\"token operator\">+</span> offset<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"224\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"225\"></td><td><pre>        x <span class=\"token operator\">+=</span> viewport<span class=\"token punctuation\">.</span>dataSpace</pre></td></tr><tr><td data-num=\"226\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"227\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"228\"></td><td><pre><span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr></table></figure>",
            "tags": [
                "工作",
                "KLineChart",
                "KLineChart",
                "K线",
                "自定义指标"
            ]
        },
        {
            "id": "https://hitoli.com/2023/01/10/Vue%E6%A0%B9%E6%8D%AE%E8%B7%AF%E7%94%B1%E4%BC%A0%E5%8F%82%E4%BF%AE%E6%94%B9%E9%A1%B5%E9%9D%A2%E6%95%B0%E6%8D%AE/",
            "url": "https://hitoli.com/2023/01/10/Vue%E6%A0%B9%E6%8D%AE%E8%B7%AF%E7%94%B1%E4%BC%A0%E5%8F%82%E4%BF%AE%E6%94%B9%E9%A1%B5%E9%9D%A2%E6%95%B0%E6%8D%AE/",
            "title": "Vue根据路由传参修改页面数据",
            "date_published": "2023-01-10T02:19:00.000Z",
            "content_html": "<h4 id=\"引言\"><a class=\"anchor\" href=\"#引言\">#</a> 引言</h4>\n<p>在开发前端页面时会存在相同的页面展示，只是菜单名称不同、数据类型不同的情况。如果再拷贝一个页面来展示后期就需要维护两个页面，同时也增加了工作量。但是只使用一个页面通过传参来改变数据就方便多了。</p>\n<h4 id=\"路由配置\"><a class=\"anchor\" href=\"#路由配置\">#</a> 路由配置</h4>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>    <span class=\"token key atrule\">path</span><span class=\"token punctuation\">:</span> <span class=\"token string\">'/test/:type/:menuIndex'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>    <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> <span class=\"token string\">'Test'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>    <span class=\"token key atrule\">component</span><span class=\"token punctuation\">:</span> _import('xxx/Test.vue')</pre></td></tr><tr><td data-num=\"5\"></td><td><pre> <span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><h4 id=\"菜单配置\"><a class=\"anchor\" href=\"#菜单配置\">#</a> 菜单配置</h4>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>&lt;template<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>    &lt;el<span class=\"token punctuation\">-</span>menu</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>      class=\"aside<span class=\"token punctuation\">-</span>menu\"</pre></td></tr><tr><td data-num=\"4\"></td><td><pre>      <span class=\"token punctuation\">:</span>default<span class=\"token punctuation\">-</span>active=\"menuIndex.toString()\"</pre></td></tr><tr><td data-num=\"5\"></td><td><pre>      @select=\"handleSelect\"</pre></td></tr><tr><td data-num=\"6\"></td><td><pre>    <span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>      &lt;el<span class=\"token punctuation\">-</span>menu<span class=\"token punctuation\">-</span>item</pre></td></tr><tr><td data-num=\"8\"></td><td><pre>        index=\"1\"</pre></td></tr><tr><td data-num=\"9\"></td><td><pre>        class=\"aside<span class=\"token punctuation\">-</span>menu<span class=\"token punctuation\">-</span>item\"</pre></td></tr><tr><td data-num=\"10\"></td><td><pre>      <span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>        &lt;template <span class=\"token comment\">#title></span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>          &lt;span<span class=\"token punctuation\">></span>TEST1&lt;/span<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>          &lt;el<span class=\"token punctuation\">-</span>icon <span class=\"token punctuation\">:</span>size=\"20\"<span class=\"token punctuation\">></span>&lt;TrendCharts /<span class=\"token punctuation\">></span>&lt;/el<span class=\"token punctuation\">-</span>icon<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>        &lt;/template<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>      &lt;/el<span class=\"token punctuation\">-</span>menu<span class=\"token punctuation\">-</span>item<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>      &lt;el<span class=\"token punctuation\">-</span>menu<span class=\"token punctuation\">-</span>item</pre></td></tr><tr><td data-num=\"17\"></td><td><pre>        index=\"2\"</pre></td></tr><tr><td data-num=\"18\"></td><td><pre>        class=\"aside<span class=\"token punctuation\">-</span>menu<span class=\"token punctuation\">-</span>item\"</pre></td></tr><tr><td data-num=\"19\"></td><td><pre>      <span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>        &lt;template <span class=\"token comment\">#title></span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>          &lt;span<span class=\"token punctuation\">></span>TEST2&lt;/span<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>          &lt;el<span class=\"token punctuation\">-</span>icon <span class=\"token punctuation\">:</span>size=\"20\"<span class=\"token punctuation\">></span>&lt;Orange /<span class=\"token punctuation\">></span>&lt;/el<span class=\"token punctuation\">-</span>icon<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>        &lt;/template<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>      &lt;/el<span class=\"token punctuation\">-</span>menu<span class=\"token punctuation\">-</span>item<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre>    &lt;/el<span class=\"token punctuation\">-</span>menu<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>&lt;/template<span class=\"token punctuation\">></span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre></pre></td></tr><tr><td data-num=\"28\"></td><td><pre><span class=\"token key atrule\">methods</span><span class=\"token punctuation\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre>    handleSelect (val) <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre>      if (val === '1') <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre>        this.$router.push(<span class=\"token punctuation\">&#123;</span> <span class=\"token key atrule\">path</span><span class=\"token punctuation\">:</span> '/test/type1/' + val <span class=\"token punctuation\">&#125;</span>)</pre></td></tr><tr><td data-num=\"32\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span> else if (val === '2') <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"33\"></td><td><pre>        this.$router.push(<span class=\"token punctuation\">&#123;</span> <span class=\"token key atrule\">path</span><span class=\"token punctuation\">:</span> '/test/type2/' + val <span class=\"token punctuation\">&#125;</span>)</pre></td></tr><tr><td data-num=\"34\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"36\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><h4 id=\"页面\"><a class=\"anchor\" href=\"#页面\">#</a> 页面</h4>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>created () <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre>    this.$watch(</pre></td></tr><tr><td data-num=\"3\"></td><td><pre>      () =<span class=\"token punctuation\">></span> this.$route.params<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre>      (toParams<span class=\"token punctuation\">,</span> previousParams) =<span class=\"token punctuation\">></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>        if (isNotEmpty(toParams.menuIndex)) <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>          this.menuIndex = toParams.menuIndex</pre></td></tr><tr><td data-num=\"7\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>        if (isNotEmpty(toParams.type)) <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>          this.type = toParams.type</pre></td></tr><tr><td data-num=\"10\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>        // 根据type查询数据</pre></td></tr><tr><td data-num=\"12\"></td><td><pre>        <span class=\"token punctuation\">...</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>    )</pre></td></tr><tr><td data-num=\"15\"></td><td><pre>    if (isNotEmpty(this.$route.params.menuIndex)) <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>      this.menuIndex = this.$route.params.menuIndex</pre></td></tr><tr><td data-num=\"17\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>    if (isNotEmpty(this.$route.params.type)) <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>      this.type = this.$route.params.type</pre></td></tr><tr><td data-num=\"20\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre><span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>mounted () <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>\t// 根据type查询数据</pre></td></tr><tr><td data-num=\"24\"></td><td><pre>\t<span class=\"token punctuation\">...</span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure>",
            "tags": [
                "工作",
                "Vue",
                "Vue"
            ]
        },
        {
            "id": "https://hitoli.com/2023/01/10/Highcharts%E7%94%BB%E6%94%B6%E7%9B%8A%E6%A6%82%E8%A7%88/",
            "url": "https://hitoli.com/2023/01/10/Highcharts%E7%94%BB%E6%94%B6%E7%9B%8A%E6%A6%82%E8%A7%88/",
            "title": "Highcharts画收益概览",
            "date_published": "2023-01-10T01:51:00.000Z",
            "content_html": "<h4 id=\"引言\"><a class=\"anchor\" href=\"#引言\">#</a> 引言</h4>\n<p>项目中需要画一幅收益概览图，研究了一下 Highcharts 的用法。特此收录方便以后再次使用时查阅。<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2023/01/10/1ef80bfe8b5ee82aec0e2549e8c68e2c.png\" alt=\"1ef80bfe8b5ee82aec0e2549e8c68e2c.png\" /></p>\n<h4 id=\"代码\"><a class=\"anchor\" href=\"#代码\">#</a> 代码</h4>\n<figure class=\"highlight js\"><figcaption data-lang=\"JavaScript\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token comment\">//x 轴时间集合</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token keyword\">var</span> chartXAxisDateTimes <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token string\">'2022-01-01 00:00:00'</span><span class=\"token punctuation\">,</span> <span class=\"token string\">'2022-02-01 00:00:00'</span><span class=\"token punctuation\">,</span> <span class=\"token string\">'2022-03-01 00:00:00'</span><span class=\"token punctuation\">,</span> <span class=\"token string\">'2022-04-01 00:00:00'</span><span class=\"token punctuation\">,</span> <span class=\"token string\">'2022-05-01 00:00:00'</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre></pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token comment\">//y 轴数据集合</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre><span class=\"token keyword\">var</span> chartYAxisDatas <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre>          <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>            <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'累计收益'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre>            <span class=\"token literal-property property\">name</span><span class=\"token operator\">:</span> <span class=\"token string\">'我的策略累计收益'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>            <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> <span class=\"token string\">'spline'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>            <span class=\"token literal-property property\">unit</span><span class=\"token operator\">:</span> <span class=\"token string\">'%'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>            <span class=\"token literal-property property\">valueDecimals</span><span class=\"token operator\">:</span> <span class=\"token number\">3</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>            <span class=\"token literal-property property\">height</span><span class=\"token operator\">:</span> <span class=\"token string\">'28%'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>            <span class=\"token literal-property property\">yAxisIndex</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">//y 轴分区 index（从上到下，默认从 0 开始）</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>            <span class=\"token literal-property property\">data</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-01-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-02-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-03-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">3</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"28\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-04-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">4</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"32\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"33\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"34\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-05-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"36\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">5</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"37\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"38\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"39\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"40\"></td><td><pre>          <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"41\"></td><td><pre>            <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'每月盈亏'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"42\"></td><td><pre>            <span class=\"token literal-property property\">name</span><span class=\"token operator\">:</span> <span class=\"token string\">'当月盈利'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"43\"></td><td><pre>            <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> <span class=\"token string\">'column'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"44\"></td><td><pre>            <span class=\"token literal-property property\">unit</span><span class=\"token operator\">:</span> <span class=\"token string\">'k'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"45\"></td><td><pre>            <span class=\"token literal-property property\">valueDecimals</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"46\"></td><td><pre>            <span class=\"token literal-property property\">top</span><span class=\"token operator\">:</span> <span class=\"token string\">'34%'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"47\"></td><td><pre>            <span class=\"token literal-property property\">height</span><span class=\"token operator\">:</span> <span class=\"token string\">'28%'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"48\"></td><td><pre>            <span class=\"token literal-property property\">yAxisIndex</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">//y 轴分区 index（从上到下，默认从 0 开始）</span></pre></td></tr><tr><td data-num=\"49\"></td><td><pre>            <span class=\"token function-variable function\">formatter</span><span class=\"token operator\">:</span> <span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"50\"></td><td><pre>              <span class=\"token keyword\">return</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>value <span class=\"token operator\">&lt;</span> <span class=\"token number\">0</span> <span class=\"token operator\">?</span> <span class=\"token punctuation\">(</span><span class=\"token operator\">-</span><span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>value<span class=\"token punctuation\">)</span> <span class=\"token operator\">+</span> <span class=\"token string\">'k'</span> <span class=\"token operator\">:</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>value <span class=\"token operator\">+</span> <span class=\"token string\">'k'</span></pre></td></tr><tr><td data-num=\"51\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"52\"></td><td><pre>            <span class=\"token literal-property property\">data</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"53\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-01-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"54\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"55\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"56\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"57\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"58\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-02-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"59\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"60\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"61\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"62\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"63\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-03-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"64\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">3</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"65\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"66\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"67\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"68\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-04-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"69\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">4</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"70\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"71\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"72\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"73\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-05-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"74\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">5</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"75\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">''</span></pre></td></tr><tr><td data-num=\"76\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"77\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"78\"></td><td><pre>          <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"79\"></td><td><pre>            <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'成交记录'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"80\"></td><td><pre>            <span class=\"token literal-property property\">name</span><span class=\"token operator\">:</span> <span class=\"token string\">'当月买入'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"81\"></td><td><pre>            <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> <span class=\"token string\">'column'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"82\"></td><td><pre>            <span class=\"token literal-property property\">unit</span><span class=\"token operator\">:</span> <span class=\"token string\">'k'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"83\"></td><td><pre>            <span class=\"token literal-property property\">valueDecimals</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"84\"></td><td><pre>            <span class=\"token literal-property property\">top</span><span class=\"token operator\">:</span> <span class=\"token string\">'68%'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"85\"></td><td><pre>            <span class=\"token literal-property property\">height</span><span class=\"token operator\">:</span> <span class=\"token string\">'28%'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"86\"></td><td><pre>            <span class=\"token literal-property property\">yAxisIndex</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">//y 轴分区 index（从上到下，默认从 0 开始）</span></pre></td></tr><tr><td data-num=\"87\"></td><td><pre>            <span class=\"token literal-property property\">data</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"88\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-01-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"89\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"90\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'red'</span></pre></td></tr><tr><td data-num=\"91\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"92\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"93\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-02-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"94\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"95\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'red'</span></pre></td></tr><tr><td data-num=\"96\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"97\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"98\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-03-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"99\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">3</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"100\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'red'</span></pre></td></tr><tr><td data-num=\"101\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"102\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"103\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-04-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"104\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">4</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"105\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'red'</span></pre></td></tr><tr><td data-num=\"106\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"107\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"108\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-05-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"109\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">5</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"110\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'red'</span></pre></td></tr><tr><td data-num=\"111\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"112\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"113\"></td><td><pre>          <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"114\"></td><td><pre>            <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'成交记录'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"115\"></td><td><pre>            <span class=\"token literal-property property\">name</span><span class=\"token operator\">:</span> <span class=\"token string\">'当月卖出'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"116\"></td><td><pre>            <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> <span class=\"token string\">'column'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"117\"></td><td><pre>            <span class=\"token literal-property property\">unit</span><span class=\"token operator\">:</span> <span class=\"token string\">'k'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"118\"></td><td><pre>            <span class=\"token literal-property property\">valueDecimals</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"119\"></td><td><pre>            <span class=\"token literal-property property\">top</span><span class=\"token operator\">:</span> <span class=\"token string\">'68%'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"120\"></td><td><pre>            <span class=\"token literal-property property\">height</span><span class=\"token operator\">:</span> <span class=\"token string\">'28%'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"121\"></td><td><pre>            <span class=\"token literal-property property\">yAxisIndex</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">//y 轴分区 index（从上到下，默认从 0 开始）</span></pre></td></tr><tr><td data-num=\"122\"></td><td><pre>            <span class=\"token literal-property property\">data</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"123\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-01-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"124\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"125\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'green'</span></pre></td></tr><tr><td data-num=\"126\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"127\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"128\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-02-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"129\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"130\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'green'</span></pre></td></tr><tr><td data-num=\"131\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"132\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"133\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-03-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"134\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">3</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"135\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'green'</span></pre></td></tr><tr><td data-num=\"136\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"137\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"138\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-04-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"139\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">4</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"140\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'green'</span></pre></td></tr><tr><td data-num=\"141\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"142\"></td><td><pre>            <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"143\"></td><td><pre>              <span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-05-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"144\"></td><td><pre>              <span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">5</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"145\"></td><td><pre>              <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'green'</span></pre></td></tr><tr><td data-num=\"146\"></td><td><pre>            <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"147\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"148\"></td><td><pre>        <span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"149\"></td><td><pre>\t\t</pre></td></tr><tr><td data-num=\"150\"></td><td><pre><span class=\"token comment\">// 最大回测范围</span></pre></td></tr><tr><td data-num=\"151\"></td><td><pre><span class=\"token keyword\">var</span> plotBandScope <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-02-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token string\">'2022-04-01 00:00:00'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"152\"></td><td><pre></pre></td></tr><tr><td data-num=\"153\"></td><td><pre><span class=\"token comment\">// 图表配置</span></pre></td></tr><tr><td data-num=\"154\"></td><td><pre><span class=\"token keyword\">var</span> option <span class=\"token operator\">=</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"155\"></td><td><pre>\t<span class=\"token literal-property property\">chart</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"156\"></td><td><pre>\t  <span class=\"token literal-property property\">height</span><span class=\"token operator\">:</span> <span class=\"token number\">600</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"157\"></td><td><pre>\t  <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> <span class=\"token string\">'spline'</span> <span class=\"token comment\">// 指定图表的类型，默认是折线图（line)</span></pre></td></tr><tr><td data-num=\"158\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"159\"></td><td><pre>\t<span class=\"token literal-property property\">plotOptions</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"160\"></td><td><pre>\t  <span class=\"token literal-property property\">spline</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"161\"></td><td><pre>\t\t<span class=\"token literal-property property\">borderWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"162\"></td><td><pre>\t\t<span class=\"token literal-property property\">lineWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"163\"></td><td><pre>\t\t<span class=\"token literal-property property\">states</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"164\"></td><td><pre>\t\t  <span class=\"token literal-property property\">hover</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"165\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">lineWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span></pre></td></tr><tr><td data-num=\"166\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"167\"></td><td><pre>\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"168\"></td><td><pre>\t\t<span class=\"token comment\">//pointWidth: 4, // 柱子内宽度容</span></pre></td></tr><tr><td data-num=\"169\"></td><td><pre>\t\t<span class=\"token literal-property property\">dataLabels</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"170\"></td><td><pre>\t\t  <span class=\"token literal-property property\">style</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"171\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">fontSize</span><span class=\"token operator\">:</span> <span class=\"token number\">11</span></pre></td></tr><tr><td data-num=\"172\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"173\"></td><td><pre>\t\t  <span class=\"token literal-property property\">enabled</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span></pre></td></tr><tr><td data-num=\"174\"></td><td><pre>\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"175\"></td><td><pre>\t\t<span class=\"token literal-property property\">showInLegend</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"176\"></td><td><pre>\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"177\"></td><td><pre>\t  <span class=\"token literal-property property\">column</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"178\"></td><td><pre>\t\t<span class=\"token literal-property property\">borderWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"179\"></td><td><pre>\t\t<span class=\"token literal-property property\">pointWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">4</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// 柱子内宽度容</span></pre></td></tr><tr><td data-num=\"180\"></td><td><pre>\t\t<span class=\"token literal-property property\">dataLabels</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"181\"></td><td><pre>\t\t  <span class=\"token literal-property property\">style</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"182\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">fontSize</span><span class=\"token operator\">:</span> <span class=\"token number\">11</span></pre></td></tr><tr><td data-num=\"183\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"184\"></td><td><pre>\t\t  <span class=\"token literal-property property\">enabled</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span></pre></td></tr><tr><td data-num=\"185\"></td><td><pre>\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"186\"></td><td><pre>\t\t<span class=\"token literal-property property\">showInLegend</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"187\"></td><td><pre>\t\t<span class=\"token literal-property property\">grouping</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span></pre></td></tr><tr><td data-num=\"188\"></td><td><pre>\t  <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"189\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"190\"></td><td><pre>\t<span class=\"token literal-property property\">rangeSelector</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"191\"></td><td><pre>\t  <span class=\"token literal-property property\">enabled</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span></pre></td></tr><tr><td data-num=\"192\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"193\"></td><td><pre>\t<span class=\"token literal-property property\">credits</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"194\"></td><td><pre>\t  <span class=\"token literal-property property\">enabled</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span></pre></td></tr><tr><td data-num=\"195\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"196\"></td><td><pre>\t<span class=\"token comment\">// legend: &#123;</span></pre></td></tr><tr><td data-num=\"197\"></td><td><pre>\t<span class=\"token comment\">//   enabled: true,</span></pre></td></tr><tr><td data-num=\"198\"></td><td><pre>\t<span class=\"token comment\">//   verticalAlign: 'top'</span></pre></td></tr><tr><td data-num=\"199\"></td><td><pre>\t<span class=\"token comment\">// &#125;,</span></pre></td></tr><tr><td data-num=\"200\"></td><td><pre>\t<span class=\"token literal-property property\">navigator</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 导航器样式</span></pre></td></tr><tr><td data-num=\"201\"></td><td><pre>\t  <span class=\"token literal-property property\">enabled</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"202\"></td><td><pre>\t  <span class=\"token literal-property property\">height</span><span class=\"token operator\">:</span> <span class=\"token number\">20</span></pre></td></tr><tr><td data-num=\"203\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"204\"></td><td><pre>\t<span class=\"token literal-property property\">scrollbar</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 滚动条样式</span></pre></td></tr><tr><td data-num=\"205\"></td><td><pre>\t  <span class=\"token literal-property property\">barBackgroundColor</span><span class=\"token operator\">:</span> <span class=\"token string\">'rgb(209, 218, 237)'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"206\"></td><td><pre>\t  <span class=\"token literal-property property\">barBorderRadius</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"207\"></td><td><pre>\t  <span class=\"token literal-property property\">barBorderWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"208\"></td><td><pre>\t  <span class=\"token literal-property property\">buttonBackgroundColor</span><span class=\"token operator\">:</span> <span class=\"token string\">'rgb(242, 242, 242)'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"209\"></td><td><pre>\t  <span class=\"token literal-property property\">buttonBorderWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"210\"></td><td><pre>\t  <span class=\"token literal-property property\">buttonBorderRadius</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"211\"></td><td><pre>\t  <span class=\"token literal-property property\">trackBackgroundColor</span><span class=\"token operator\">:</span> <span class=\"token string\">'none'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"212\"></td><td><pre>\t  <span class=\"token literal-property property\">trackBorderWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"213\"></td><td><pre>\t  <span class=\"token literal-property property\">trackBorderRadius</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"214\"></td><td><pre>\t  <span class=\"token literal-property property\">trackBorderColor</span><span class=\"token operator\">:</span> <span class=\"token string\">'#CCC'</span></pre></td></tr><tr><td data-num=\"215\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"216\"></td><td><pre>\t<span class=\"token literal-property property\">xAxis</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"217\"></td><td><pre>\t  <span class=\"token literal-property property\">lineWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"218\"></td><td><pre>\t  <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> <span class=\"token string\">'datetime'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"219\"></td><td><pre>\t  <span class=\"token literal-property property\">categories</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"220\"></td><td><pre>\t  <span class=\"token literal-property property\">dateTimeLabelFormats</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"221\"></td><td><pre>\t\t<span class=\"token comment\">// millisecond: '%H:%M:%S.%L',</span></pre></td></tr><tr><td data-num=\"222\"></td><td><pre>\t\t<span class=\"token comment\">// second: '%H:%M:%S',</span></pre></td></tr><tr><td data-num=\"223\"></td><td><pre>\t\t<span class=\"token comment\">// minute: '%H:%M',</span></pre></td></tr><tr><td data-num=\"224\"></td><td><pre>\t\t<span class=\"token comment\">// hour: '%m-%d %H:%M',</span></pre></td></tr><tr><td data-num=\"225\"></td><td><pre>\t\t<span class=\"token literal-property property\">day</span><span class=\"token operator\">:</span> <span class=\"token string\">'%m-%d'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"226\"></td><td><pre>\t\t<span class=\"token literal-property property\">week</span><span class=\"token operator\">:</span> <span class=\"token string\">'%m-%d'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"227\"></td><td><pre>\t\t<span class=\"token literal-property property\">month</span><span class=\"token operator\">:</span> <span class=\"token string\">'%Y-%m'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"228\"></td><td><pre>\t\t<span class=\"token literal-property property\">year</span><span class=\"token operator\">:</span> <span class=\"token string\">'%Y'</span></pre></td></tr><tr><td data-num=\"229\"></td><td><pre>\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"230\"></td><td><pre>\t  <span class=\"token literal-property property\">gridLineWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">1</span></pre></td></tr><tr><td data-num=\"231\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"232\"></td><td><pre>\t<span class=\"token literal-property property\">yAxis</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"233\"></td><td><pre>\t<span class=\"token literal-property property\">tooltip</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"234\"></td><td><pre>\t  <span class=\"token literal-property property\">xDateFormat</span><span class=\"token operator\">:</span> <span class=\"token string\">'%Y-%m-%d %H:%M:%S'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"235\"></td><td><pre>\t  <span class=\"token literal-property property\">style</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"236\"></td><td><pre>\t\t<span class=\"token literal-property property\">fontSize</span><span class=\"token operator\">:</span> <span class=\"token number\">16</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"237\"></td><td><pre>\t\t<span class=\"token literal-property property\">fontFamily</span><span class=\"token operator\">:</span> <span class=\"token string\">'微软雅黑'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"238\"></td><td><pre>\t\t<span class=\"token literal-property property\">fontWeight</span><span class=\"token operator\">:</span> <span class=\"token string\">'normal'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"239\"></td><td><pre>\t\t<span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'#666'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"240\"></td><td><pre>\t\t<span class=\"token literal-property property\">padding</span><span class=\"token operator\">:</span> <span class=\"token number\">10</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"241\"></td><td><pre>\t\t<span class=\"token literal-property property\">borderWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"242\"></td><td><pre>\t\t<span class=\"token literal-property property\">backgroundColor</span><span class=\"token operator\">:</span> <span class=\"token string\">'#ddd'</span></pre></td></tr><tr><td data-num=\"243\"></td><td><pre>\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"244\"></td><td><pre>\t  <span class=\"token literal-property property\">shared</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"245\"></td><td><pre>\t  <span class=\"token literal-property property\">useHTML</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"246\"></td><td><pre>\t  <span class=\"token literal-property property\">headerFormat</span><span class=\"token operator\">:</span> <span class=\"token string\">'&lt;small style=\"font-size: 12px\">&#123;point.key&#125;&lt;/small>&lt;table>'</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// 标题格式，</span></pre></td></tr><tr><td data-num=\"247\"></td><td><pre>\t  <span class=\"token literal-property property\">pointFormat</span><span class=\"token operator\">:</span> <span class=\"token string\">'&lt;tr>&lt;td>&lt;li style=\"color:&#123;series.color&#125;;padding:0px\">&#123;series.name&#125;: &lt;/li>'</span> <span class=\"token operator\">+</span></pre></td></tr><tr><td data-num=\"248\"></td><td><pre>\t  <span class=\"token string\">'&lt;div style=\"float: right;\">&#123;point.y&#125; &#123;series.tooltip.valueDecimals&#125;&lt;/div>&lt;/td>&lt;/tr>'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"249\"></td><td><pre>\t  <span class=\"token literal-property property\">footerFormat</span><span class=\"token operator\">:</span> <span class=\"token string\">'&lt;/table>'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"250\"></td><td><pre>\t  <span class=\"token literal-property property\">shadow</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"251\"></td><td><pre>\t  <span class=\"token literal-property property\">followPointer</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span> <span class=\"token comment\">// 跟随鼠标</span></pre></td></tr><tr><td data-num=\"252\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"253\"></td><td><pre>\t<span class=\"token literal-property property\">series</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"254\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"255\"></td><td><pre></pre></td></tr><tr><td data-num=\"256\"></td><td><pre><span class=\"token comment\">// 根据最大回测范围修改图表配置</span></pre></td></tr><tr><td data-num=\"257\"></td><td><pre><span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>plotBandScope <span class=\"token operator\">&amp;&amp;</span> plotBandScope<span class=\"token punctuation\">.</span>length <span class=\"token operator\">===</span> <span class=\"token number\">2</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"258\"></td><td><pre>\toption<span class=\"token punctuation\">.</span>xAxis<span class=\"token punctuation\">.</span>plotBands <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"259\"></td><td><pre>\t  <span class=\"token literal-property property\">from</span><span class=\"token operator\">:</span> plotBandScope<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"260\"></td><td><pre>\t  <span class=\"token literal-property property\">to</span><span class=\"token operator\">:</span> plotBandScope<span class=\"token punctuation\">[</span><span class=\"token number\">1</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"261\"></td><td><pre>\t  <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'#FCFFC5'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"262\"></td><td><pre>\t  <span class=\"token literal-property property\">label</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"263\"></td><td><pre>\t\t<span class=\"token literal-property property\">text</span><span class=\"token operator\">:</span> <span class=\"token string\">'最大回测区间'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"264\"></td><td><pre>\t\t<span class=\"token literal-property property\">align</span><span class=\"token operator\">:</span> <span class=\"token string\">'center'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"265\"></td><td><pre>\t\t<span class=\"token literal-property property\">verticalAlign</span><span class=\"token operator\">:</span> <span class=\"token string\">'top'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"266\"></td><td><pre>\t\t<span class=\"token literal-property property\">y</span><span class=\"token operator\">:</span> <span class=\"token number\">14</span></pre></td></tr><tr><td data-num=\"267\"></td><td><pre>\t  <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"268\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"269\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"270\"></td><td><pre></pre></td></tr><tr><td data-num=\"271\"></td><td><pre><span class=\"token comment\">// 根据 x 轴时间集合修改图表配置</span></pre></td></tr><tr><td data-num=\"272\"></td><td><pre><span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>chartXAxisDateTimes <span class=\"token operator\">&amp;&amp;</span> chartXAxisDateTimes<span class=\"token punctuation\">.</span>length <span class=\"token operator\">></span> <span class=\"token number\">0</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"273\"></td><td><pre>\toption<span class=\"token punctuation\">.</span>categories <span class=\"token operator\">=</span> chartXAxisDateTimes</pre></td></tr><tr><td data-num=\"274\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"275\"></td><td><pre></pre></td></tr><tr><td data-num=\"276\"></td><td><pre><span class=\"token comment\">// 根据 y 轴数据集合修改图表配置</span></pre></td></tr><tr><td data-num=\"277\"></td><td><pre><span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>chartYAxisDatas <span class=\"token operator\">&amp;&amp;</span> chartYAxisDatas<span class=\"token punctuation\">.</span>length <span class=\"token operator\">></span> <span class=\"token number\">0</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"278\"></td><td><pre>\tchartYAxisDatas<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">item<span class=\"token punctuation\">,</span> i</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"279\"></td><td><pre>\t  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>item<span class=\"token punctuation\">.</span>type <span class=\"token operator\">===</span> <span class=\"token string\">'spline'</span> <span class=\"token operator\">||</span> item<span class=\"token punctuation\">.</span>type <span class=\"token operator\">===</span> <span class=\"token string\">'line'</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"280\"></td><td><pre>\t\toption<span class=\"token punctuation\">.</span>yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"281\"></td><td><pre>\t\t  <span class=\"token literal-property property\">plotLines</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"282\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'black'</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// 线的颜色，定义为红色</span></pre></td></tr><tr><td data-num=\"283\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">dashStyle</span><span class=\"token operator\">:</span> <span class=\"token string\">'solid'</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// 默认值，这里定义为实线</span></pre></td></tr><tr><td data-num=\"284\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">value</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// 定义在那个值上显示标示线，这里是在 x 轴上刻度为 3 的值处垂直化一条线</span></pre></td></tr><tr><td data-num=\"285\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">width</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span> <span class=\"token comment\">// 标示线的宽度，2px</span></pre></td></tr><tr><td data-num=\"286\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"287\"></td><td><pre>\t\t  <span class=\"token literal-property property\">tickAmount</span><span class=\"token operator\">:</span> <span class=\"token number\">4</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// 规定坐标轴上的刻度总数</span></pre></td></tr><tr><td data-num=\"288\"></td><td><pre>\t\t  <span class=\"token literal-property property\">gridLineColor</span><span class=\"token operator\">:</span> <span class=\"token string\">'#ddd'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"289\"></td><td><pre>\t\t  <span class=\"token literal-property property\">gridLineDashStyle</span><span class=\"token operator\">:</span> <span class=\"token string\">'Solid'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"290\"></td><td><pre>\t\t  <span class=\"token literal-property property\">labels</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 坐标轴上刻度的样式及单位</span></pre></td></tr><tr><td data-num=\"291\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">align</span><span class=\"token operator\">:</span> <span class=\"token string\">'right'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"292\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token number\">6</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"293\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">style</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"294\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'#999999'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"295\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">fontSize</span><span class=\"token operator\">:</span> <span class=\"token number\">12</span></pre></td></tr><tr><td data-num=\"296\"></td><td><pre>\t\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"297\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">format</span><span class=\"token operator\">:</span> <span class=\"token string\">'&#123;value&#125;'</span> <span class=\"token operator\">+</span> item<span class=\"token punctuation\">.</span>unit <span class=\"token comment\">// 坐标轴上的单位</span></pre></td></tr><tr><td data-num=\"298\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"299\"></td><td><pre>\t\t  <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"300\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">text</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>title<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"301\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">margin</span><span class=\"token operator\">:</span> <span class=\"token number\">20</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"302\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">style</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"303\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'#999999'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"304\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">fontSize</span><span class=\"token operator\">:</span> <span class=\"token number\">12</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"305\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">align</span><span class=\"token operator\">:</span> <span class=\"token string\">'middle'</span> <span class=\"token comment\">// 坐标轴对齐方式（相对于坐标轴的值） 默认是：middle 居中对齐</span></pre></td></tr><tr><td data-num=\"306\"></td><td><pre>\t\t\t<span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"307\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"308\"></td><td><pre>\t\t  <span class=\"token literal-property property\">height</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>height<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"309\"></td><td><pre>\t\t  <span class=\"token literal-property property\">lineWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span></pre></td></tr><tr><td data-num=\"310\"></td><td><pre>\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"311\"></td><td><pre>\t\toption<span class=\"token punctuation\">.</span>series<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"312\"></td><td><pre>\t\t  <span class=\"token literal-property property\">name</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>name<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"313\"></td><td><pre>\t\t  <span class=\"token literal-property property\">data</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>data<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"314\"></td><td><pre>\t\t  <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>type<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"315\"></td><td><pre>\t\t  <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'rgb(170, 70, 67)'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"316\"></td><td><pre>\t\t  <span class=\"token literal-property property\">tooltip</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"317\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">valueSuffix</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>unit<span class=\"token punctuation\">,</span> <span class=\"token comment\">// 数值后缀</span></pre></td></tr><tr><td data-num=\"318\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">valueDecimals</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>valueDecimals <span class=\"token comment\">//  提示框数据精度 (保留小数点后 3 位)</span></pre></td></tr><tr><td data-num=\"319\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"320\"></td><td><pre>\t\t  <span class=\"token literal-property property\">yAxis</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>yAxisIndex<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"321\"></td><td><pre>\t\t  <span class=\"token literal-property property\">showInNavigator</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span></pre></td></tr><tr><td data-num=\"322\"></td><td><pre>\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"323\"></td><td><pre>\t  <span class=\"token punctuation\">&#125;</span> <span class=\"token keyword\">else</span> <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>item<span class=\"token punctuation\">.</span>type <span class=\"token operator\">===</span> <span class=\"token string\">'column'</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"324\"></td><td><pre>\t\toption<span class=\"token punctuation\">.</span>yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"325\"></td><td><pre>\t\t  <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>type<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"326\"></td><td><pre>\t\t  <span class=\"token literal-property property\">tickAmount</span><span class=\"token operator\">:</span> <span class=\"token number\">4</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// 规定坐标轴上的刻度总数</span></pre></td></tr><tr><td data-num=\"327\"></td><td><pre>\t\t  <span class=\"token literal-property property\">startOnTick</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"328\"></td><td><pre>\t\t  <span class=\"token literal-property property\">reversed</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">//y 轴刻度反转</span></pre></td></tr><tr><td data-num=\"329\"></td><td><pre>\t\t  <span class=\"token literal-property property\">showFirstLabel</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"330\"></td><td><pre>\t\t  <span class=\"token literal-property property\">showLastLabel</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"331\"></td><td><pre>\t\t  <span class=\"token literal-property property\">gridLineColor</span><span class=\"token operator\">:</span> <span class=\"token string\">'#ddd'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"332\"></td><td><pre>\t\t  <span class=\"token literal-property property\">gridLineDashStyle</span><span class=\"token operator\">:</span> <span class=\"token string\">'Solid'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"333\"></td><td><pre>\t\t  <span class=\"token literal-property property\">labels</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"334\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">align</span><span class=\"token operator\">:</span> <span class=\"token string\">'right'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"335\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">x</span><span class=\"token operator\">:</span> <span class=\"token number\">12</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"336\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">style</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"337\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'#999999'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"338\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">fontSize</span><span class=\"token operator\">:</span> <span class=\"token number\">12</span></pre></td></tr><tr><td data-num=\"339\"></td><td><pre>\t\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"340\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">formatter</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>formatter<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"341\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">format</span><span class=\"token operator\">:</span> <span class=\"token string\">'&#123;value&#125;'</span> <span class=\"token operator\">+</span> item<span class=\"token punctuation\">.</span>unit <span class=\"token comment\">// 坐标轴上的单位</span></pre></td></tr><tr><td data-num=\"342\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"343\"></td><td><pre>\t\t  <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"344\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">text</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>title<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"345\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">margin</span><span class=\"token operator\">:</span> <span class=\"token number\">20</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"346\"></td><td><pre>\t\t\t<span class=\"token literal-property property\">style</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"347\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">color</span><span class=\"token operator\">:</span> <span class=\"token string\">'#999999'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"348\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">fontSize</span><span class=\"token operator\">:</span> <span class=\"token number\">12</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"349\"></td><td><pre>\t\t\t  <span class=\"token literal-property property\">align</span><span class=\"token operator\">:</span> <span class=\"token string\">'middle'</span> <span class=\"token comment\">// 坐标轴对齐方式（相对于坐标轴的值） 默认是：middle 居中对齐</span></pre></td></tr><tr><td data-num=\"350\"></td><td><pre>\t\t\t<span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"351\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"352\"></td><td><pre>\t\t  <span class=\"token literal-property property\">top</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>top<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"353\"></td><td><pre>\t\t  <span class=\"token literal-property property\">height</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>height<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"354\"></td><td><pre>\t\t  <span class=\"token literal-property property\">offset</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"355\"></td><td><pre>\t\t  <span class=\"token literal-property property\">lineWidth</span><span class=\"token operator\">:</span> <span class=\"token number\">0</span></pre></td></tr><tr><td data-num=\"356\"></td><td><pre>\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"357\"></td><td><pre>\t\toption<span class=\"token punctuation\">.</span>series<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"358\"></td><td><pre>\t\t  <span class=\"token literal-property property\">name</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>name<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"359\"></td><td><pre>\t\t  <span class=\"token literal-property property\">type</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>type<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"360\"></td><td><pre>\t\t  <span class=\"token literal-property property\">data</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>data<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"361\"></td><td><pre>\t\t  <span class=\"token literal-property property\">tooltip</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"362\"></td><td><pre>\t\t\t<span class=\"token function-variable function\">pointFormatter</span><span class=\"token operator\">:</span> <span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"363\"></td><td><pre>\t\t\t  <span class=\"token keyword\">return</span> <span class=\"token string\">'&lt;tr>&lt;td>&lt;li style=\"color: '</span> <span class=\"token operator\">+</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>color <span class=\"token operator\">+</span> <span class=\"token string\">';padding:0px;\">&lt;/span> '</span> <span class=\"token operator\">+</span> item<span class=\"token punctuation\">.</span>name <span class=\"token operator\">+</span></pre></td></tr><tr><td data-num=\"364\"></td><td><pre>\t\t\t\t<span class=\"token string\">': &lt;/li>&lt;div style=\"float: right;\">'</span> <span class=\"token operator\">+</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>y<span class=\"token punctuation\">.</span><span class=\"token function\">toFixed</span><span class=\"token punctuation\">(</span>item<span class=\"token punctuation\">.</span>valueDecimals<span class=\"token punctuation\">)</span> <span class=\"token operator\">+</span> item<span class=\"token punctuation\">.</span>unit <span class=\"token operator\">+</span> <span class=\"token string\">'&lt;/div>&lt;/td>&lt;/tr>'</span></pre></td></tr><tr><td data-num=\"365\"></td><td><pre>\t\t\t<span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"366\"></td><td><pre>\t\t  <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"367\"></td><td><pre>\t\t  <span class=\"token literal-property property\">yAxis</span><span class=\"token operator\">:</span> item<span class=\"token punctuation\">.</span>yAxisIndex<span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"368\"></td><td><pre>\t\t  <span class=\"token literal-property property\">showInNavigator</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span></pre></td></tr><tr><td data-num=\"369\"></td><td><pre>\t\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"370\"></td><td><pre>\t  <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"371\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"372\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"373\"></td><td><pre></pre></td></tr><tr><td data-num=\"374\"></td><td><pre><span class=\"token comment\">// 画图（container 为 div 的 id）</span></pre></td></tr><tr><td data-num=\"375\"></td><td><pre>Highcharts<span class=\"token punctuation\">.</span><span class=\"token function\">stockChart</span><span class=\"token punctuation\">(</span><span class=\"token string\">'container'</span><span class=\"token punctuation\">,</span> option<span class=\"token punctuation\">)</span></pre></td></tr></table></figure>",
            "tags": [
                "工作",
                "Highcharts",
                "Highcharts"
            ]
        },
        {
            "id": "https://hitoli.com/2022/12/05/Win10%E5%BD%BB%E5%BA%95%E5%85%B3%E9%97%ADwsappx%E8%BF%9B%E7%A8%8B/",
            "url": "https://hitoli.com/2022/12/05/Win10%E5%BD%BB%E5%BA%95%E5%85%B3%E9%97%ADwsappx%E8%BF%9B%E7%A8%8B/",
            "title": "Win10彻底关闭wsappx进程",
            "date_published": "2022-12-05T04:23:00.000Z",
            "content_html": "<h4 id=\"引言\"><a class=\"anchor\" href=\"#引言\">#</a> 引言</h4>\n<p>最近重装了家里一台 mini 电脑，把系统升级成了最新的 win10 系统。但是使用起来却异常卡顿，查看任务管理器发现有个 wsappx 进程占用 cpu 严重。于是百度搜索得知它是微软商店的依赖进程，而我根本就用不上，所以直接禁用。</p>\n<h4 id=\"方法一\"><a class=\"anchor\" href=\"#方法一\">#</a> 方法一</h4>\n<ol>\n<li>开始菜单点击 “开始 / 应用商店” 菜单项。</li>\n<li>接着就会打开应用商店窗口，在窗口中点击个人头像的图标。</li>\n<li>在弹出的菜单中点击 “设置” 菜单项。</li>\n<li>在打开的应用商店设置窗口中，找到自动更新应用一项。</li>\n<li>点击该项下面的开关，把该项下面的开关设置为关即可。</li>\n</ol>\n<h4 id=\"方法二\"><a class=\"anchor\" href=\"#方法二\">#</a> 方法二</h4>\n<ol>\n<li>win 键 + r，输入 regedit</li>\n<li>计算机 \\HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\AppXSvc 将 3 改为 4<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2022/12/05/2022061711420518.jpg\" alt=\"\" /></li>\n<li>计算机 \\HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\ClipSVC 将 3 改为 4<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2022/12/05/2022061711420619.jpg\" alt=\"\" /></li>\n<li>重启电脑</li>\n</ol>\n",
            "tags": [
                "Windows",
                "win10",
                "wsappx"
            ]
        },
        {
            "id": "https://hitoli.com/2022/12/02/KLineChart%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E6%A0%87%E7%94%BB%E5%9B%BE/",
            "url": "https://hitoli.com/2022/12/02/KLineChart%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%87%E6%A0%87%E7%94%BB%E5%9B%BE/",
            "title": "KLineChart实现自定义指标画图",
            "date_published": "2022-12-02T07:16:00.000Z",
            "content_html": "<h4 id=\"引言\"><a class=\"anchor\" href=\"#引言\">#</a> 引言</h4>\n<p>本次任务是需要在一个指标图上通过点击标记画出此标记参与计算的数据范围、最高最低值、参考线等等，于是有了以下代码。代码仅供参考，如有错误的地方请指正！<br />\n<img data-src=\"https://nas.hitoli.com:18014/images/2022/12/02/7fd440be0502d0099427e7c74c4ebf29.jpg\" alt=\"7fd440be0502d0099427e7c74c4ebf29.jpg\" /></p>\n<h4 id=\"模版代码\"><a class=\"anchor\" href=\"#模版代码\">#</a> 模版代码</h4>\n<figure class=\"highlight js\"><figcaption data-lang=\"JavaScript\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre><span class=\"token comment\">// 箱体指标</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre><span class=\"token keyword\">const</span> boxDataScope <span class=\"token operator\">=</span> <span class=\"token number\">300</span> <span class=\"token comment\">// 箱体范围</span></pre></td></tr><tr><td data-num=\"3\"></td><td><pre><span class=\"token comment\">// 黄金线参数</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre><span class=\"token keyword\">const</span> goldenSectionA <span class=\"token operator\">=</span> <span class=\"token number\">0.191</span></pre></td></tr><tr><td data-num=\"5\"></td><td><pre><span class=\"token keyword\">const</span> goldenSectionB <span class=\"token operator\">=</span> <span class=\"token number\">0.382</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre><span class=\"token keyword\">const</span> goldenSectionC <span class=\"token operator\">=</span> <span class=\"token number\">0.5</span></pre></td></tr><tr><td data-num=\"7\"></td><td><pre><span class=\"token keyword\">const</span> goldenSectionD <span class=\"token operator\">=</span> <span class=\"token number\">0.618</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre><span class=\"token keyword\">const</span> goldenSectionE <span class=\"token operator\">=</span> <span class=\"token number\">0.809</span></pre></td></tr><tr><td data-num=\"9\"></td><td><pre><span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>chart<span class=\"token punctuation\">.</span><span class=\"token function\">addTechnicalIndicatorTemplate</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre>\t<span class=\"token literal-property property\">name</span><span class=\"token operator\">:</span> <span class=\"token string\">'custom_box_solid'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>    <span class=\"token literal-property property\">shortName</span><span class=\"token operator\">:</span> <span class=\"token string\">'箱体'</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre>    <span class=\"token literal-property property\">precision</span><span class=\"token operator\">:</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>    <span class=\"token literal-property property\">plots</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span> <span class=\"token comment\">//key 属性的值最好在主图数据范围内，否则 Y 轴的值会跟着变大可能会导致主图变成一条线</span></pre></td></tr><tr><td data-num=\"14\"></td><td><pre>      <span class=\"token punctuation\">&#123;</span> <span class=\"token literal-property property\">key</span><span class=\"token operator\">:</span> <span class=\"token string\">'max'</span><span class=\"token punctuation\">,</span> <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'最高：'</span> <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>      <span class=\"token punctuation\">&#123;</span> <span class=\"token literal-property property\">key</span><span class=\"token operator\">:</span> <span class=\"token string\">'min'</span><span class=\"token punctuation\">,</span> <span class=\"token literal-property property\">title</span><span class=\"token operator\">:</span> <span class=\"token string\">'最低：'</span> <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre>    <span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>    <span class=\"token literal-property property\">calcParams</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>boxDataScope<span class=\"token punctuation\">,</span> goldenSectionA<span class=\"token punctuation\">,</span> goldenSectionB<span class=\"token punctuation\">,</span> goldenSectionC<span class=\"token punctuation\">,</span> goldenSectionD<span class=\"token punctuation\">,</span> goldenSectionE<span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>    <span class=\"token function-variable function\">calcTechnicalIndicator</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">dataList<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">&#123;</span> params<span class=\"token punctuation\">,</span> plots <span class=\"token punctuation\">&#125;</span></span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>      <span class=\"token keyword\">let</span> allDatas <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span> <span class=\"token comment\">// 所有数据</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>      <span class=\"token keyword\">let</span> selectedDatas <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span> <span class=\"token comment\">// 选中的数据</span></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>      <span class=\"token keyword\">for</span> <span class=\"token punctuation\">(</span><span class=\"token keyword\">let</span> i <span class=\"token operator\">=</span> <span class=\"token number\">0</span><span class=\"token punctuation\">;</span> i <span class=\"token operator\">&lt;</span> dataList<span class=\"token punctuation\">.</span>length<span class=\"token punctuation\">;</span> i<span class=\"token operator\">++</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre>        <span class=\"token keyword\">let</span> kLineData <span class=\"token operator\">=</span> dataList<span class=\"token punctuation\">[</span>i<span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token function\">dateConvert</span><span class=\"token punctuation\">(</span>kLineData<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getTime</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">===</span> <span class=\"token function\">getGlobalObject</span><span class=\"token punctuation\">(</span><span class=\"token string\">'boxId'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>          <span class=\"token keyword\">const</span> size <span class=\"token operator\">=</span> params<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre>          <span class=\"token comment\">// 找出当前数据往前的 size 条数据（包含自己）</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre>          <span class=\"token keyword\">let</span> startData <span class=\"token operator\">=</span> i <span class=\"token operator\">-</span> size <span class=\"token operator\">+</span> <span class=\"token number\">1</span></pre></td></tr><tr><td data-num=\"27\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>startData <span class=\"token operator\">&lt;</span> <span class=\"token number\">0</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"28\"></td><td><pre>            startData <span class=\"token operator\">=</span> <span class=\"token number\">0</span></pre></td></tr><tr><td data-num=\"29\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"30\"></td><td><pre>          <span class=\"token keyword\">let</span> endData <span class=\"token operator\">=</span> i <span class=\"token operator\">+</span> <span class=\"token number\">1</span></pre></td></tr><tr><td data-num=\"31\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>endData <span class=\"token operator\">></span> dataList<span class=\"token punctuation\">.</span>length<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"32\"></td><td><pre>            endData <span class=\"token operator\">=</span> dataList<span class=\"token punctuation\">.</span>length</pre></td></tr><tr><td data-num=\"33\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"34\"></td><td><pre>          selectedDatas <span class=\"token operator\">=</span> dataList<span class=\"token punctuation\">.</span><span class=\"token function\">slice</span><span class=\"token punctuation\">(</span>startData<span class=\"token punctuation\">,</span> endData<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"35\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"36\"></td><td><pre>        allDatas<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"37\"></td><td><pre>          <span class=\"token literal-property property\">timestamp</span><span class=\"token operator\">:</span> kLineData<span class=\"token punctuation\">.</span>timestamp</pre></td></tr><tr><td data-num=\"38\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"39\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"40\"></td><td><pre>      <span class=\"token comment\">// 找出选中数据中最高最低差价</span></pre></td></tr><tr><td data-num=\"41\"></td><td><pre>      <span class=\"token keyword\">let</span> max<span class=\"token punctuation\">,</span> min</pre></td></tr><tr><td data-num=\"42\"></td><td><pre>      selectedDatas<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">item</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"43\"></td><td><pre>        <span class=\"token keyword\">let</span> value <span class=\"token operator\">=</span> item<span class=\"token punctuation\">.</span>close <span class=\"token operator\">-</span> item<span class=\"token punctuation\">.</span>close2</pre></td></tr><tr><td data-num=\"44\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token operator\">!</span>max <span class=\"token operator\">||</span> value <span class=\"token operator\">></span> max<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"45\"></td><td><pre>          max <span class=\"token operator\">=</span> value</pre></td></tr><tr><td data-num=\"46\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"47\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token operator\">!</span>min <span class=\"token operator\">||</span> value <span class=\"token operator\">&lt;</span> min<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"48\"></td><td><pre>          min <span class=\"token operator\">=</span> value</pre></td></tr><tr><td data-num=\"49\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"50\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"51\"></td><td><pre>\t  <span class=\"token comment\">// 返回指标最终数据（未选中的数据用空对象替换）</span></pre></td></tr><tr><td data-num=\"52\"></td><td><pre>\t  <span class=\"token comment\">// 必须返回和 dataList 一样条数的数据，否则 title 不会显示</span></pre></td></tr><tr><td data-num=\"53\"></td><td><pre>      <span class=\"token keyword\">return</span> allDatas<span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">data<span class=\"token punctuation\">,</span> i</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"54\"></td><td><pre>        <span class=\"token keyword\">let</span> item <span class=\"token operator\">=</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"55\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"56\"></td><td><pre>        selectedDatas<span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">selected<span class=\"token punctuation\">,</span> j</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"57\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">.</span>timestamp <span class=\"token operator\">===</span> selected<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"58\"></td><td><pre>            item<span class=\"token punctuation\">.</span>timestamp <span class=\"token operator\">=</span> selected<span class=\"token punctuation\">.</span>timestamp</pre></td></tr><tr><td data-num=\"59\"></td><td><pre>            item<span class=\"token punctuation\">.</span>max <span class=\"token operator\">=</span> max</pre></td></tr><tr><td data-num=\"60\"></td><td><pre>            item<span class=\"token punctuation\">.</span>min <span class=\"token operator\">=</span> min</pre></td></tr><tr><td data-num=\"61\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"62\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"63\"></td><td><pre>        <span class=\"token keyword\">return</span> item</pre></td></tr><tr><td data-num=\"64\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"65\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">,</span></pre></td></tr><tr><td data-num=\"66\"></td><td><pre>    <span class=\"token function-variable function\">render</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\"><span class=\"token punctuation\">&#123;</span> ctx<span class=\"token punctuation\">,</span> dataSource<span class=\"token punctuation\">,</span> viewport<span class=\"token punctuation\">,</span> styles<span class=\"token punctuation\">,</span> xAxis<span class=\"token punctuation\">,</span> yAxis <span class=\"token punctuation\">&#125;</span></span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"67\"></td><td><pre>      <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>dataSource<span class=\"token punctuation\">.</span>technicalIndicatorDataList<span class=\"token punctuation\">.</span>length <span class=\"token operator\">&lt;=</span> <span class=\"token number\">0</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 无指标数据则不处理</span></pre></td></tr><tr><td data-num=\"68\"></td><td><pre>        <span class=\"token keyword\">return</span></pre></td></tr><tr><td data-num=\"69\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"70\"></td><td><pre>\t  <span class=\"token comment\">// X 轴起始像素</span></pre></td></tr><tr><td data-num=\"71\"></td><td><pre>      <span class=\"token keyword\">let</span> x <span class=\"token operator\">=</span> xAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span><span class=\"token number\">0</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"72\"></td><td><pre>      <span class=\"token comment\">// 标记选中数据的起止位置</span></pre></td></tr><tr><td data-num=\"73\"></td><td><pre>      <span class=\"token keyword\">let</span> start</pre></td></tr><tr><td data-num=\"74\"></td><td><pre>      <span class=\"token keyword\">let</span> end <span class=\"token operator\">=</span> dataSource<span class=\"token punctuation\">.</span>technicalIndicatorDataList<span class=\"token punctuation\">.</span>length <span class=\"token operator\">-</span> <span class=\"token number\">1</span></pre></td></tr><tr><td data-num=\"75\"></td><td><pre>      dataSource<span class=\"token punctuation\">.</span>technicalIndicatorDataList<span class=\"token punctuation\">.</span><span class=\"token function\">forEach</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">kLineData<span class=\"token punctuation\">,</span> i</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"76\"></td><td><pre>        <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>kLineData<span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"77\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token operator\">!</span>start<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"78\"></td><td><pre>            start <span class=\"token operator\">=</span> i</pre></td></tr><tr><td data-num=\"79\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"80\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">&lt;</span> end <span class=\"token operator\">&amp;&amp;</span> <span class=\"token operator\">!</span>dataSource<span class=\"token punctuation\">.</span>technicalIndicatorDataList<span class=\"token punctuation\">[</span>i <span class=\"token operator\">+</span> <span class=\"token number\">1</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">.</span>timestamp<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"81\"></td><td><pre>            end <span class=\"token operator\">=</span> i</pre></td></tr><tr><td data-num=\"82\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"83\"></td><td><pre>          <span class=\"token keyword\">let</span> max <span class=\"token operator\">=</span> kLineData<span class=\"token punctuation\">.</span>max</pre></td></tr><tr><td data-num=\"84\"></td><td><pre>          <span class=\"token keyword\">let</span> min <span class=\"token operator\">=</span> kLineData<span class=\"token punctuation\">.</span>min</pre></td></tr><tr><td data-num=\"85\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>fillStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#fff'</span></pre></td></tr><tr><td data-num=\"86\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>textBaseline <span class=\"token operator\">=</span> <span class=\"token string\">'middle'</span></pre></td></tr><tr><td data-num=\"87\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>textAlign <span class=\"token operator\">=</span> <span class=\"token string\">'center'</span></pre></td></tr><tr><td data-num=\"88\"></td><td><pre>          <span class=\"token comment\">// 画箱体</span></pre></td></tr><tr><td data-num=\"89\"></td><td><pre>\t\t  <span class=\"token comment\">// 箱体颜色</span></pre></td></tr><tr><td data-num=\"90\"></td><td><pre>\t\t  ctx<span class=\"token punctuation\">.</span>strokeStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#DC143C'</span></pre></td></tr><tr><td data-num=\"91\"></td><td><pre>\t\t  <span class=\"token comment\">//y 轴最高点位置</span></pre></td></tr><tr><td data-num=\"92\"></td><td><pre>\t\t  <span class=\"token keyword\">let</span> yHigh <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>max<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"93\"></td><td><pre>\t\t  <span class=\"token comment\">//y 轴最低点位置</span></pre></td></tr><tr><td data-num=\"94\"></td><td><pre>\t\t  <span class=\"token keyword\">let</span> yLow <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>min<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"95\"></td><td><pre>\t\t  ctx<span class=\"token punctuation\">.</span><span class=\"token function\">beginPath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"96\"></td><td><pre>\t\t  <span class=\"token comment\">// 画笔移动到数据的 x 轴起始点，y 轴最高点</span></pre></td></tr><tr><td data-num=\"97\"></td><td><pre>\t\t  ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yHigh<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"98\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">===</span> start<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 如果是第一条数据则需要画一条竖线</span></pre></td></tr><tr><td data-num=\"99\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yLow<span class=\"token punctuation\">)</span> <span class=\"token comment\">// 画竖线</span></pre></td></tr><tr><td data-num=\"100\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yHigh<span class=\"token punctuation\">)</span> <span class=\"token comment\">// 画笔移回</span></pre></td></tr><tr><td data-num=\"101\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"102\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">===</span> end<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 如果是最后一条数据则需要画一条竖线</span></pre></td></tr><tr><td data-num=\"103\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yLow<span class=\"token punctuation\">)</span> <span class=\"token comment\">// 画竖线</span></pre></td></tr><tr><td data-num=\"104\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>max<span class=\"token punctuation\">,</span> x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yHigh<span class=\"token punctuation\">)</span> <span class=\"token comment\">// 标识箱体最高点的值</span></pre></td></tr><tr><td data-num=\"105\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yLow<span class=\"token punctuation\">)</span> <span class=\"token comment\">// 画笔移动到 Y 轴最低点</span></pre></td></tr><tr><td data-num=\"106\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>min<span class=\"token punctuation\">,</span> x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yLow<span class=\"token punctuation\">)</span> <span class=\"token comment\">// 标识箱体最低点的值</span></pre></td></tr><tr><td data-num=\"107\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 画两条横线，一条在 y 轴最高点，一条在 y 轴最低点</span></pre></td></tr><tr><td data-num=\"108\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yHigh<span class=\"token punctuation\">)</span> <span class=\"token comment\">//y 轴最高点横线</span></pre></td></tr><tr><td data-num=\"109\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yLow<span class=\"token punctuation\">)</span> <span class=\"token comment\">// 画笔移动到 y 轴最低点</span></pre></td></tr><tr><td data-num=\"110\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yLow<span class=\"token punctuation\">)</span> <span class=\"token comment\">//y 轴最低点横线</span></pre></td></tr><tr><td data-num=\"111\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"112\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">stroke</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"113\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">closePath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"114\"></td><td><pre>          <span class=\"token comment\">// 画黄金线</span></pre></td></tr><tr><td data-num=\"115\"></td><td><pre>\t\t  <span class=\"token comment\">// 黄金线颜色</span></pre></td></tr><tr><td data-num=\"116\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span>strokeStyle <span class=\"token operator\">=</span> <span class=\"token string\">'#ffffff'</span></pre></td></tr><tr><td data-num=\"117\"></td><td><pre>\t\t  <span class=\"token comment\">// 根据黄金线参数计算黄金线的值</span></pre></td></tr><tr><td data-num=\"118\"></td><td><pre>          <span class=\"token keyword\">let</span> goldenSectionLineA <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span>max <span class=\"token operator\">-</span> min<span class=\"token punctuation\">)</span> <span class=\"token operator\">*</span> goldenSectionA <span class=\"token operator\">+</span> min</pre></td></tr><tr><td data-num=\"119\"></td><td><pre>          <span class=\"token keyword\">let</span> goldenSectionLineB <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span>max <span class=\"token operator\">-</span> min<span class=\"token punctuation\">)</span> <span class=\"token operator\">*</span> goldenSectionB <span class=\"token operator\">+</span> min</pre></td></tr><tr><td data-num=\"120\"></td><td><pre>          <span class=\"token keyword\">let</span> goldenSectionLineC <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span>max <span class=\"token operator\">-</span> min<span class=\"token punctuation\">)</span> <span class=\"token operator\">*</span> goldenSectionC <span class=\"token operator\">+</span> min</pre></td></tr><tr><td data-num=\"121\"></td><td><pre>          <span class=\"token keyword\">let</span> goldenSectionLineD <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span>max <span class=\"token operator\">-</span> min<span class=\"token punctuation\">)</span> <span class=\"token operator\">*</span> goldenSectionD <span class=\"token operator\">+</span> min</pre></td></tr><tr><td data-num=\"122\"></td><td><pre>          <span class=\"token keyword\">let</span> goldenSectionLineE <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span>max <span class=\"token operator\">-</span> min<span class=\"token punctuation\">)</span> <span class=\"token operator\">*</span> goldenSectionE <span class=\"token operator\">+</span> min</pre></td></tr><tr><td data-num=\"123\"></td><td><pre>\t\t  <span class=\"token comment\">// 根据黄金线的值获取 Y 轴高度</span></pre></td></tr><tr><td data-num=\"124\"></td><td><pre>          <span class=\"token keyword\">let</span> yA <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>goldenSectionLineA<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"125\"></td><td><pre>          <span class=\"token keyword\">let</span> yB <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>goldenSectionLineB<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"126\"></td><td><pre>          <span class=\"token keyword\">let</span> yC <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>goldenSectionLineC<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"127\"></td><td><pre>          <span class=\"token keyword\">let</span> yD <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>goldenSectionLineD<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"128\"></td><td><pre>          <span class=\"token keyword\">let</span> yE <span class=\"token operator\">=</span> yAxis<span class=\"token punctuation\">.</span><span class=\"token function\">convertToPixel</span><span class=\"token punctuation\">(</span>goldenSectionLineE<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"129\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">beginPath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"130\"></td><td><pre>\t\t  <span class=\"token comment\">// 画第一条黄金线</span></pre></td></tr><tr><td data-num=\"131\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yA<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"132\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>barSpace <span class=\"token operator\">/</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span> yA<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"133\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">===</span> end<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span> <span class=\"token comment\">// 是否最后一条数据，如果是则需要标识黄金线的值</span></pre></td></tr><tr><td data-num=\"134\"></td><td><pre>\t\t    <span class=\"token comment\">// 标识第一条黄金线的值</span></pre></td></tr><tr><td data-num=\"135\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>goldenSectionLineA<span class=\"token punctuation\">.</span><span class=\"token function\">toFixed</span><span class=\"token punctuation\">(</span><span class=\"token number\">2</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yA<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"136\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"137\"></td><td><pre>\t\t  <span class=\"token comment\">// 画第二条黄金线</span></pre></td></tr><tr><td data-num=\"138\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yB<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"139\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>barSpace <span class=\"token operator\">/</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span> yB<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"140\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">===</span> end<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"141\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>goldenSectionLineB<span class=\"token punctuation\">.</span><span class=\"token function\">toFixed</span><span class=\"token punctuation\">(</span><span class=\"token number\">2</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yB<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"142\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"143\"></td><td><pre>\t\t  <span class=\"token comment\">// 画第三条黄金线</span></pre></td></tr><tr><td data-num=\"144\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yC<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"145\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>barSpace <span class=\"token operator\">/</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span> yC<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"146\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">===</span> end<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"147\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>goldenSectionLineC<span class=\"token punctuation\">.</span><span class=\"token function\">toFixed</span><span class=\"token punctuation\">(</span><span class=\"token number\">2</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yC<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"148\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"149\"></td><td><pre>\t\t  <span class=\"token comment\">// 画第四条黄金线</span></pre></td></tr><tr><td data-num=\"150\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yD<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"151\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>barSpace <span class=\"token operator\">/</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span> yD<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"152\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">===</span> end<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"153\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>goldenSectionLineD<span class=\"token punctuation\">.</span><span class=\"token function\">toFixed</span><span class=\"token punctuation\">(</span><span class=\"token number\">2</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yD<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"154\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"155\"></td><td><pre>\t\t  <span class=\"token comment\">// 画第五条黄金线</span></pre></td></tr><tr><td data-num=\"156\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">moveTo</span><span class=\"token punctuation\">(</span>x<span class=\"token punctuation\">,</span> yE<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"157\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">lineTo</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>barSpace <span class=\"token operator\">/</span> <span class=\"token number\">2</span><span class=\"token punctuation\">,</span> yE<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"158\"></td><td><pre>          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>i <span class=\"token operator\">===</span> end<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"159\"></td><td><pre>            ctx<span class=\"token punctuation\">.</span><span class=\"token function\">fillText</span><span class=\"token punctuation\">(</span>goldenSectionLineE<span class=\"token punctuation\">.</span><span class=\"token function\">toFixed</span><span class=\"token punctuation\">(</span><span class=\"token number\">2</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> x <span class=\"token operator\">+</span> viewport<span class=\"token punctuation\">.</span>dataSpace<span class=\"token punctuation\">,</span> yE<span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"160\"></td><td><pre>          <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"161\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">stroke</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"162\"></td><td><pre>          ctx<span class=\"token punctuation\">.</span><span class=\"token function\">closePath</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"163\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"164\"></td><td><pre>\t\t<span class=\"token comment\">// 计算 X 轴的下一个位置</span></pre></td></tr><tr><td data-num=\"165\"></td><td><pre>        x <span class=\"token operator\">+=</span> viewport<span class=\"token punctuation\">.</span>dataSpace</pre></td></tr><tr><td data-num=\"166\"></td><td><pre>      <span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr><tr><td data-num=\"167\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"168\"></td><td><pre><span class=\"token punctuation\">&#125;</span><span class=\"token punctuation\">)</span></pre></td></tr></table></figure><h4 id=\"结语\"><a class=\"anchor\" href=\"#结语\">#</a> 结语</h4>\n<div class=\"note info\">\n<p>以上代码只是箱体的指标模版，还需要根据业务逻辑在标记上实现点击事件，然后通过事件动态添加移除箱体指标。</p>\n</div>\n",
            "tags": [
                "工作",
                "KLineChart",
                "KLineChart",
                "K线",
                "自定义指标"
            ]
        },
        {
            "id": "https://hitoli.com/2022/11/30/%E5%B0%86nginx%E6%9B%BF%E6%8D%A2%E4%B8%BAtengine/",
            "url": "https://hitoli.com/2022/11/30/%E5%B0%86nginx%E6%9B%BF%E6%8D%A2%E4%B8%BAtengine/",
            "title": "将nginx替换为tengine",
            "date_published": "2022-11-30T09:05:00.000Z",
            "content_html": "<h4 id=\"介绍\"><a class=\"anchor\" href=\"#介绍\">#</a> 介绍</h4>\n<div class=\"note info\">\n<p>Tengine 的性能和稳定性已经在大型的网站如淘宝网，天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的 Web 平台。从 2011 年 12 月开始，Tengine 成为一个开源项目。现在，它由 Tengine 团队开发和维护。Tengine 团队的核心成员来自于淘宝、搜狗等互联网企业。</p>\n</div>\n<p>tengine 简单来说就是淘宝自己基于 nginx 优化的网页引擎，在 nginx 原先基础上继续保持兼容，同时功能扩展，效率提高，可以看到目前淘宝网在这么多人同时使用的情况下依然稳定，我们足以相信 tengine，由于它是 nginx 的一个分生版本，所以几乎完全兼容 nginx，所以我认为 tengine 是搭建 lnmp 环境的不二之选。</p>\n<h4 id=\"下载\"><a class=\"anchor\" href=\"#下载\">#</a> 下载</h4>\n<p>首先访问<span class=\"exturl\" data-url=\"aHR0cDovL3RlbmdpbmUudGFvYmFvLm9yZy8=\"> tengine 官方网站</span>，获取最新的下载地址。<br />\n <code>wget http://tengine.taobao.org/download/tengine-2.3.3.tar.gz</code></p>\n<h4 id=\"获取编译参数\"><a class=\"anchor\" href=\"#获取编译参数\">#</a> 获取编译参数</h4>\n<p><code>nginx -V</code></p>\n<h4 id=\"编译\"><a class=\"anchor\" href=\"#编译\">#</a> 编译</h4>\n<p><code>./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_gzip_static_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_uwsgi_module --without-http_scgi_module</code> <br />\n./configure 后面的参数是上一步获取的</p>\n<h4 id=\"make\"><a class=\"anchor\" href=\"#make\">#</a> Make</h4>\n<p><code>make 或者 make -j 内核数</code> <br />\n生成的文件在 objs 目录下</p>\n<h4 id=\"替换\"><a class=\"anchor\" href=\"#替换\">#</a> 替换</h4>\n<p>停止 nginx 服务 <code>service nginx stop</code> <br />\n 查看 nginx 目录 <code>whereis nginx</code> <br />\n 备份旧 nginx <code>mv /usr/sbin/nginx /usr/sbin/nginx.old</code> <br />\n 拷贝 objs 下的 nginx 替换旧 nginx <code>cp ./objs/nginx /usr/sbin/</code> <br />\n 备份旧 so 文件<br />\n拷贝 objs 下的 so 文件替换旧的 so 文件 <code>cp ./objs/*.so /usr/lib/nginx/modules/</code></p>\n<h4 id=\"测试\"><a class=\"anchor\" href=\"#测试\">#</a> 测试</h4>\n<p><code>nginx -t</code>  如果打印 test is successful 则表示替换成功。<br />\n然后执行 service nginx start 进行启动即可</p>\n",
            "tags": [
                "Linux",
                "服务",
                "Nginx",
                "Nginx",
                "Tengine"
            ]
        },
        {
            "id": "https://hitoli.com/2022/11/30/Nginx%E5%8A%A8%E6%80%81%E8%A7%A3%E6%9E%90%E5%9F%9F%E5%90%8D%E6%96%B9%E6%A1%88/",
            "url": "https://hitoli.com/2022/11/30/Nginx%E5%8A%A8%E6%80%81%E8%A7%A3%E6%9E%90%E5%9F%9F%E5%90%8D%E6%96%B9%E6%A1%88/",
            "title": "Nginx动态解析域名方案",
            "date_published": "2022-11-30T08:35:00.000Z",
            "content_html": "<h4 id=\"应用场景\"><a class=\"anchor\" href=\"#应用场景\">#</a> 应用场景：</h4>\n<p>由于有时候 nginx 代理的时候，第三方域名对应的 ip 可能发生变化，然而没有提前通知，然而如果不配置什么，nginx 又不能智能解析，因此 nginx 动态解析域名就比较重要。</p>\n<h4 id=\"使用模块nginx-upstream-dynamic-servers\"><a class=\"anchor\" href=\"#使用模块nginx-upstream-dynamic-servers\">#</a> 使用模块 nginx-upstream-dynamic-servers</h4>\n<p>该模块在启动 nginx 的时候会对域名进行一次解析，解析完成后，在 DNS 服务器设定的 TTL 过期时间内不会再次更新，在 TTL 过期后则会再次发起域名解析请求更新域名所对应的 IP 地址。</p>\n<p>需要在 nginx 的配置文件中的 http 配置域内指定使用的 DNS 服务器，在 upstream 中需要进行域名解析的 server 后面添加 resolve 参数。</p>\n<p>例：</p>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>http <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>    resolver    ip;</pre></td></tr><tr><td data-num=\"4\"></td><td><pre></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>    upstream test <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>        server  www.xxx.com<span class=\"token punctuation\">:</span>8080       resolve;</pre></td></tr><tr><td data-num=\"8\"></td><td><pre></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>    server <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>        listen       8080;</pre></td></tr><tr><td data-num=\"14\"></td><td><pre></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>        client_body_buffer_size 10m;</pre></td></tr><tr><td data-num=\"16\"></td><td><pre></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>        server_name  localhost;</pre></td></tr><tr><td data-num=\"18\"></td><td><pre></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>        location / <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre>        </pre></td></tr><tr><td data-num=\"21\"></td><td><pre>                proxy_pass      http<span class=\"token punctuation\">:</span>//test;</pre></td></tr><tr><td data-num=\"22\"></td><td><pre>                </pre></td></tr><tr><td data-num=\"23\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre>        </pre></td></tr><tr><td data-num=\"25\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"26\"></td><td><pre></pre></td></tr><tr><td data-num=\"27\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><p>缺点：</p>\n<p>1、每次解析域名之后，会从 DNS 服务器获取到改 DNS 的 TTL，在 TTL 期限内不会再次解析，所以如果目标域名发生改变，nginx 不会更新解析，知道 TTL 过期。</p>\n<p>2、DNS 服务器在 http 配置域配置全，不能在 location 中细分指定。</p>\n<h4 id=\"使用模块ngx_upstream_jdomain\"><a class=\"anchor\" href=\"#使用模块ngx_upstream_jdomain\">#</a> 使用模块 ngx_upstream_jdomain</h4>\n<p>在 http 配置域中配置 DNS 服务器，在 upstream 中按照这个模块的格式配置，支持设置每隔多少秒进行一次解析（抓包分析过设置 interval 可指定解析间隔），如果解析失败则使用缓存中的上一次解析结果的 IP 地址访问。</p>\n<p>例：</p>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>http <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>    resolver    ip;</pre></td></tr><tr><td data-num=\"4\"></td><td><pre></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>    upstream test <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"6\"></td><td><pre></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>        jdomain  www.xxx.com port=8080 interval=10; <span class=\"token comment\">#指定域名和端口，每隔 10 秒进行一次解析</span></pre></td></tr><tr><td data-num=\"8\"></td><td><pre></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>    server <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>        listen       8080;</pre></td></tr><tr><td data-num=\"14\"></td><td><pre></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>        client_body_buffer_size 10m;</pre></td></tr><tr><td data-num=\"16\"></td><td><pre></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>        server_name  localhost;</pre></td></tr><tr><td data-num=\"18\"></td><td><pre></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>        location / <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"20\"></td><td><pre></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>                proxy_pass      http<span class=\"token punctuation\">:</span>//test;</pre></td></tr><tr><td data-num=\"22\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>        </pre></td></tr><tr><td data-num=\"24\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"25\"></td><td><pre></pre></td></tr><tr><td data-num=\"26\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><p>缺点：DNS 服务器只能在 http 配域中全局配置</p>\n<h4 id=\"原生nginx使用set命令使用变量\"><a class=\"anchor\" href=\"#原生nginx使用set命令使用变量\">#</a> 原生 nginx 使用 set 命令使用变量</h4>\n<p>将域名置于变量中，在对 proxy_pass 进行转发的时候域名调用变量，可以按照 valid，设置的时间参数间隔地对变量中的域名进行解析。</p>\n<p>例：</p>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>server <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>\tlisten       8080;</pre></td></tr><tr><td data-num=\"4\"></td><td><pre></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>\tclient_body_buffer_size 10m;</pre></td></tr><tr><td data-num=\"6\"></td><td><pre></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>\tserver_name  localhost;</pre></td></tr><tr><td data-num=\"8\"></td><td><pre></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>\tlocation / <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>\t\t\tresolver ip valid=3s;</pre></td></tr><tr><td data-num=\"12\"></td><td><pre></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>\t\t\tset $five \"www.xxx.com<span class=\"token punctuation\">:</span>8080\";</pre></td></tr><tr><td data-num=\"14\"></td><td><pre></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>\t\t\tproxy_pass      http<span class=\"token punctuation\">:</span>//$<span class=\"token punctuation\">&#123;</span>five<span class=\"token punctuation\">&#125;</span>;</pre></td></tr><tr><td data-num=\"16\"></td><td><pre></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>\t<span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"18\"></td><td><pre>\t</pre></td></tr><tr><td data-num=\"19\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><p>缺点：upstream 中不支持设置变量，因此后端有多台的时候该方案不可行。</p>\n<h4 id=\"tengine\"><a class=\"anchor\" href=\"#tengine\">#</a> Tengine</h4>\n<p>在 upstream 中配置 dynamic_resolve，在 location 配置域中指定 NDS 服务器，按照 valid 设置的时间间隔地进行地址解析。<span class=\"label danger\">只支持 http 模块的动态域名解析</span></p>\n<p>例：</p>\n<figure class=\"highlight yaml\"><figcaption data-lang=\"YAML\"></figcaption><table><tr><td data-num=\"1\"></td><td><pre>http <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"2\"></td><td><pre></pre></td></tr><tr><td data-num=\"3\"></td><td><pre>    upstream test <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"4\"></td><td><pre></pre></td></tr><tr><td data-num=\"5\"></td><td><pre>        dynamic_resolve fallback=stale fail_timeout=30s;</pre></td></tr><tr><td data-num=\"6\"></td><td><pre></pre></td></tr><tr><td data-num=\"7\"></td><td><pre>        server  www.xxx.com<span class=\"token punctuation\">:</span>8080;</pre></td></tr><tr><td data-num=\"8\"></td><td><pre></pre></td></tr><tr><td data-num=\"9\"></td><td><pre>    <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"10\"></td><td><pre></pre></td></tr><tr><td data-num=\"11\"></td><td><pre>    server <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"12\"></td><td><pre></pre></td></tr><tr><td data-num=\"13\"></td><td><pre>        listen       8080;</pre></td></tr><tr><td data-num=\"14\"></td><td><pre></pre></td></tr><tr><td data-num=\"15\"></td><td><pre>        location / <span class=\"token punctuation\">&#123;</span></pre></td></tr><tr><td data-num=\"16\"></td><td><pre></pre></td></tr><tr><td data-num=\"17\"></td><td><pre>                resolver       ip     valid=3s;</pre></td></tr><tr><td data-num=\"18\"></td><td><pre></pre></td></tr><tr><td data-num=\"19\"></td><td><pre>                proxy_pass      http<span class=\"token punctuation\">:</span>//test;</pre></td></tr><tr><td data-num=\"20\"></td><td><pre></pre></td></tr><tr><td data-num=\"21\"></td><td><pre>        <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"22\"></td><td><pre></pre></td></tr><tr><td data-num=\"23\"></td><td><pre>\t  <span class=\"token punctuation\">&#125;</span></pre></td></tr><tr><td data-num=\"24\"></td><td><pre></pre></td></tr><tr><td data-num=\"25\"></td><td><pre><span class=\"token punctuation\">&#125;</span></pre></td></tr></table></figure><p>缺点：需要将 nginx 的 bin 文件替换为 tengine 的 bin 文件。</p>\n",
            "tags": [
                "Linux",
                "服务",
                "Nginx",
                "Nginx",
                "Tengine",
                "动态域名解析"
            ]
        }
    ]
}