<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>雕木乱</title><link>https://www.zhangkeda.com/</link><description>–   我们都值得被尊重，哪怕是一坨拉稀的屎</description><item><title>mPDF调用中的参数设置</title><link>https://www.zhangkeda.com/?id=572</link><description>&lt;h2 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;一、参数总览&lt;/span&gt;&lt;/h2&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-top: 16px; margin-bottom: 16px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;options&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;数组的顶层参数如下：&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;ds-scroll-area ds-scroll-area--show-on-focus-within ds-scroll-area--enabled _1210dd7 c03cafe9&quot; style=&quot;--dsl-scroll-area-gutters-disappear-delay: 1s; z-index: 0; position: relative; overflow: auto; scrollbar-width: none; --padding-left: calc(( var(--dsl-virtual-list-width) - (var(--message-list-max-width) - 2 * var(--message-list-padding-horizontal)) ) / 2 + (var(--message-list-max-width) - 2 * var(--message-list-padding-horizontal) - 100%)); --padding-right: 54px; width: calc(var(--dsl-virtual-list-width) - var(--padding-left) - var(--padding-right)); padding-left: var(--padding-left); padding-right: var(--padding-right); margin-left: calc(-1 * var(--padding-left)); color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255); --container-height: 92px;&quot;&gt;&lt;div class=&quot;ds-scroll-area__gutters&quot; style=&quot;--dsl-scroll-area-scrollbar-bg: var(--dsw-alias-scrollbar-bg-l1); --dsl-scroll-area-scrollbar-hover: var(--dsw-alias-scrollbar-hover-l1); pointer-events: none; z-index: 1000; transition-duration: 0.1s; transition-timing-function: ease-out; transition-property: opacity; transition-delay: var(--dsl-scroll-area-gutters-disappear-delay); --container-height: 92px; position: sticky; top: 0px; left: 0px; right: 0px; width: 1215.5px; height: 0px; opacity: 1 !important;&quot;&gt;&lt;div class=&quot;ds-scroll-area__horizontal-gutter&quot; style=&quot;position: absolute; left: 0px; right: 0px; top: calc(var(--container-height) - 14px); height: 8px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-scroll-area__vertical-gutter&quot; style=&quot;position: absolute; right: 3px; top: 3px; bottom: calc(0px - var(--container-height) + 3px); width: 8px;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;table width=&quot;NaN&quot;&gt;&lt;thead&gt;&lt;tr class=&quot;firstRow&quot;&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;参数&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;类型&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;必填&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;说明&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;type&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;是&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;水印类型，只能是&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;&amp;#39;text&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;或&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;&amp;#39;image&amp;#39;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-top: 16px; margin-bottom: 16px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;根据&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;type&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;的不同，后续参数分两组：&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-top: 16px; margin-bottom: 16px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;&lt;span class=&quot;&quot;&gt;文字水印（&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;type = &amp;#39;text&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;ds-scroll-area ds-scroll-area--show-on-focus-within ds-scroll-area--enabled _1210dd7 c03cafe9&quot; style=&quot;--dsl-scroll-area-gutters-disappear-delay: 1s; z-index: 0; position: relative; overflow: auto; scrollbar-width: none; --padding-left: calc(( var(--dsl-virtual-list-width) - (var(--message-list-max-width) - 2 * var(--message-list-padding-horizontal)) ) / 2 + (var(--message-list-max-width) - 2 * var(--message-list-padding-horizontal) - 100%)); --padding-right: 54px; width: calc(var(--dsl-virtual-list-width) - var(--padding-left) - var(--padding-right)); padding-left: var(--padding-left); padding-right: var(--padding-right); margin-left: calc(-1 * var(--padding-left)); color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255); --container-height: 229px;&quot;&gt;&lt;div class=&quot;ds-scroll-area__gutters&quot; style=&quot;--dsl-scroll-area-scrollbar-bg: var(--dsw-alias-scrollbar-bg-l1); --dsl-scroll-area-scrollbar-hover: var(--dsw-alias-scrollbar-hover-l1); pointer-events: none; z-index: 1000; transition-duration: 0.1s; transition-timing-function: ease-out; transition-property: opacity; transition-delay: var(--dsl-scroll-area-gutters-disappear-delay); --container-height: 229px; position: sticky; top: 0px; left: 0px; right: 0px; width: 1215.5px; height: 0px; opacity: 1 !important;&quot;&gt;&lt;div class=&quot;ds-scroll-area__horizontal-gutter&quot; style=&quot;position: absolute; left: 0px; right: 0px; top: calc(var(--container-height) - 14px); height: 8px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-scroll-area__vertical-gutter&quot; style=&quot;position: absolute; right: 3px; top: 3px; bottom: calc(0px - var(--container-height) + 3px); width: 8px;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;table width=&quot;NaN&quot;&gt;&lt;thead&gt;&lt;tr class=&quot;firstRow&quot;&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;参数&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;类型&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;默认值&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;说明&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;text&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;无&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;水印文字内容，支持&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;\n&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;换行或&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;&amp;lt;br&amp;gt;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;标签&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;alpha&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;float&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;0.2&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;透明度，范围&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;0~1&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，值越小越淡&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;font&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;&amp;#39;GB&amp;#39;&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;字体名，中文建议用&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;&amp;#39;GB&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;或&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;&amp;#39;sun-exta&amp;#39;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;angle&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;int&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;45&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;旋转角度，单位度，如&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;0&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;水平、&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;45&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;倾斜&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-top: 16px; margin-bottom: 16px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;&lt;span class=&quot;&quot;&gt;图片水印（&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;type = &amp;#39;image&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;ds-scroll-area ds-scroll-area--show-on-focus-within ds-scroll-area--enabled _1210dd7 c03cafe9&quot; style=&quot;--dsl-scroll-area-gutters-disappear-delay: 1s; z-index: 0; position: relative; overflow: auto; scrollbar-width: none; --padding-left: calc(( var(--dsl-virtual-list-width) - (var(--message-list-max-width) - 2 * var(--message-list-padding-horizontal)) ) / 2 + (var(--message-list-max-width) - 2 * var(--message-list-padding-horizontal) - 100%)); --padding-right: 54px; width: calc(var(--dsl-virtual-list-width) - var(--padding-left) - var(--padding-right)); padding-left: var(--padding-left); padding-right: var(--padding-right); margin-left: calc(-1 * var(--padding-left)); color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255); --container-height: 229px;&quot;&gt;&lt;div class=&quot;ds-scroll-area__gutters&quot; style=&quot;--dsl-scroll-area-scrollbar-bg: var(--dsw-alias-scrollbar-bg-l1); --dsl-scroll-area-scrollbar-hover: var(--dsw-alias-scrollbar-hover-l1); pointer-events: none; z-index: 1000; transition-duration: 0.1s; transition-timing-function: ease-out; transition-property: opacity; transition-delay: var(--dsl-scroll-area-gutters-disappear-delay); --container-height: 229px; position: sticky; top: 0px; left: 0px; right: 0px; width: 1215.5px; height: 0px; opacity: 1 !important;&quot;&gt;&lt;div class=&quot;ds-scroll-area__horizontal-gutter&quot; style=&quot;position: absolute; left: 0px; right: 0px; top: calc(var(--container-height) - 14px); height: 8px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-scroll-area__vertical-gutter&quot; style=&quot;position: absolute; right: 3px; top: 3px; bottom: calc(0px - var(--container-height) + 3px); width: 8px;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;table width=&quot;NaN&quot;&gt;&lt;thead&gt;&lt;tr class=&quot;firstRow&quot;&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;参数&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;类型&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;默认值&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;说明&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;image&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;无&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;图片路径，支持相对&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;public&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;目录或绝对路径&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;alpha&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;float&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;0.3&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;透明度，范围&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;0~1&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;size&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;string/array&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;&amp;#39;D&amp;#39;&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;水印尺寸，见下方说明&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;position&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;array&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;[0, 0]&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;span class=&quot;&quot;&gt;水印位置&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;[x, y]&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，单位 mm&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;hr style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border: none; height: 1px; margin: 32px 0px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;二、完整调用示例&lt;/span&gt;&lt;/h2&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;1. 文字水印（单行）&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;md-code-block md-code-block-light&quot; style=&quot;--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner); --dsl-code-block-border-radius: 12px; --dsl-code-block-banner-font: var(--dsw-font-xs-13); --dsl-code-block-content-font: var(--dsw-font-markdown-code-block); color: rgb(15, 17, 21); background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border-radius: var(--dsl-code-block-border-radius); margin: 16px 0px 11px; position: relative; font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;&gt;&lt;div class=&quot;md-code-block-banner-wrap&quot; style=&quot;top: 0px; z-index: 6; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius); position: sticky;&quot;&gt;&lt;div class=&quot;md-code-block-banner md-code-block-banner-lite&quot; style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; font: var(--dsl-code-block-banner-font); justify-content: space-between; padding: 0px; display: flex; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius);&quot;&gt;&lt;div class=&quot;_121d384&quot; style=&quot;justify-content: space-between; align-items: center; width: 740px; padding: 6px; display: flex;&quot;&gt;&lt;div class=&quot;d2a24f03&quot; style=&quot;flex-shrink: 0;&quot;&gt;&lt;span class=&quot;d813de27&quot; style=&quot;color: var(--dsw-alias-label-primary); font-family: var(--ds-font-family-code); margin-left: 8px; font-size: 12px; line-height: 18px;&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;d2a24f03 _246a029&quot; style=&quot;flex-shrink: 0; user-select: none;&quot;&gt;&lt;div class=&quot;efa13877&quot; style=&quot;height: 28px; color: var(--dsw-alias-label-secondary); align-items: center; display: flex;&quot;&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width _64bb515&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); margin-right: 2px; --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909C0.484366 13.4254 0.365184 12.8888 0.308472 12.2635C0.252649 11.6473 0.252808 10.8795 0.252808 9.9168C0.252808 8.95418 0.252664 8.18625 0.308472 7.57012C0.365184 6.94481 0.484366 6.40818 0.76355 5.92462C1.09777 5.34589 1.57839 4.86529 2.1571 4.53106C2.64067 4.25188 3.1773 4.13269 3.80261 4.07598C4.41874 4.02017 5.18666 4.02032 6.14929 4.02032ZM6.14929 5.37774C5.16181 5.37774 4.46634 5.37761 3.92566 5.42657C3.39434 5.47472 3.07859 5.56574 2.83582 5.70587C2.4632 5.92106 2.15354 6.2307 1.93835 6.60333C1.79823 6.8461 1.70721 7.16185 1.65906 7.69317C1.6101 8.23385 1.61023 8.92933 1.61023 9.9168C1.61023 10.9043 1.61009 11.5998 1.65906 12.1404C1.70721 12.6717 1.79823 12.9875 1.93835 13.2303C2.15356 13.6029 2.46321 13.9126 2.83582 14.1277C3.07859 14.2679 3.39434 14.3589 3.92566 14.407C4.46634 14.456 5.16182 14.4559 6.14929 14.4559C7.13682 14.4559 7.83224 14.456 8.37292 14.407C8.90425 14.3589 9.21999 14.2679 9.46277 14.1277C9.83535 13.9126 10.145 13.6029 10.3602 13.2303C10.5004 12.9875 10.5914 12.6717 10.6395 12.1404C10.6885 11.5998 10.6884 10.9043 10.6884 9.9168C10.6884 8.92934 10.6885 8.23384 10.6395 7.69317C10.5914 7.16185 10.5004 6.8461 10.3602 6.60333C10.1451 6.23071 9.83536 5.92107 9.46277 5.70587C9.21999 5.56574 8.90424 5.47472 8.37292 5.42657C7.83224 5.3776 7.13682 5.37774 6.14929 5.37774ZM9.80164 0.367975C10.7638 0.367975 11.5314 0.36788 12.1473 0.423639C12.7726 0.480307 13.3093 0.598759 13.7928 0.877741C14.3717 1.21192 14.8521 1.69355 15.1864 2.27227C15.4655 2.75574 15.5857 3.29164 15.6425 3.9168C15.6983 4.53301 15.6971 5.3016 15.6971 6.26446V7.82989C15.6971 8.29264 15.6989 8.58993 15.6649 8.84844C15.4668 10.3525 14.401 11.5738 12.9833 11.9988V10.5467C13.6973 10.1903 14.2105 9.49662 14.3192 8.67169C14.3387 8.52347 14.3407 8.3358 14.3407 7.82989V6.26446C14.3407 5.27706 14.3398 4.58149 14.2909 4.04083C14.2428 3.50968 14.1526 3.19372 14.0126 2.95098C13.7974 2.57849 13.4876 2.26869 13.1151 2.05352C12.8724 1.91347 12.5564 1.82237 12.0253 1.77423C11.4847 1.72528 10.7888 1.7254 9.80164 1.7254H7.71472C6.7562 1.72558 5.92665 2.27697 5.52332 3.07891H4.07019C4.54221 1.51132 5.9932 0.368186 7.71472 0.367975H9.80164Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;复制&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M15.3695 11.411L15.1234 12.8866C14.8869 14.3042 13.6603 15.3436 12.223 15.3436H3.77673C2.33958 15.3434 1.1128 14.3042 0.876343 12.8866L0.630249 11.411L2.05408 11.1747L2.29919 12.6493C2.41973 13.3713 3.04475 13.9001 3.77673 13.9003H12.223C12.9551 13.9002 13.58 13.3713 13.7006 12.6493L13.9457 11.1747L15.3695 11.411ZM8.72205 8.994C8.77717 8.93934 8.83792 8.88106 8.90271 8.81627L12.4828 5.23424L13.5043 6.25572L9.92224 9.8358C9.6395 10.1185 9.38763 10.3732 9.15857 10.5575C8.91892 10.7503 8.63953 10.9224 8.2865 10.9784C8.09711 11.0083 7.90363 11.0083 7.71423 10.9784C7.36106 10.9224 7.0809 10.7503 6.84119 10.5575C6.61215 10.3732 6.36022 10.1185 6.07751 9.8358L2.49646 6.25572L3.51697 5.23424L7.09705 8.81627C7.16219 8.88142 7.22331 8.94006 7.27869 8.99498V1.3065H8.72205V8.994Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;下载&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font: var(--dsl-code-block-content-font); overflow: auto; text-wrap: wrap; word-break: break-all; padding: 16px; margin-top: 0px !important; margin-bottom: 0px !important;&quot;&gt;$options&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;text&amp;#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;必填：指定文字水印
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;text&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;机密文件&amp;#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;必填：水印文字
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;0.2,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;可选：透明度，默认&amp;nbsp;0.2
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;font&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;GB&amp;#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;可选：字体，默认&amp;nbsp;&amp;#39;GB&amp;#39;（中文用）
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;angle&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;45,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;可选：旋转角度，默认&amp;nbsp;45&amp;nbsp;度];&lt;/pre&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _33882ae&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _28d7e84&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;2. 文字水印（多行）&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;md-code-block md-code-block-light&quot; style=&quot;--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner); --dsl-code-block-border-radius: 12px; --dsl-code-block-banner-font: var(--dsw-font-xs-13); --dsl-code-block-content-font: var(--dsw-font-markdown-code-block); color: rgb(15, 17, 21); background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border-radius: var(--dsl-code-block-border-radius); margin: 16px 0px 11px; position: relative; font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;&gt;&lt;div class=&quot;md-code-block-banner-wrap&quot; style=&quot;top: 0px; z-index: 6; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius); position: sticky;&quot;&gt;&lt;div class=&quot;md-code-block-banner md-code-block-banner-lite&quot; style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; font: var(--dsl-code-block-banner-font); justify-content: space-between; padding: 0px; display: flex; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius);&quot;&gt;&lt;div class=&quot;_121d384&quot; style=&quot;justify-content: space-between; align-items: center; width: 740px; padding: 6px; display: flex;&quot;&gt;&lt;div class=&quot;d2a24f03&quot; style=&quot;flex-shrink: 0;&quot;&gt;&lt;span class=&quot;d813de27&quot; style=&quot;color: var(--dsw-alias-label-primary); font-family: var(--ds-font-family-code); margin-left: 8px; font-size: 12px; line-height: 18px;&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;d2a24f03 _246a029&quot; style=&quot;flex-shrink: 0; user-select: none;&quot;&gt;&lt;div class=&quot;efa13877&quot; style=&quot;height: 28px; color: var(--dsw-alias-label-secondary); align-items: center; display: flex;&quot;&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width _64bb515&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); margin-right: 2px; --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909C0.484366 13.4254 0.365184 12.8888 0.308472 12.2635C0.252649 11.6473 0.252808 10.8795 0.252808 9.9168C0.252808 8.95418 0.252664 8.18625 0.308472 7.57012C0.365184 6.94481 0.484366 6.40818 0.76355 5.92462C1.09777 5.34589 1.57839 4.86529 2.1571 4.53106C2.64067 4.25188 3.1773 4.13269 3.80261 4.07598C4.41874 4.02017 5.18666 4.02032 6.14929 4.02032ZM6.14929 5.37774C5.16181 5.37774 4.46634 5.37761 3.92566 5.42657C3.39434 5.47472 3.07859 5.56574 2.83582 5.70587C2.4632 5.92106 2.15354 6.2307 1.93835 6.60333C1.79823 6.8461 1.70721 7.16185 1.65906 7.69317C1.6101 8.23385 1.61023 8.92933 1.61023 9.9168C1.61023 10.9043 1.61009 11.5998 1.65906 12.1404C1.70721 12.6717 1.79823 12.9875 1.93835 13.2303C2.15356 13.6029 2.46321 13.9126 2.83582 14.1277C3.07859 14.2679 3.39434 14.3589 3.92566 14.407C4.46634 14.456 5.16182 14.4559 6.14929 14.4559C7.13682 14.4559 7.83224 14.456 8.37292 14.407C8.90425 14.3589 9.21999 14.2679 9.46277 14.1277C9.83535 13.9126 10.145 13.6029 10.3602 13.2303C10.5004 12.9875 10.5914 12.6717 10.6395 12.1404C10.6885 11.5998 10.6884 10.9043 10.6884 9.9168C10.6884 8.92934 10.6885 8.23384 10.6395 7.69317C10.5914 7.16185 10.5004 6.8461 10.3602 6.60333C10.1451 6.23071 9.83536 5.92107 9.46277 5.70587C9.21999 5.56574 8.90424 5.47472 8.37292 5.42657C7.83224 5.3776 7.13682 5.37774 6.14929 5.37774ZM9.80164 0.367975C10.7638 0.367975 11.5314 0.36788 12.1473 0.423639C12.7726 0.480307 13.3093 0.598759 13.7928 0.877741C14.3717 1.21192 14.8521 1.69355 15.1864 2.27227C15.4655 2.75574 15.5857 3.29164 15.6425 3.9168C15.6983 4.53301 15.6971 5.3016 15.6971 6.26446V7.82989C15.6971 8.29264 15.6989 8.58993 15.6649 8.84844C15.4668 10.3525 14.401 11.5738 12.9833 11.9988V10.5467C13.6973 10.1903 14.2105 9.49662 14.3192 8.67169C14.3387 8.52347 14.3407 8.3358 14.3407 7.82989V6.26446C14.3407 5.27706 14.3398 4.58149 14.2909 4.04083C14.2428 3.50968 14.1526 3.19372 14.0126 2.95098C13.7974 2.57849 13.4876 2.26869 13.1151 2.05352C12.8724 1.91347 12.5564 1.82237 12.0253 1.77423C11.4847 1.72528 10.7888 1.7254 9.80164 1.7254H7.71472C6.7562 1.72558 5.92665 2.27697 5.52332 3.07891H4.07019C4.54221 1.51132 5.9932 0.368186 7.71472 0.367975H9.80164Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;复制&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M15.3695 11.411L15.1234 12.8866C14.8869 14.3042 13.6603 15.3436 12.223 15.3436H3.77673C2.33958 15.3434 1.1128 14.3042 0.876343 12.8866L0.630249 11.411L2.05408 11.1747L2.29919 12.6493C2.41973 13.3713 3.04475 13.9001 3.77673 13.9003H12.223C12.9551 13.9002 13.58 13.3713 13.7006 12.6493L13.9457 11.1747L15.3695 11.411ZM8.72205 8.994C8.77717 8.93934 8.83792 8.88106 8.90271 8.81627L12.4828 5.23424L13.5043 6.25572L9.92224 9.8358C9.6395 10.1185 9.38763 10.3732 9.15857 10.5575C8.91892 10.7503 8.63953 10.9224 8.2865 10.9784C8.09711 11.0083 7.90363 11.0083 7.71423 10.9784C7.36106 10.9224 7.0809 10.7503 6.84119 10.5575C6.61215 10.3732 6.36022 10.1185 6.07751 9.8358L2.49646 6.25572L3.51697 5.23424L7.09705 8.81627C7.16219 8.88142 7.22331 8.94006 7.27869 8.99498V1.3065H8.72205V8.994Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;下载&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font: var(--dsl-code-block-content-font); overflow: auto; text-wrap: wrap; word-break: break-all; padding: 16px; margin-top: 0px !important; margin-bottom: 0px !important;&quot;&gt;$options&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;text&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;text&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;机密文件\n严禁外传&amp;quot;,&amp;nbsp;&amp;nbsp;//&amp;nbsp;双引号中&amp;nbsp;\n&amp;nbsp;才会换行
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;或使用&amp;nbsp;HTML：
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;&amp;#39;text&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;机密文件&amp;lt;br&amp;gt;严禁外传&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;0.2,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;font&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;GB&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;angle&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;45,];&lt;/pre&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _33882ae&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _28d7e84&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;3. 文字水印（不旋转，水平居中）&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;md-code-block md-code-block-light&quot; style=&quot;--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner); --dsl-code-block-border-radius: 12px; --dsl-code-block-banner-font: var(--dsw-font-xs-13); --dsl-code-block-content-font: var(--dsw-font-markdown-code-block); color: rgb(15, 17, 21); background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border-radius: var(--dsl-code-block-border-radius); margin: 16px 0px 11px; position: relative; font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;&gt;&lt;div class=&quot;md-code-block-banner-wrap&quot; style=&quot;top: 0px; z-index: 6; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius); position: sticky;&quot;&gt;&lt;div class=&quot;md-code-block-banner md-code-block-banner-lite&quot; style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; font: var(--dsl-code-block-banner-font); justify-content: space-between; padding: 0px; display: flex; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius);&quot;&gt;&lt;div class=&quot;_121d384&quot; style=&quot;justify-content: space-between; align-items: center; width: 740px; padding: 6px; display: flex;&quot;&gt;&lt;div class=&quot;d2a24f03&quot; style=&quot;flex-shrink: 0;&quot;&gt;&lt;span class=&quot;d813de27&quot; style=&quot;color: var(--dsw-alias-label-primary); font-family: var(--ds-font-family-code); margin-left: 8px; font-size: 12px; line-height: 18px;&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;d2a24f03 _246a029&quot; style=&quot;flex-shrink: 0; user-select: none;&quot;&gt;&lt;div class=&quot;efa13877&quot; style=&quot;height: 28px; color: var(--dsw-alias-label-secondary); align-items: center; display: flex;&quot;&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width _64bb515&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); margin-right: 2px; --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909C0.484366 13.4254 0.365184 12.8888 0.308472 12.2635C0.252649 11.6473 0.252808 10.8795 0.252808 9.9168C0.252808 8.95418 0.252664 8.18625 0.308472 7.57012C0.365184 6.94481 0.484366 6.40818 0.76355 5.92462C1.09777 5.34589 1.57839 4.86529 2.1571 4.53106C2.64067 4.25188 3.1773 4.13269 3.80261 4.07598C4.41874 4.02017 5.18666 4.02032 6.14929 4.02032ZM6.14929 5.37774C5.16181 5.37774 4.46634 5.37761 3.92566 5.42657C3.39434 5.47472 3.07859 5.56574 2.83582 5.70587C2.4632 5.92106 2.15354 6.2307 1.93835 6.60333C1.79823 6.8461 1.70721 7.16185 1.65906 7.69317C1.6101 8.23385 1.61023 8.92933 1.61023 9.9168C1.61023 10.9043 1.61009 11.5998 1.65906 12.1404C1.70721 12.6717 1.79823 12.9875 1.93835 13.2303C2.15356 13.6029 2.46321 13.9126 2.83582 14.1277C3.07859 14.2679 3.39434 14.3589 3.92566 14.407C4.46634 14.456 5.16182 14.4559 6.14929 14.4559C7.13682 14.4559 7.83224 14.456 8.37292 14.407C8.90425 14.3589 9.21999 14.2679 9.46277 14.1277C9.83535 13.9126 10.145 13.6029 10.3602 13.2303C10.5004 12.9875 10.5914 12.6717 10.6395 12.1404C10.6885 11.5998 10.6884 10.9043 10.6884 9.9168C10.6884 8.92934 10.6885 8.23384 10.6395 7.69317C10.5914 7.16185 10.5004 6.8461 10.3602 6.60333C10.1451 6.23071 9.83536 5.92107 9.46277 5.70587C9.21999 5.56574 8.90424 5.47472 8.37292 5.42657C7.83224 5.3776 7.13682 5.37774 6.14929 5.37774ZM9.80164 0.367975C10.7638 0.367975 11.5314 0.36788 12.1473 0.423639C12.7726 0.480307 13.3093 0.598759 13.7928 0.877741C14.3717 1.21192 14.8521 1.69355 15.1864 2.27227C15.4655 2.75574 15.5857 3.29164 15.6425 3.9168C15.6983 4.53301 15.6971 5.3016 15.6971 6.26446V7.82989C15.6971 8.29264 15.6989 8.58993 15.6649 8.84844C15.4668 10.3525 14.401 11.5738 12.9833 11.9988V10.5467C13.6973 10.1903 14.2105 9.49662 14.3192 8.67169C14.3387 8.52347 14.3407 8.3358 14.3407 7.82989V6.26446C14.3407 5.27706 14.3398 4.58149 14.2909 4.04083C14.2428 3.50968 14.1526 3.19372 14.0126 2.95098C13.7974 2.57849 13.4876 2.26869 13.1151 2.05352C12.8724 1.91347 12.5564 1.82237 12.0253 1.77423C11.4847 1.72528 10.7888 1.7254 9.80164 1.7254H7.71472C6.7562 1.72558 5.92665 2.27697 5.52332 3.07891H4.07019C4.54221 1.51132 5.9932 0.368186 7.71472 0.367975H9.80164Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;复制&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M15.3695 11.411L15.1234 12.8866C14.8869 14.3042 13.6603 15.3436 12.223 15.3436H3.77673C2.33958 15.3434 1.1128 14.3042 0.876343 12.8866L0.630249 11.411L2.05408 11.1747L2.29919 12.6493C2.41973 13.3713 3.04475 13.9001 3.77673 13.9003H12.223C12.9551 13.9002 13.58 13.3713 13.7006 12.6493L13.9457 11.1747L15.3695 11.411ZM8.72205 8.994C8.77717 8.93934 8.83792 8.88106 8.90271 8.81627L12.4828 5.23424L13.5043 6.25572L9.92224 9.8358C9.6395 10.1185 9.38763 10.3732 9.15857 10.5575C8.91892 10.7503 8.63953 10.9224 8.2865 10.9784C8.09711 11.0083 7.90363 11.0083 7.71423 10.9784C7.36106 10.9224 7.0809 10.7503 6.84119 10.5575C6.61215 10.3732 6.36022 10.1185 6.07751 9.8358L2.49646 6.25572L3.51697 5.23424L7.09705 8.81627C7.16219 8.88142 7.22331 8.94006 7.27869 8.99498V1.3065H8.72205V8.994Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;下载&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font: var(--dsl-code-block-content-font); overflow: auto; text-wrap: wrap; word-break: break-all; padding: 16px; margin-top: 0px !important; margin-bottom: 0px !important;&quot;&gt;$options&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;text&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;text&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;内部资料&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;0.15,&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;更淡
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;font&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;GB&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;angle&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;0,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;不旋转];&lt;/pre&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _33882ae&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _28d7e84&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;4. 图片水印（默认尺寸，左上角）&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;md-code-block md-code-block-light&quot; style=&quot;--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner); --dsl-code-block-border-radius: 12px; --dsl-code-block-banner-font: var(--dsw-font-xs-13); --dsl-code-block-content-font: var(--dsw-font-markdown-code-block); color: rgb(15, 17, 21); background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border-radius: var(--dsl-code-block-border-radius); margin: 16px 0px 11px; position: relative; font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;&gt;&lt;div class=&quot;md-code-block-banner-wrap&quot; style=&quot;top: 0px; z-index: 6; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius); position: sticky;&quot;&gt;&lt;div class=&quot;md-code-block-banner md-code-block-banner-lite&quot; style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; font: var(--dsl-code-block-banner-font); justify-content: space-between; padding: 0px; display: flex; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius);&quot;&gt;&lt;div class=&quot;_121d384&quot; style=&quot;justify-content: space-between; align-items: center; width: 740px; padding: 6px; display: flex;&quot;&gt;&lt;div class=&quot;d2a24f03&quot; style=&quot;flex-shrink: 0;&quot;&gt;&lt;span class=&quot;d813de27&quot; style=&quot;color: var(--dsw-alias-label-primary); font-family: var(--ds-font-family-code); margin-left: 8px; font-size: 12px; line-height: 18px;&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;d2a24f03 _246a029&quot; style=&quot;flex-shrink: 0; user-select: none;&quot;&gt;&lt;div class=&quot;efa13877&quot; style=&quot;height: 28px; color: var(--dsw-alias-label-secondary); align-items: center; display: flex;&quot;&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width _64bb515&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); margin-right: 2px; --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909C0.484366 13.4254 0.365184 12.8888 0.308472 12.2635C0.252649 11.6473 0.252808 10.8795 0.252808 9.9168C0.252808 8.95418 0.252664 8.18625 0.308472 7.57012C0.365184 6.94481 0.484366 6.40818 0.76355 5.92462C1.09777 5.34589 1.57839 4.86529 2.1571 4.53106C2.64067 4.25188 3.1773 4.13269 3.80261 4.07598C4.41874 4.02017 5.18666 4.02032 6.14929 4.02032ZM6.14929 5.37774C5.16181 5.37774 4.46634 5.37761 3.92566 5.42657C3.39434 5.47472 3.07859 5.56574 2.83582 5.70587C2.4632 5.92106 2.15354 6.2307 1.93835 6.60333C1.79823 6.8461 1.70721 7.16185 1.65906 7.69317C1.6101 8.23385 1.61023 8.92933 1.61023 9.9168C1.61023 10.9043 1.61009 11.5998 1.65906 12.1404C1.70721 12.6717 1.79823 12.9875 1.93835 13.2303C2.15356 13.6029 2.46321 13.9126 2.83582 14.1277C3.07859 14.2679 3.39434 14.3589 3.92566 14.407C4.46634 14.456 5.16182 14.4559 6.14929 14.4559C7.13682 14.4559 7.83224 14.456 8.37292 14.407C8.90425 14.3589 9.21999 14.2679 9.46277 14.1277C9.83535 13.9126 10.145 13.6029 10.3602 13.2303C10.5004 12.9875 10.5914 12.6717 10.6395 12.1404C10.6885 11.5998 10.6884 10.9043 10.6884 9.9168C10.6884 8.92934 10.6885 8.23384 10.6395 7.69317C10.5914 7.16185 10.5004 6.8461 10.3602 6.60333C10.1451 6.23071 9.83536 5.92107 9.46277 5.70587C9.21999 5.56574 8.90424 5.47472 8.37292 5.42657C7.83224 5.3776 7.13682 5.37774 6.14929 5.37774ZM9.80164 0.367975C10.7638 0.367975 11.5314 0.36788 12.1473 0.423639C12.7726 0.480307 13.3093 0.598759 13.7928 0.877741C14.3717 1.21192 14.8521 1.69355 15.1864 2.27227C15.4655 2.75574 15.5857 3.29164 15.6425 3.9168C15.6983 4.53301 15.6971 5.3016 15.6971 6.26446V7.82989C15.6971 8.29264 15.6989 8.58993 15.6649 8.84844C15.4668 10.3525 14.401 11.5738 12.9833 11.9988V10.5467C13.6973 10.1903 14.2105 9.49662 14.3192 8.67169C14.3387 8.52347 14.3407 8.3358 14.3407 7.82989V6.26446C14.3407 5.27706 14.3398 4.58149 14.2909 4.04083C14.2428 3.50968 14.1526 3.19372 14.0126 2.95098C13.7974 2.57849 13.4876 2.26869 13.1151 2.05352C12.8724 1.91347 12.5564 1.82237 12.0253 1.77423C11.4847 1.72528 10.7888 1.7254 9.80164 1.7254H7.71472C6.7562 1.72558 5.92665 2.27697 5.52332 3.07891H4.07019C4.54221 1.51132 5.9932 0.368186 7.71472 0.367975H9.80164Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;复制&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M15.3695 11.411L15.1234 12.8866C14.8869 14.3042 13.6603 15.3436 12.223 15.3436H3.77673C2.33958 15.3434 1.1128 14.3042 0.876343 12.8866L0.630249 11.411L2.05408 11.1747L2.29919 12.6493C2.41973 13.3713 3.04475 13.9001 3.77673 13.9003H12.223C12.9551 13.9002 13.58 13.3713 13.7006 12.6493L13.9457 11.1747L15.3695 11.411ZM8.72205 8.994C8.77717 8.93934 8.83792 8.88106 8.90271 8.81627L12.4828 5.23424L13.5043 6.25572L9.92224 9.8358C9.6395 10.1185 9.38763 10.3732 9.15857 10.5575C8.91892 10.7503 8.63953 10.9224 8.2865 10.9784C8.09711 11.0083 7.90363 11.0083 7.71423 10.9784C7.36106 10.9224 7.0809 10.7503 6.84119 10.5575C6.61215 10.3732 6.36022 10.1185 6.07751 9.8358L2.49646 6.25572L3.51697 5.23424L7.09705 8.81627C7.16219 8.88142 7.22331 8.94006 7.27869 8.99498V1.3065H8.72205V8.994Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;下载&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font: var(--dsl-code-block-content-font); overflow: auto; text-wrap: wrap; word-break: break-all; padding: 16px; margin-top: 0px !important; margin-bottom: 0px !important;&quot;&gt;$options&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;image&amp;#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;必填：指定图片水印
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;image&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;/static/watermark.png&amp;#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;必填：相对&amp;nbsp;public&amp;nbsp;的路径
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;0.3,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;可选：透明度，默认&amp;nbsp;0.3
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;size&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;D&amp;#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;可选：默认尺寸
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;position&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;[0,&amp;nbsp;0],&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;可选：左上角];&lt;/pre&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _33882ae&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _28d7e84&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;5. 图片水印（铺满整页）&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;md-code-block md-code-block-light&quot; style=&quot;--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner); --dsl-code-block-border-radius: 12px; --dsl-code-block-banner-font: var(--dsw-font-xs-13); --dsl-code-block-content-font: var(--dsw-font-markdown-code-block); color: rgb(15, 17, 21); background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border-radius: var(--dsl-code-block-border-radius); margin: 16px 0px 11px; position: relative; font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;&gt;&lt;div class=&quot;md-code-block-banner-wrap&quot; style=&quot;top: 0px; z-index: 6; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius); position: sticky;&quot;&gt;&lt;div class=&quot;md-code-block-banner md-code-block-banner-lite&quot; style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; font: var(--dsl-code-block-banner-font); justify-content: space-between; padding: 0px; display: flex; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius);&quot;&gt;&lt;div class=&quot;_121d384&quot; style=&quot;justify-content: space-between; align-items: center; width: 740px; padding: 6px; display: flex;&quot;&gt;&lt;div class=&quot;d2a24f03&quot; style=&quot;flex-shrink: 0;&quot;&gt;&lt;span class=&quot;d813de27&quot; style=&quot;color: var(--dsw-alias-label-primary); font-family: var(--ds-font-family-code); margin-left: 8px; font-size: 12px; line-height: 18px;&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;d2a24f03 _246a029&quot; style=&quot;flex-shrink: 0; user-select: none;&quot;&gt;&lt;div class=&quot;efa13877&quot; style=&quot;height: 28px; color: var(--dsw-alias-label-secondary); align-items: center; display: flex;&quot;&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width _64bb515&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); margin-right: 2px; --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909C0.484366 13.4254 0.365184 12.8888 0.308472 12.2635C0.252649 11.6473 0.252808 10.8795 0.252808 9.9168C0.252808 8.95418 0.252664 8.18625 0.308472 7.57012C0.365184 6.94481 0.484366 6.40818 0.76355 5.92462C1.09777 5.34589 1.57839 4.86529 2.1571 4.53106C2.64067 4.25188 3.1773 4.13269 3.80261 4.07598C4.41874 4.02017 5.18666 4.02032 6.14929 4.02032ZM6.14929 5.37774C5.16181 5.37774 4.46634 5.37761 3.92566 5.42657C3.39434 5.47472 3.07859 5.56574 2.83582 5.70587C2.4632 5.92106 2.15354 6.2307 1.93835 6.60333C1.79823 6.8461 1.70721 7.16185 1.65906 7.69317C1.6101 8.23385 1.61023 8.92933 1.61023 9.9168C1.61023 10.9043 1.61009 11.5998 1.65906 12.1404C1.70721 12.6717 1.79823 12.9875 1.93835 13.2303C2.15356 13.6029 2.46321 13.9126 2.83582 14.1277C3.07859 14.2679 3.39434 14.3589 3.92566 14.407C4.46634 14.456 5.16182 14.4559 6.14929 14.4559C7.13682 14.4559 7.83224 14.456 8.37292 14.407C8.90425 14.3589 9.21999 14.2679 9.46277 14.1277C9.83535 13.9126 10.145 13.6029 10.3602 13.2303C10.5004 12.9875 10.5914 12.6717 10.6395 12.1404C10.6885 11.5998 10.6884 10.9043 10.6884 9.9168C10.6884 8.92934 10.6885 8.23384 10.6395 7.69317C10.5914 7.16185 10.5004 6.8461 10.3602 6.60333C10.1451 6.23071 9.83536 5.92107 9.46277 5.70587C9.21999 5.56574 8.90424 5.47472 8.37292 5.42657C7.83224 5.3776 7.13682 5.37774 6.14929 5.37774ZM9.80164 0.367975C10.7638 0.367975 11.5314 0.36788 12.1473 0.423639C12.7726 0.480307 13.3093 0.598759 13.7928 0.877741C14.3717 1.21192 14.8521 1.69355 15.1864 2.27227C15.4655 2.75574 15.5857 3.29164 15.6425 3.9168C15.6983 4.53301 15.6971 5.3016 15.6971 6.26446V7.82989C15.6971 8.29264 15.6989 8.58993 15.6649 8.84844C15.4668 10.3525 14.401 11.5738 12.9833 11.9988V10.5467C13.6973 10.1903 14.2105 9.49662 14.3192 8.67169C14.3387 8.52347 14.3407 8.3358 14.3407 7.82989V6.26446C14.3407 5.27706 14.3398 4.58149 14.2909 4.04083C14.2428 3.50968 14.1526 3.19372 14.0126 2.95098C13.7974 2.57849 13.4876 2.26869 13.1151 2.05352C12.8724 1.91347 12.5564 1.82237 12.0253 1.77423C11.4847 1.72528 10.7888 1.7254 9.80164 1.7254H7.71472C6.7562 1.72558 5.92665 2.27697 5.52332 3.07891H4.07019C4.54221 1.51132 5.9932 0.368186 7.71472 0.367975H9.80164Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;复制&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M15.3695 11.411L15.1234 12.8866C14.8869 14.3042 13.6603 15.3436 12.223 15.3436H3.77673C2.33958 15.3434 1.1128 14.3042 0.876343 12.8866L0.630249 11.411L2.05408 11.1747L2.29919 12.6493C2.41973 13.3713 3.04475 13.9001 3.77673 13.9003H12.223C12.9551 13.9002 13.58 13.3713 13.7006 12.6493L13.9457 11.1747L15.3695 11.411ZM8.72205 8.994C8.77717 8.93934 8.83792 8.88106 8.90271 8.81627L12.4828 5.23424L13.5043 6.25572L9.92224 9.8358C9.6395 10.1185 9.38763 10.3732 9.15857 10.5575C8.91892 10.7503 8.63953 10.9224 8.2865 10.9784C8.09711 11.0083 7.90363 11.0083 7.71423 10.9784C7.36106 10.9224 7.0809 10.7503 6.84119 10.5575C6.61215 10.3732 6.36022 10.1185 6.07751 9.8358L2.49646 6.25572L3.51697 5.23424L7.09705 8.81627C7.16219 8.88142 7.22331 8.94006 7.27869 8.99498V1.3065H8.72205V8.994Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;下载&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font: var(--dsl-code-block-content-font); overflow: auto; text-wrap: wrap; word-break: break-all; padding: 16px; margin-top: 0px !important; margin-bottom: 0px !important;&quot;&gt;$options&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;image&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;image&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;/static/watermark.png&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;0.2,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;size&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;F&amp;#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;F&amp;nbsp;=&amp;nbsp;Fill，铺满整页
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;position&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;[0,&amp;nbsp;0],];&lt;/pre&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _33882ae&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _28d7e84&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;6. 图片水印（自定义尺寸，页面居中）&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;md-code-block md-code-block-light&quot; style=&quot;--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner); --dsl-code-block-border-radius: 12px; --dsl-code-block-banner-font: var(--dsw-font-xs-13); --dsl-code-block-content-font: var(--dsw-font-markdown-code-block); color: rgb(15, 17, 21); background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border-radius: var(--dsl-code-block-border-radius); margin: 16px 0px 11px; position: relative; font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;&gt;&lt;div class=&quot;md-code-block-banner-wrap&quot; style=&quot;top: 0px; z-index: 6; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius); position: sticky;&quot;&gt;&lt;div class=&quot;md-code-block-banner md-code-block-banner-lite&quot; style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; font: var(--dsl-code-block-banner-font); justify-content: space-between; padding: 0px; display: flex; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius);&quot;&gt;&lt;div class=&quot;_121d384&quot; style=&quot;justify-content: space-between; align-items: center; width: 740px; padding: 6px; display: flex;&quot;&gt;&lt;div class=&quot;d2a24f03&quot; style=&quot;flex-shrink: 0;&quot;&gt;&lt;span class=&quot;d813de27&quot; style=&quot;color: var(--dsw-alias-label-primary); font-family: var(--ds-font-family-code); margin-left: 8px; font-size: 12px; line-height: 18px;&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;d2a24f03 _246a029&quot; style=&quot;flex-shrink: 0; user-select: none;&quot;&gt;&lt;div class=&quot;efa13877&quot; style=&quot;height: 28px; color: var(--dsw-alias-label-secondary); align-items: center; display: flex;&quot;&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width _64bb515&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); margin-right: 2px; --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909C0.484366 13.4254 0.365184 12.8888 0.308472 12.2635C0.252649 11.6473 0.252808 10.8795 0.252808 9.9168C0.252808 8.95418 0.252664 8.18625 0.308472 7.57012C0.365184 6.94481 0.484366 6.40818 0.76355 5.92462C1.09777 5.34589 1.57839 4.86529 2.1571 4.53106C2.64067 4.25188 3.1773 4.13269 3.80261 4.07598C4.41874 4.02017 5.18666 4.02032 6.14929 4.02032ZM6.14929 5.37774C5.16181 5.37774 4.46634 5.37761 3.92566 5.42657C3.39434 5.47472 3.07859 5.56574 2.83582 5.70587C2.4632 5.92106 2.15354 6.2307 1.93835 6.60333C1.79823 6.8461 1.70721 7.16185 1.65906 7.69317C1.6101 8.23385 1.61023 8.92933 1.61023 9.9168C1.61023 10.9043 1.61009 11.5998 1.65906 12.1404C1.70721 12.6717 1.79823 12.9875 1.93835 13.2303C2.15356 13.6029 2.46321 13.9126 2.83582 14.1277C3.07859 14.2679 3.39434 14.3589 3.92566 14.407C4.46634 14.456 5.16182 14.4559 6.14929 14.4559C7.13682 14.4559 7.83224 14.456 8.37292 14.407C8.90425 14.3589 9.21999 14.2679 9.46277 14.1277C9.83535 13.9126 10.145 13.6029 10.3602 13.2303C10.5004 12.9875 10.5914 12.6717 10.6395 12.1404C10.6885 11.5998 10.6884 10.9043 10.6884 9.9168C10.6884 8.92934 10.6885 8.23384 10.6395 7.69317C10.5914 7.16185 10.5004 6.8461 10.3602 6.60333C10.1451 6.23071 9.83536 5.92107 9.46277 5.70587C9.21999 5.56574 8.90424 5.47472 8.37292 5.42657C7.83224 5.3776 7.13682 5.37774 6.14929 5.37774ZM9.80164 0.367975C10.7638 0.367975 11.5314 0.36788 12.1473 0.423639C12.7726 0.480307 13.3093 0.598759 13.7928 0.877741C14.3717 1.21192 14.8521 1.69355 15.1864 2.27227C15.4655 2.75574 15.5857 3.29164 15.6425 3.9168C15.6983 4.53301 15.6971 5.3016 15.6971 6.26446V7.82989C15.6971 8.29264 15.6989 8.58993 15.6649 8.84844C15.4668 10.3525 14.401 11.5738 12.9833 11.9988V10.5467C13.6973 10.1903 14.2105 9.49662 14.3192 8.67169C14.3387 8.52347 14.3407 8.3358 14.3407 7.82989V6.26446C14.3407 5.27706 14.3398 4.58149 14.2909 4.04083C14.2428 3.50968 14.1526 3.19372 14.0126 2.95098C13.7974 2.57849 13.4876 2.26869 13.1151 2.05352C12.8724 1.91347 12.5564 1.82237 12.0253 1.77423C11.4847 1.72528 10.7888 1.7254 9.80164 1.7254H7.71472C6.7562 1.72558 5.92665 2.27697 5.52332 3.07891H4.07019C4.54221 1.51132 5.9932 0.368186 7.71472 0.367975H9.80164Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;复制&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M15.3695 11.411L15.1234 12.8866C14.8869 14.3042 13.6603 15.3436 12.223 15.3436H3.77673C2.33958 15.3434 1.1128 14.3042 0.876343 12.8866L0.630249 11.411L2.05408 11.1747L2.29919 12.6493C2.41973 13.3713 3.04475 13.9001 3.77673 13.9003H12.223C12.9551 13.9002 13.58 13.3713 13.7006 12.6493L13.9457 11.1747L15.3695 11.411ZM8.72205 8.994C8.77717 8.93934 8.83792 8.88106 8.90271 8.81627L12.4828 5.23424L13.5043 6.25572L9.92224 9.8358C9.6395 10.1185 9.38763 10.3732 9.15857 10.5575C8.91892 10.7503 8.63953 10.9224 8.2865 10.9784C8.09711 11.0083 7.90363 11.0083 7.71423 10.9784C7.36106 10.9224 7.0809 10.7503 6.84119 10.5575C6.61215 10.3732 6.36022 10.1185 6.07751 9.8358L2.49646 6.25572L3.51697 5.23424L7.09705 8.81627C7.16219 8.88142 7.22331 8.94006 7.27869 8.99498V1.3065H8.72205V8.994Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;下载&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font: var(--dsl-code-block-content-font); overflow: auto; text-wrap: wrap; word-break: break-all; padding: 16px; margin-top: 0px !important; margin-bottom: 0px !important;&quot;&gt;$options&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;image&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;image&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;/static/watermark.png&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;0.3,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;size&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;[50,&amp;nbsp;50],&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;宽&amp;nbsp;50mm，高&amp;nbsp;50mm
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;position&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;[-25,&amp;nbsp;-25],&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;负数表示向左、向上偏移，实现居中];&lt;/pre&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _33882ae&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _28d7e84&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;7. 图片水印（适应页面）&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;md-code-block md-code-block-light&quot; style=&quot;--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner); --dsl-code-block-border-radius: 12px; --dsl-code-block-banner-font: var(--dsw-font-xs-13); --dsl-code-block-content-font: var(--dsw-font-markdown-code-block); color: rgb(15, 17, 21); background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border-radius: var(--dsl-code-block-border-radius); margin: 16px 0px 11px; position: relative; font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;&gt;&lt;div class=&quot;md-code-block-banner-wrap&quot; style=&quot;top: 0px; z-index: 6; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius); position: sticky;&quot;&gt;&lt;div class=&quot;md-code-block-banner md-code-block-banner-lite&quot; style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; font: var(--dsl-code-block-banner-font); justify-content: space-between; padding: 0px; display: flex; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius);&quot;&gt;&lt;div class=&quot;_121d384&quot; style=&quot;justify-content: space-between; align-items: center; width: 740px; padding: 6px; display: flex;&quot;&gt;&lt;div class=&quot;d2a24f03&quot; style=&quot;flex-shrink: 0;&quot;&gt;&lt;span class=&quot;d813de27&quot; style=&quot;color: var(--dsw-alias-label-primary); font-family: var(--ds-font-family-code); margin-left: 8px; font-size: 12px; line-height: 18px;&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;d2a24f03 _246a029&quot; style=&quot;flex-shrink: 0; user-select: none;&quot;&gt;&lt;div class=&quot;efa13877&quot; style=&quot;height: 28px; color: var(--dsw-alias-label-secondary); align-items: center; display: flex;&quot;&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width _64bb515&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); margin-right: 2px; --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909C0.484366 13.4254 0.365184 12.8888 0.308472 12.2635C0.252649 11.6473 0.252808 10.8795 0.252808 9.9168C0.252808 8.95418 0.252664 8.18625 0.308472 7.57012C0.365184 6.94481 0.484366 6.40818 0.76355 5.92462C1.09777 5.34589 1.57839 4.86529 2.1571 4.53106C2.64067 4.25188 3.1773 4.13269 3.80261 4.07598C4.41874 4.02017 5.18666 4.02032 6.14929 4.02032ZM6.14929 5.37774C5.16181 5.37774 4.46634 5.37761 3.92566 5.42657C3.39434 5.47472 3.07859 5.56574 2.83582 5.70587C2.4632 5.92106 2.15354 6.2307 1.93835 6.60333C1.79823 6.8461 1.70721 7.16185 1.65906 7.69317C1.6101 8.23385 1.61023 8.92933 1.61023 9.9168C1.61023 10.9043 1.61009 11.5998 1.65906 12.1404C1.70721 12.6717 1.79823 12.9875 1.93835 13.2303C2.15356 13.6029 2.46321 13.9126 2.83582 14.1277C3.07859 14.2679 3.39434 14.3589 3.92566 14.407C4.46634 14.456 5.16182 14.4559 6.14929 14.4559C7.13682 14.4559 7.83224 14.456 8.37292 14.407C8.90425 14.3589 9.21999 14.2679 9.46277 14.1277C9.83535 13.9126 10.145 13.6029 10.3602 13.2303C10.5004 12.9875 10.5914 12.6717 10.6395 12.1404C10.6885 11.5998 10.6884 10.9043 10.6884 9.9168C10.6884 8.92934 10.6885 8.23384 10.6395 7.69317C10.5914 7.16185 10.5004 6.8461 10.3602 6.60333C10.1451 6.23071 9.83536 5.92107 9.46277 5.70587C9.21999 5.56574 8.90424 5.47472 8.37292 5.42657C7.83224 5.3776 7.13682 5.37774 6.14929 5.37774ZM9.80164 0.367975C10.7638 0.367975 11.5314 0.36788 12.1473 0.423639C12.7726 0.480307 13.3093 0.598759 13.7928 0.877741C14.3717 1.21192 14.8521 1.69355 15.1864 2.27227C15.4655 2.75574 15.5857 3.29164 15.6425 3.9168C15.6983 4.53301 15.6971 5.3016 15.6971 6.26446V7.82989C15.6971 8.29264 15.6989 8.58993 15.6649 8.84844C15.4668 10.3525 14.401 11.5738 12.9833 11.9988V10.5467C13.6973 10.1903 14.2105 9.49662 14.3192 8.67169C14.3387 8.52347 14.3407 8.3358 14.3407 7.82989V6.26446C14.3407 5.27706 14.3398 4.58149 14.2909 4.04083C14.2428 3.50968 14.1526 3.19372 14.0126 2.95098C13.7974 2.57849 13.4876 2.26869 13.1151 2.05352C12.8724 1.91347 12.5564 1.82237 12.0253 1.77423C11.4847 1.72528 10.7888 1.7254 9.80164 1.7254H7.71472C6.7562 1.72558 5.92665 2.27697 5.52332 3.07891H4.07019C4.54221 1.51132 5.9932 0.368186 7.71472 0.367975H9.80164Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;复制&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M15.3695 11.411L15.1234 12.8866C14.8869 14.3042 13.6603 15.3436 12.223 15.3436H3.77673C2.33958 15.3434 1.1128 14.3042 0.876343 12.8866L0.630249 11.411L2.05408 11.1747L2.29919 12.6493C2.41973 13.3713 3.04475 13.9001 3.77673 13.9003H12.223C12.9551 13.9002 13.58 13.3713 13.7006 12.6493L13.9457 11.1747L15.3695 11.411ZM8.72205 8.994C8.77717 8.93934 8.83792 8.88106 8.90271 8.81627L12.4828 5.23424L13.5043 6.25572L9.92224 9.8358C9.6395 10.1185 9.38763 10.3732 9.15857 10.5575C8.91892 10.7503 8.63953 10.9224 8.2865 10.9784C8.09711 11.0083 7.90363 11.0083 7.71423 10.9784C7.36106 10.9224 7.0809 10.7503 6.84119 10.5575C6.61215 10.3732 6.36022 10.1185 6.07751 9.8358L2.49646 6.25572L3.51697 5.23424L7.09705 8.81627C7.16219 8.88142 7.22331 8.94006 7.27869 8.99498V1.3065H8.72205V8.994Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;下载&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font: var(--dsl-code-block-content-font); overflow: auto; text-wrap: wrap; word-break: break-all; padding: 16px; margin-top: 0px !important; margin-bottom: 0px !important;&quot;&gt;$options&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;image&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;image&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;/static/watermark.png&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;0.3,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;size&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;P&amp;#39;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;P&amp;nbsp;=&amp;nbsp;Page，缩放到适应页面
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;position&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;[0,&amp;nbsp;0],];&lt;/pre&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _33882ae&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _28d7e84&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;hr style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border: none; height: 1px; margin: 32px 0px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;三、参数详解&lt;/span&gt;&lt;/h2&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: inherit;&quot;&gt;type&lt;/code&gt;&lt;/h3&gt;&lt;ul style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;必填&lt;/span&gt;&lt;span class=&quot;&quot;&gt;，只能是&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;text&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;或&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;image&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;决定使用哪一组参数，另一组参数会被忽略。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;如果传了其他值，&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;PdfService&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;会抛出&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;ValidateException&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: inherit;&quot;&gt;text&lt;/code&gt;&lt;/h3&gt;&lt;ul style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;文字水印内容。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 8px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;多行写法&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;list-style-type: square;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;quot;第一行\n第二行&amp;quot;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;—— 双引号中的&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;\n&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;会换行；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;第一行&amp;lt;br&amp;gt;第二行&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;—— HTML 标签也可以，mPDF 内部会解析。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;单引号中的&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;\n&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;是字面量，不会换行，请务必用双引号。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: inherit;&quot;&gt;alpha&lt;/code&gt;&lt;span class=&quot;&quot;&gt;（文字和图片共用）&lt;/span&gt;&lt;/h3&gt;&lt;ul style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;透明度，范围&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;0 ~ 1&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;0&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;= 完全透明（看不见），&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;1&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;= 完全不透明。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;文字默认&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;0.2&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，图片默认&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;0.3&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;建议文字水印用&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;0.1 ~ 0.3&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，图片水印用&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;0.2 ~ 0.4&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，避免遮住正文。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: inherit;&quot;&gt;font&lt;/code&gt;&lt;/h3&gt;&lt;ul style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;仅文字水印使用。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 8px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;mPDF 内置字体名，中文水印推荐：&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;list-style-type: square;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;GB&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：常用中文字体，兼容性好；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;sun-exta&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;/&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;sun-extb&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：支持扩展字符（含 SIP）；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;dejavusans&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：Unicode 通用字体，但中文可能显示方框。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;如果水印中文显示方框，先改&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;GB&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，不行再换&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;sun-exta&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: inherit;&quot;&gt;angle&lt;/code&gt;&lt;/h3&gt;&lt;ul style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;仅文字水印使用，单位为度。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;0&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;= 水平，&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;45&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;= 逆时针倾斜 45°（默认），&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;90&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;= 垂直。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;需要 mPDF 7.0+ 才支持&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;watermarkAngle&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，你用的 8.2.7 完全支持。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: inherit;&quot;&gt;image&lt;/code&gt;&lt;/h3&gt;&lt;ul style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;仅图片水印使用。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 8px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;支持两种路径：&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;list-style-type: square;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;&lt;span class=&quot;&quot;&gt;相对&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;public&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;目录&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;/static/watermark.png&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;绝对路径&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;/var/www/html/public/static/watermark.png&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;建议用相对&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;public&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;的写法，方便迁移。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;推荐 PNG 透明背景图，JPG 也可以但效果略差。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: inherit;&quot;&gt;size&lt;/code&gt;&lt;/h3&gt;&lt;ul style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 8px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;仅图片水印使用，控制水印尺寸：&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;list-style-type: square;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;D&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;Default&lt;/span&gt;&lt;span class=&quot;&quot;&gt;，图片原始尺寸（默认值）；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;P&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;Page&lt;/span&gt;&lt;span class=&quot;&quot;&gt;，缩放到适应整页；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;F&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;Fill&lt;/span&gt;&lt;span class=&quot;&quot;&gt;，拉伸铺满整页；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;[width, height]&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：自定义尺寸，单位&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;mm&lt;/span&gt;&lt;span class=&quot;&quot;&gt;，如&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;[50, 50]&lt;/code&gt;&lt;span class=&quot;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;需要铺满整页做背景时用&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;F&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;；需要精确控制大小时用数组。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-optical-sizing: inherit; font-kerning: inherit; font-feature-settings: inherit; font-variation-settings: inherit; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: inherit;&quot;&gt;position&lt;/code&gt;&lt;/h3&gt;&lt;ul style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 8px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;仅图片水印使用，水印位置&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;[x, y]&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;list-style-type: square;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;单位&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;mm&lt;/span&gt;&lt;span class=&quot;&quot;&gt;；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;[0, 0]&lt;/code&gt;&lt;span class=&quot;&quot;&gt;：左上角；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;负数表示向上、向左偏移，如&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;[-25, -25]&lt;/code&gt;&lt;span class=&quot;&quot;&gt;；&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;想要页面居中，可用负数偏移图片尺寸的一半。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;注意：mPDF 的坐标原点在左上角，y 轴向下为正。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border: none; height: 1px; margin: 32px 0px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;四、完整集成示例（PdfService 调用）&lt;/span&gt;&lt;/h2&gt;&lt;div class=&quot;md-code-block md-code-block-light&quot; style=&quot;--dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner); --dsl-code-block-border-radius: 12px; --dsl-code-block-banner-font: var(--dsw-font-xs-13); --dsl-code-block-content-font: var(--dsw-font-markdown-code-block); color: rgb(15, 17, 21); background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border-radius: var(--dsl-code-block-border-radius); margin: 16px 0px 11px; position: relative; font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;&gt;&lt;div class=&quot;md-code-block-banner-wrap&quot; style=&quot;top: 0px; z-index: 6; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius); position: sticky;&quot;&gt;&lt;div class=&quot;md-code-block-banner md-code-block-banner-lite&quot; style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; font: var(--dsl-code-block-banner-font); justify-content: space-between; padding: 0px; display: flex; border-top-left-radius: var(--dsl-code-block-border-radius); border-top-right-radius: var(--dsl-code-block-border-radius);&quot;&gt;&lt;div class=&quot;_121d384&quot; style=&quot;justify-content: space-between; align-items: center; width: 740px; padding: 6px; display: flex;&quot;&gt;&lt;div class=&quot;d2a24f03&quot; style=&quot;flex-shrink: 0;&quot;&gt;&lt;span class=&quot;d813de27&quot; style=&quot;color: var(--dsw-alias-label-primary); font-family: var(--ds-font-family-code); margin-left: 8px; font-size: 12px; line-height: 18px;&quot;&gt;php&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;d2a24f03 _246a029&quot; style=&quot;flex-shrink: 0; user-select: none;&quot;&gt;&lt;div class=&quot;efa13877&quot; style=&quot;height: 28px; color: var(--dsw-alias-label-secondary); align-items: center; display: flex;&quot;&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width _64bb515&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); margin-right: 2px; --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M6.14929 4.02032C7.11197 4.02032 7.87983 4.02016 8.49597 4.07598C9.12128 4.13269 9.65792 4.25188 10.1415 4.53106C10.7202 4.8653 11.2008 5.3459 11.535 5.92462C11.8142 6.40818 11.9334 6.94481 11.9901 7.57012C12.0459 8.18625 12.0458 8.95419 12.0458 9.9168C12.0458 10.8795 12.0459 11.6473 11.9901 12.2635C11.9334 12.8888 11.8142 13.4254 11.535 13.909C11.2008 14.4877 10.7202 14.9683 10.1415 15.3025C9.65792 15.5817 9.12128 15.7009 8.49597 15.7576C7.87984 15.8134 7.11196 15.8133 6.14929 15.8133C5.18667 15.8133 4.41874 15.8134 3.80261 15.7576C3.1773 15.7009 2.64067 15.5817 2.1571 15.3025C1.5784 14.9683 1.09778 14.4877 0.76355 13.909C0.484366 13.4254 0.365184 12.8888 0.308472 12.2635C0.252649 11.6473 0.252808 10.8795 0.252808 9.9168C0.252808 8.95418 0.252664 8.18625 0.308472 7.57012C0.365184 6.94481 0.484366 6.40818 0.76355 5.92462C1.09777 5.34589 1.57839 4.86529 2.1571 4.53106C2.64067 4.25188 3.1773 4.13269 3.80261 4.07598C4.41874 4.02017 5.18666 4.02032 6.14929 4.02032ZM6.14929 5.37774C5.16181 5.37774 4.46634 5.37761 3.92566 5.42657C3.39434 5.47472 3.07859 5.56574 2.83582 5.70587C2.4632 5.92106 2.15354 6.2307 1.93835 6.60333C1.79823 6.8461 1.70721 7.16185 1.65906 7.69317C1.6101 8.23385 1.61023 8.92933 1.61023 9.9168C1.61023 10.9043 1.61009 11.5998 1.65906 12.1404C1.70721 12.6717 1.79823 12.9875 1.93835 13.2303C2.15356 13.6029 2.46321 13.9126 2.83582 14.1277C3.07859 14.2679 3.39434 14.3589 3.92566 14.407C4.46634 14.456 5.16182 14.4559 6.14929 14.4559C7.13682 14.4559 7.83224 14.456 8.37292 14.407C8.90425 14.3589 9.21999 14.2679 9.46277 14.1277C9.83535 13.9126 10.145 13.6029 10.3602 13.2303C10.5004 12.9875 10.5914 12.6717 10.6395 12.1404C10.6885 11.5998 10.6884 10.9043 10.6884 9.9168C10.6884 8.92934 10.6885 8.23384 10.6395 7.69317C10.5914 7.16185 10.5004 6.8461 10.3602 6.60333C10.1451 6.23071 9.83536 5.92107 9.46277 5.70587C9.21999 5.56574 8.90424 5.47472 8.37292 5.42657C7.83224 5.3776 7.13682 5.37774 6.14929 5.37774ZM9.80164 0.367975C10.7638 0.367975 11.5314 0.36788 12.1473 0.423639C12.7726 0.480307 13.3093 0.598759 13.7928 0.877741C14.3717 1.21192 14.8521 1.69355 15.1864 2.27227C15.4655 2.75574 15.5857 3.29164 15.6425 3.9168C15.6983 4.53301 15.6971 5.3016 15.6971 6.26446V7.82989C15.6971 8.29264 15.6989 8.58993 15.6649 8.84844C15.4668 10.3525 14.401 11.5738 12.9833 11.9988V10.5467C13.6973 10.1903 14.2105 9.49662 14.3192 8.67169C14.3387 8.52347 14.3407 8.3358 14.3407 7.82989V6.26446C14.3407 5.27706 14.3398 4.58149 14.2909 4.04083C14.2428 3.50968 14.1526 3.19372 14.0126 2.95098C13.7974 2.57849 13.4876 2.26869 13.1151 2.05352C12.8724 1.91347 12.5564 1.82237 12.0253 1.77423C11.4847 1.72528 10.7888 1.7254 9.80164 1.7254H7.71472C6.7562 1.72558 5.92665 2.27697 5.52332 3.07891H4.07019C4.54221 1.51132 5.9932 0.368186 7.71472 0.367975H9.80164Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;复制&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div role=&quot;button&quot; class=&quot;ds-button ds-button--borderlessNeutral ds-button--borderless ds-button--capsule ds-button--xs ds-button--icon-relative-m ds-button--min-width&quot; tabindex=&quot;0&quot; style=&quot;--dsl-button-border-radius: 4096px; --dsl-button-box-shadow: none; --dsl-button-color: transparent; --dsl-button-color-hover: var(--dsw-alias-interactive-bg-hover); --dsl-button-border-color: transparent; --dsl-button-text-color: var(--dsw-alias-label-secondary); --dsl-button-ring-color: var(--dsw-alias-button-primary-fill); --dsl-button-text-color-hover: var(--dsl-button-text-color); --dsl-button-text-color-loading: var(--dsl-button-text-color); --dsl-button-text-color-disabled: var(--dsl-button-text-color); --dsl-button-opacity-disabled: .45; --dsl-button-font-weight: 500; height: var(--dsl-button-height); line-height: var(--dsl-button-line-height); font-size: var(--dsl-button-font-size); font-weight: var(--dsl-button-font-weight); border-radius: var(--dsl-button-border-radius); box-shadow: var(--dsl-button-box-shadow); padding: var(--dsl-button-padding); user-select: none; cursor: pointer; text-wrap: nowrap; box-sizing: border-box; transition: opacity var(--ds-transition-duration) var(--ds-ease-in-out), color var(--ds-transition-duration-slow) var(--ds-ease-in-out), text-decoration-color var(--ds-transition-duration-slow) var(--ds-ease-in-out); font-variant-numeric: tabular-nums; align-items: center; gap: var(--dsl-button-icon-gap); outline: none; justify-content: center; display: inline-flex; position: relative; color: var(--dsl-button-text-color); --dsl-button-height: var(--ds-control-height-xs); --dsl-button-font-size: var(--dsw-font-xs-13-font-size); --dsl-button-line-height: var(--dsw-font-xs-13-line-height); --dsl-button-padding: 0 10px; --dsl-button-icon-size: 14px; --dsl-button-icon-gap: 3px; --dsl-button-min-width: 58px; min-width: var(--dsl-button-min-width); flex-shrink: 0;&quot;&gt;&lt;div class=&quot;ds-button__background&quot; style=&quot;box-sizing: border-box; border-radius: inherit; transition: background-color var(--ds-transition-duration) var(--ds-ease-in-out); position: absolute; inset: 0px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-button__icon&quot; style=&quot;line-height: 0; font-size: var(--dsl-button-icon-size); width: var(--dsl-button-icon-size); height: var(--dsl-button-icon-size); color: var(--dsl-button-text-color); transition: color var(--ds-transition-duration-slow) var(--ds-ease-in-out); flex-grow: 0; flex-shrink: 0; justify-content: center; align-items: center; display: flex; position: relative;&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewbox=&quot;0 0 16 16&quot; fill=&quot;none&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;M15.3695 11.411L15.1234 12.8866C14.8869 14.3042 13.6603 15.3436 12.223 15.3436H3.77673C2.33958 15.3434 1.1128 14.3042 0.876343 12.8866L0.630249 11.411L2.05408 11.1747L2.29919 12.6493C2.41973 13.3713 3.04475 13.9001 3.77673 13.9003H12.223C12.9551 13.9002 13.58 13.3713 13.7006 12.6493L13.9457 11.1747L15.3695 11.411ZM8.72205 8.994C8.77717 8.93934 8.83792 8.88106 8.90271 8.81627L12.4828 5.23424L13.5043 6.25572L9.92224 9.8358C9.6395 10.1185 9.38763 10.3732 9.15857 10.5575C8.91892 10.7503 8.63953 10.9224 8.2865 10.9784C8.09711 11.0083 7.90363 11.0083 7.71423 10.9784C7.36106 10.9224 7.0809 10.7503 6.84119 10.5575C6.61215 10.3732 6.36022 10.1185 6.07751 9.8358L2.49646 6.25572L3.51697 5.23424L7.09705 8.81627C7.16219 8.88142 7.22331 8.94006 7.27869 8.99498V1.3065H8.72205V8.994Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;span class=&quot;ds-button__content&quot; style=&quot;position: relative;&quot;&gt;&lt;span class=&quot;code-info-button-text&quot;&gt;下载&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font: var(--dsl-code-block-content-font); overflow: auto; text-wrap: wrap; word-break: break-all; padding: 16px; margin-top: 0px !important; margin-bottom: 0px !important;&quot;&gt;&amp;lt;?phpnamespace&amp;nbsp;app\controller;use&amp;nbsp;app\service\PdfService;use&amp;nbsp;think\response\Json;class&amp;nbsp;PdfController{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;function&amp;nbsp;addWatermark():&amp;nbsp;Json
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$pdfPath&amp;nbsp;=&amp;nbsp;&amp;#39;storage/pdf/original.pdf&amp;#39;;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;=====&amp;nbsp;文字水印示例&amp;nbsp;=====
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$textOptions&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;text&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;text&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;机密文件\n严禁外传&amp;quot;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;0.2,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;font&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;GB&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;angle&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;45,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;];

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;=====&amp;nbsp;图片水印示例&amp;nbsp;=====
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$imageOptions&amp;nbsp;=&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;image&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;image&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;/static/watermark.png&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;alpha&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;0.3,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;size&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;D&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;position&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;[0,&amp;nbsp;0],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;];

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;根据业务选择一种
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$options&amp;nbsp;=&amp;nbsp;$textOptions;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;改成&amp;nbsp;$imageOptions&amp;nbsp;即切换为图片水印

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;try&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/**&amp;nbsp;@var&amp;nbsp;PdfService&amp;nbsp;$service&amp;nbsp;*/
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$service&amp;nbsp;=&amp;nbsp;app(PdfService::class);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$result&amp;nbsp;&amp;nbsp;=&amp;nbsp;$service-&amp;gt;addWatermark($pdfPath,&amp;nbsp;$options);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;json([
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;code&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;0,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;msg&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;水印添加成功&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;data&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;[&amp;#39;url&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;$result[&amp;#39;url&amp;#39;]],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;]);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;catch&amp;nbsp;(\Throwable&amp;nbsp;$e)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;json([&amp;#39;code&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;1,&amp;nbsp;&amp;#39;msg&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;$e-&amp;gt;getMessage()]);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}}&lt;/pre&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _33882ae&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;12&quot; height=&quot;12&quot; viewbox=&quot;0 0 12 12&quot; fill=&quot;none&quot; class=&quot;_9bc997d _28d7e84&quot;&gt;&lt;path d=&quot;M-5.24537e-07 0C-2.34843e-07 6.62742 5.37258 12 12 12L0 12L-5.24537e-07 0Z&quot; fill=&quot;currentColor&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;&lt;hr style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border: none; height: 1px; margin: 32px 0px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;五、对照速查表&lt;/span&gt;&lt;/h2&gt;&lt;div class=&quot;ds-scroll-area ds-scroll-area--show-on-focus-within ds-scroll-area--enabled _1210dd7 c03cafe9&quot; style=&quot;--dsl-scroll-area-gutters-disappear-delay: 1s; z-index: 0; position: relative; overflow: auto; scrollbar-width: none; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255); --container-height: 412px;&quot;&gt;&lt;div class=&quot;ds-scroll-area__gutters&quot; style=&quot;--dsl-scroll-area-scrollbar-bg: var(--dsw-alias-scrollbar-bg-l1); --dsl-scroll-area-scrollbar-hover: var(--dsw-alias-scrollbar-hover-l1); pointer-events: none; z-index: 1000; transition-duration: 0.1s; transition-timing-function: ease-out; transition-property: opacity; transition-delay: var(--dsl-scroll-area-gutters-disappear-delay); --container-height: 412px; position: sticky; top: 0px; left: 0px; right: 0px; width: 752px; height: 0px; opacity: 1 !important;&quot;&gt;&lt;div class=&quot;ds-scroll-area__horizontal-gutter&quot; style=&quot;position: absolute; left: 0px; right: 0px; top: calc(var(--container-height) - 14px); height: 8px;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ds-scroll-area__vertical-gutter&quot; style=&quot;position: absolute; right: 3px; top: 3px; bottom: calc(0px - var(--container-height) + 3px); width: 8px;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;table width=&quot;752&quot;&gt;&lt;thead&gt;&lt;tr class=&quot;firstRow&quot;&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;场景&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;type&lt;/span&gt;&lt;/th&gt;&lt;th style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l3); font: var(--dsw-font-markdown-table-head); border-top: none; min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px; text-align: left;&quot;&gt;&lt;span class=&quot;&quot;&gt;关键参数&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;span class=&quot;&quot;&gt;单行中文水印&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;text&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;text=&amp;#39;机密文件&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;font=&amp;#39;GB&amp;#39;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;span class=&quot;&quot;&gt;两行中文水印&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;text&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;text=&amp;quot;机密\n外传&amp;quot;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;span class=&quot;&quot;&gt;水平文字水印&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;text&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;angle=0&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;span class=&quot;&quot;&gt;极淡水印&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;text&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;/&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;image&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;alpha=0.1&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;span class=&quot;&quot;&gt;原始大小图片&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;image&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;size=&amp;#39;D&amp;#39;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;span class=&quot;&quot;&gt;铺满整页图片&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;image&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;size=&amp;#39;F&amp;#39;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;span class=&quot;&quot;&gt;自定义尺寸图片&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;image&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;size=[50,50]&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px 10px 0px;&quot;&gt;&lt;span class=&quot;&quot;&gt;图片居中&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;image&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1px solid var(--dsw-alias-border-l2); font: var(--dsw-font-markdown-table); min-width: 100px; max-width: min(30vw, 320px); padding: 10px 0px 10px 16px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 13px;&quot;&gt;position=[-25,-25]&lt;/code&gt;&lt;span class=&quot;&quot;&gt;（配合 50×50 尺寸）&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;hr style=&quot;background-image: ; background-position-x: ; background-position-y: ; background-size: ; background-repeat: ; background-attachment: ; background-origin: ; background-clip: ; border: none; height: 1px; margin: 32px 0px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; margin: 32px 0px 16px; color: rgb(15, 17, 21); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span class=&quot;&quot;&gt;六、注意事项&lt;/span&gt;&lt;/h2&gt;&lt;ol start=&quot;1&quot; style=&quot;margin-top: 16px; margin-bottom: 16px; padding-left: 18px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;\n&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;必须用双引号&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;quot;a\nb&amp;quot;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;才换行，&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;&amp;#39;a\nb&amp;#39;&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;不换行。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;文字水印颜色固定&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：mPDF 内置文字水印只能黑色半透明，需要彩色请改用图片水印（用 GD 生成彩色 PNG）。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;图片水印路径&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：推荐相对&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;public&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;目录，如&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;/static/watermark.png&lt;/code&gt;&lt;span class=&quot;&quot;&gt;，&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;PdfService&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;会自动补全为绝对路径。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;图片水印尺寸单位是 mm&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;[50, 50]&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;表示 50mm × 50mm，不是像素。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;position&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;支持负数&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：负数表示向左、向上偏移，常用于居中。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-bottom: 0px; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-weight: 600;&quot;&gt;两种水印不会同时生效&lt;/span&gt;&lt;span class=&quot;&quot;&gt;：&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;type&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;决定使用哪一组参数，另一组被忽略，符合你“二选一”的需求。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;margin-top: 16px; color: rgb(15, 17, 21); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, Cantarell, &amp;quot;Open Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255); margin-bottom: 0px !important;&quot;&gt;&lt;span class=&quot;&quot;&gt;按上面这份说明配置&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font-style: ; font-variant-ligatures: ; font-variant-caps: ; font-variant-numeric: ; font-variant-east-asian: ; font-variant-alternates: ; font-variant-position: ; font-weight: ; font-stretch: ; line-height: ; font-optical-sizing: ; font-kerning: ; font-feature-settings: ; font-variation-settings: ; font-family: var(--ds-font-family-code); background-color: var(--dsw-alias-markdown-inline-code); border-radius: 6px; align-items: center; padding: 0px 5px; display: inline-flex; font-size: 0.875em !important;&quot;&gt;options&lt;/code&gt;&lt;span class=&quot;&quot;&gt;&amp;nbsp;即可覆盖绝大多数水印场景。如果某个具体效果（比如多行行距、彩色水印）需要更精细控制，再走“GD 生成 PNG + 图片水印”的方案。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Fri, 11 Sep 2026 16:31:24 +0800</pubDate></item><item><title>uni-app如何将整个页面保存为图片，并且公众号h5中保存图片到相册</title><link>https://www.zhangkeda.com/?id=571</link><description>&lt;p style=&quot;margin-top: 0px; margin-bottom: 1em; font-size: 15px; word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.7em; overflow: auto; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; background-color: rgb(255, 255, 255);&quot;&gt;在 UniApp 中，可以通过 &lt;code style=&quot;padding: 4px 6px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; color: black; border-radius: 1px; white-space: nowrap; background: none rgb(252, 250, 250); border: none; margin: 0px 1px;&quot;&gt;html2canvas&lt;/code&gt; 的替代方案或原生 API 实现将整个页面保存为图片。由于 UniApp 跨平台特性，不同平台（如 H5、小程序）的实现方式不同。以下是具体方法：&lt;/p&gt;&lt;h3 style=&quot;margin: 30px 0px 15px; font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; line-height: 40px; color: rgb(51, 51, 51); text-rendering: optimizelegibility; font-size: 20px; border-bottom: 1px solid rgb(238, 238, 238); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;1.&amp;nbsp;&lt;strong&gt;H5 平台&lt;/strong&gt;&lt;/h3&gt;&lt;p style=&quot;margin-top: 1em; margin-bottom: 1em; font-size: 15px; word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.7em; overflow: auto; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; background-color: rgb(255, 255, 255);&quot;&gt;使用 &lt;code style=&quot;padding: 4px 6px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; color: black; border-radius: 1px; white-space: nowrap; background: none rgb(252, 250, 250); border: none; margin: 0px 1px;&quot;&gt;html2canvas&lt;/code&gt; 库捕获 DOM 并生成图片：&lt;/p&gt;&lt;pre class=&quot;prettyprint language-javascript&quot; style=&quot;padding: 0px 15px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; color: rgb(51, 51, 51); border-radius: 0px; margin: 20px -10px; line-height: 22px; word-break: break-all; overflow-wrap: break-word; text-wrap: wrap; background-color: rgb(247, 247, 247); border-width: 1px 0px; border-style: none; border-color: initial; border-image: initial; tab-size: 4;&quot;&gt;//&amp;nbsp;安装&amp;nbsp;html2canvas：npm&amp;nbsp;install&amp;nbsp;html2canvasimport&amp;nbsp;html2canvas&amp;nbsp;from&amp;nbsp;&amp;#39;html2canvas&amp;#39;;//&amp;nbsp;方法示例async&amp;nbsp;function&amp;nbsp;capturePage()&amp;nbsp;{
&amp;nbsp;&amp;nbsp;const&amp;nbsp;element&amp;nbsp;=&amp;nbsp;document.getElementById(&amp;#39;capture-area&amp;#39;);&amp;nbsp;//&amp;nbsp;指定要截图的区域
&amp;nbsp;&amp;nbsp;const&amp;nbsp;canvas&amp;nbsp;=&amp;nbsp;await&amp;nbsp;html2canvas(element,&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;useCORS:&amp;nbsp;true,&amp;nbsp;//&amp;nbsp;允许跨域图片
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;scale:&amp;nbsp;2&amp;nbsp;//&amp;nbsp;提高清晰度
&amp;nbsp;&amp;nbsp;});
&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;//&amp;nbsp;转换为图片并下载
&amp;nbsp;&amp;nbsp;const&amp;nbsp;imgData&amp;nbsp;=&amp;nbsp;canvas.toDataURL(&amp;#39;image/png&amp;#39;);
&amp;nbsp;&amp;nbsp;const&amp;nbsp;link&amp;nbsp;=&amp;nbsp;document.createElement(&amp;#39;a&amp;#39;);
&amp;nbsp;&amp;nbsp;link.href&amp;nbsp;=&amp;nbsp;imgData;
&amp;nbsp;&amp;nbsp;link.download&amp;nbsp;=&amp;nbsp;&amp;#39;page-screenshot.png&amp;#39;;
&amp;nbsp;&amp;nbsp;link.click();}&lt;/pre&gt;&lt;h3 style=&quot;margin: 30px 0px 15px; font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; line-height: 40px; color: rgb(51, 51, 51); text-rendering: optimizelegibility; font-size: 20px; border-bottom: 1px solid rgb(238, 238, 238); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;2.&amp;nbsp;&lt;strong&gt;微信小程序平台&lt;/strong&gt;&lt;/h3&gt;&lt;p style=&quot;margin-top: 1em; margin-bottom: 1em; font-size: 15px; word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.7em; overflow: auto; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; background-color: rgb(255, 255, 255);&quot;&gt;使用小程序的 &lt;code style=&quot;padding: 4px 6px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; color: black; border-radius: 1px; white-space: nowrap; background: none rgb(252, 250, 250); border: none; margin: 0px 1px;&quot;&gt;canvas&lt;/code&gt; 组件和 API：&lt;/p&gt;&lt;pre class=&quot;prettyprint language-html&quot; style=&quot;padding: 0px 15px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; color: rgb(51, 51, 51); border-radius: 0px; margin: 20px -10px; line-height: 22px; word-break: break-all; overflow-wrap: break-word; text-wrap: wrap; background-color: rgb(247, 247, 247); border-width: 1px 0px; border-style: none; border-color: initial; border-image: initial; tab-size: 4;&quot;&gt;&amp;lt;!--&amp;nbsp;在模板中添加&amp;nbsp;canvas&amp;nbsp;--&amp;gt;&amp;lt;canvas&amp;nbsp;id=&amp;quot;myCanvas&amp;quot;&amp;nbsp;canvas-id=&amp;quot;myCanvas&amp;quot;&amp;nbsp;style=&amp;quot;width:100%;height:100vh;&amp;quot;&amp;gt;&amp;lt;/canvas&amp;gt;&lt;/pre&gt;&lt;pre class=&quot;prettyprint language-javascript&quot; style=&quot;padding: 0px 15px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; color: rgb(51, 51, 51); border-radius: 0px; margin: 20px -10px; line-height: 22px; word-break: break-all; overflow-wrap: break-word; text-wrap: wrap; background-color: rgb(247, 247, 247); border-width: 1px 0px; border-style: none; border-color: initial; border-image: initial; tab-size: 4;&quot;&gt;//&amp;nbsp;在&amp;nbsp;methods&amp;nbsp;中定义方法methods:&amp;nbsp;{
&amp;nbsp;&amp;nbsp;savePageAsImage()&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;const&amp;nbsp;query&amp;nbsp;=&amp;nbsp;uni.createSelectorQuery().in(this);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;query.select(&amp;#39;#capture-area&amp;#39;).fields({&amp;nbsp;node:&amp;nbsp;true,&amp;nbsp;size:&amp;nbsp;true&amp;nbsp;}).exec(res&amp;nbsp;=&amp;gt;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;const&amp;nbsp;node&amp;nbsp;=&amp;nbsp;res[0].node;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;创建&amp;nbsp;canvas&amp;nbsp;上下文
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;const&amp;nbsp;ctx&amp;nbsp;=&amp;nbsp;uni.createCanvasContext(&amp;#39;myCanvas&amp;#39;,&amp;nbsp;this);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ctx.drawImage(node,&amp;nbsp;0,&amp;nbsp;0,&amp;nbsp;300,&amp;nbsp;200);&amp;nbsp;//&amp;nbsp;调整尺寸
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ctx.draw(false,&amp;nbsp;()&amp;nbsp;=&amp;gt;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;保存到相册
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uni.canvasToTempFilePath({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;canvasId:&amp;nbsp;&amp;#39;myCanvas&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;success:&amp;nbsp;res&amp;nbsp;=&amp;gt;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uni.saveImageToPhotosAlbum({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filePath:&amp;nbsp;res.tempFilePath,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;success:&amp;nbsp;()&amp;nbsp;=&amp;gt;&amp;nbsp;uni.showToast({&amp;nbsp;title:&amp;nbsp;&amp;#39;保存成功&amp;#39;&amp;nbsp;})
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});
&amp;nbsp;&amp;nbsp;}}&lt;/pre&gt;&lt;h3 style=&quot;margin: 30px 0px 15px; font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; line-height: 40px; color: rgb(51, 51, 51); text-rendering: optimizelegibility; font-size: 20px; border-bottom: 1px solid rgb(238, 238, 238); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;注意事项：&lt;/h3&gt;&lt;ul style=&quot;padding: 0px; margin-bottom: 10px; margin-left: 25px; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;跨平台兼容性&lt;/strong&gt;：需通过条件编译区分平台（&lt;code style=&quot;padding: 4px 6px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; color: black; border-radius: 3px; text-wrap: nowrap; background-color: rgb(252, 250, 250); border: none;&quot;&gt;#ifdef H5&lt;/code&gt;、&lt;code style=&quot;padding: 4px 6px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; color: black; border-radius: 3px; text-wrap: nowrap; background-color: rgb(252, 250, 250); border: none;&quot;&gt;#ifdef MP-WEIXIN&lt;/code&gt;）。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;权限问题&lt;/strong&gt;：小程序需用户授权相册权限（&lt;code style=&quot;padding: 4px 6px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; color: black; border-radius: 3px; text-wrap: nowrap; background-color: rgb(252, 250, 250); border: none;&quot;&gt;scope.writePhotosAlbum&lt;/code&gt;）。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;性能优化&lt;/strong&gt;：复杂页面可能渲染较慢，建议隐藏非必要元素。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;margin: 30px 0px 15px; font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; line-height: 40px; color: rgb(51, 51, 51); text-rendering: optimizelegibility; font-size: 20px; border-bottom: 1px solid rgb(238, 238, 238); text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;完整示例（H5 + 微信小程序）：&lt;/h3&gt;&lt;pre class=&quot;prettyprint language-javascript&quot; style=&quot;padding: 0px 15px; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; color: rgb(51, 51, 51); border-radius: 0px; margin: 20px -10px; line-height: 22px; word-break: break-all; overflow-wrap: break-word; text-wrap: wrap; background-color: rgb(247, 247, 247); border-width: 1px 0px; border-style: none; border-color: initial; border-image: initial; tab-size: 4;&quot;&gt;export&amp;nbsp;default&amp;nbsp;{
&amp;nbsp;&amp;nbsp;methods:&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;savePage()&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;#ifdef&amp;nbsp;H5
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.captureH5Page();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;#endif
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;#ifdef&amp;nbsp;MP-WEIXIN
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.captureMiniProgramPage();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;#endif
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;captureH5Page()&amp;nbsp;{&amp;nbsp;/*&amp;nbsp;H5&amp;nbsp;实现&amp;nbsp;*/&amp;nbsp;},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;captureMiniProgramPage()&amp;nbsp;{&amp;nbsp;/*&amp;nbsp;小程序实现&amp;nbsp;*/&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}}&lt;/pre&gt;&lt;p style=&quot;margin-top: 1em; margin-bottom: 1em; font-size: 15px; word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.7em; overflow: auto; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Luxi Sans&amp;quot;, &amp;quot;DejaVu Sans&amp;quot;, Tahoma, &amp;quot;Hiragino Sans GB&amp;quot;, STHeiti, sans-serif; background-color: rgb(255, 255, 255);&quot;&gt;通过以上方法，即可在 UniApp 中实现页面保存为图片功能。&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot; data-pm-slice=&quot;1 1 [&amp;quot;para&amp;quot;,{&amp;quot;tagName&amp;quot;:&amp;quot;p&amp;quot;,&amp;quot;attributes&amp;quot;:{},&amp;quot;namespaceURI&amp;quot;:&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;}]&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 18px;letter-spacing: 1px;font-weight: bold&quot;&gt;#&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 18px;letter-spacing: 1px;font-weight: bold&quot;&gt;技术来源&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;先说如何把&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; data-pm-slice=&quot;1 1 [&amp;quot;para&amp;quot;,{&amp;quot;tagName&amp;quot;:&amp;quot;p&amp;quot;,&amp;quot;attributes&amp;quot;:{},&amp;quot;namespaceURI&amp;quot;:&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;}]&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;整个页面变成图片，因为重新去做一个&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;canvas去塞入众多内容不如直接把&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;将整个页面保存为图片&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;用到技术来自文章：《&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;uniapp如何实现将整个页面保存为图片功能&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;》&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;section&gt;&lt;section class=&quot;code-snippet__fix code-snippet__js&quot;&gt;&lt;ul class=&quot;code-snippet__line-index code-snippet__js list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre data-lang=&quot;javascript&quot;&gt;https://bbs.itying.com/topic/690343544a7a41007019982a&lt;/pre&gt;&lt;/section&gt;&lt;/section&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;原理基本也就是把整个图片放入画布转成图片&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;H5平台&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;section class=&quot;code-snippet__fix code-snippet__js&quot;&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;pre data-lang=&quot;javascript&quot;&gt;&lt;code&gt;// 安装 html2canvas：npm install html2canvas&lt;/code&gt;&lt;code&gt;import&amp;nbsp;html2canvas&amp;nbsp;from&amp;nbsp;&amp;#39;html2canvas&amp;#39;;&lt;/code&gt;&lt;code&gt;// 方法示例&lt;/code&gt;&lt;code&gt;async&amp;nbsp;function&amp;nbsp;capturePage() {&lt;/code&gt;&lt;code&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&amp;nbsp;const&amp;nbsp;element =&amp;nbsp;document.getElementById(&amp;#39;capture-area&amp;#39;);&amp;nbsp;// 指定要截图的区域&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;const&amp;nbsp;canvas =&amp;nbsp;await&amp;nbsp;html2canvas(element, {&lt;/code&gt;&lt;code&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;useCORS:&amp;nbsp;true,&amp;nbsp;// 允许跨域图片&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;scale:&amp;nbsp;2&amp;nbsp;// 提高清晰度&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&amp;nbsp; });&lt;/code&gt;&lt;code&gt;&lt;br/&gt;&lt;/code&gt;&lt;code&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&amp;nbsp;// 转换为图片并下载&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;const&amp;nbsp;imgData = canvas.toDataURL(&amp;#39;image/png&amp;#39;);&lt;/code&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;const&amp;nbsp;link =&amp;nbsp;document.createElement(&amp;#39;a&amp;#39;);&lt;/code&gt;&lt;code&gt;&amp;nbsp; link.href&amp;nbsp;= imgData;&lt;/code&gt;&lt;code&gt;&amp;nbsp; link.download&amp;nbsp;=&amp;nbsp;&amp;#39;page-screenshot.png&amp;#39;;&lt;/code&gt;&lt;code&gt;&amp;nbsp; link.click();&lt;/code&gt;&lt;code&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/section&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;微信小程序平台&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;section class=&quot;code-snippet__fix code-snippet__js&quot;&gt;&lt;p&gt;&lt;/p&gt;&lt;ul class=&quot;code-snippet__line-index code-snippet__js list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre data-lang=&quot;xml&quot;&gt;&amp;lt;!--&amp;nbsp;在模板中添加&amp;nbsp;canvas&amp;nbsp;--&amp;gt;&amp;lt;canvas&amp;nbsp;id=&amp;quot;myCanvas&amp;quot;&amp;nbsp;canvas-id=&amp;quot;myCanvas&amp;quot;&amp;nbsp;style=&amp;quot;width:100%;height:100vh;&amp;quot;&amp;gt;&amp;lt;/canvas&amp;gt;&lt;/pre&gt;&lt;/section&gt;&lt;section class=&quot;code-snippet__fix code-snippet__js&quot;&gt;&lt;ul class=&quot;code-snippet__line-index code-snippet__js list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre data-lang=&quot;javascript&quot;&gt;&lt;code&gt;// 在 methods 中定义方法&lt;/code&gt;&lt;code&gt;methods: {&lt;/code&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;savePageAsImage() {&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;const&amp;nbsp;query = uni.createSelectorQuery().in(this);&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; query.select(&amp;#39;#capture-area&amp;#39;).fields({&amp;nbsp;node:&amp;nbsp;true,&amp;nbsp;size:&amp;nbsp;true&amp;nbsp;}).exec(res&amp;nbsp;=&amp;gt;&amp;nbsp;{&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const&amp;nbsp;node = res[0].node;&lt;/code&gt;&lt;code&gt;&lt;br/&gt;&lt;/code&gt;&lt;code&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// 创建 canvas 上下文&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const&amp;nbsp;ctx = uni.createCanvasContext(&amp;#39;myCanvas&amp;#39;,&amp;nbsp;this);&lt;/code&gt;&lt;code&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ctx.drawImage(node,&amp;nbsp;0,&amp;nbsp;0,&amp;nbsp;300,&amp;nbsp;200);&amp;nbsp;// 调整尺寸&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ctx.draw(false,&amp;nbsp;() =&amp;gt;&amp;nbsp;{&lt;/code&gt;&lt;code&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// 保存到相册&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; uni.canvasToTempFilePath({&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;canvasId:&amp;nbsp;&amp;#39;myCanvas&amp;#39;,&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;success:&amp;nbsp;res&amp;nbsp;=&amp;gt;&amp;nbsp;{&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; uni.saveImageToPhotosAlbum({&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;filePath: res.tempFilePath,&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;success:&amp;nbsp;() =&amp;gt;&amp;nbsp;uni.showToast({&amp;nbsp;title:&amp;nbsp;&amp;#39;保存成功&amp;#39;&amp;nbsp;})&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/code&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; });&lt;/code&gt;&lt;code&gt;&amp;nbsp; }&lt;/code&gt;&lt;code&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/section&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot; data-pm-slice=&quot;1 1 [&amp;quot;para&amp;quot;,{&amp;quot;tagName&amp;quot;:&amp;quot;p&amp;quot;,&amp;quot;attributes&amp;quot;:{},&amp;quot;namespaceURI&amp;quot;:&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;}]&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 18px;letter-spacing: 1px;font-weight: bold&quot;&gt;#&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; data-pm-slice=&quot;1 1 [&amp;quot;para&amp;quot;,{&amp;quot;tagName&amp;quot;:&amp;quot;p&amp;quot;,&amp;quot;attributes&amp;quot;:{},&amp;quot;namespaceURI&amp;quot;:&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;}]&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 18px;letter-spacing: 1px;font-weight: bold&quot;&gt;如何保存图片&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot; data-pm-slice=&quot;1 1 [&amp;quot;para&amp;quot;,{&amp;quot;tagName&amp;quot;:&amp;quot;p&amp;quot;,&amp;quot;attributes&amp;quot;:{},&amp;quot;namespaceURI&amp;quot;:&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;}]&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;在uni-app开发H5的环境下是无法使用&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;uni.saveImageToPhotosAlbum；在浏览器中可以直接a标签打开图片进行下载。但是在微信开发工具和公众号H5真机测试是没办法实现的&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;而&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; data-pm-slice=&quot;1 1 [&amp;quot;para&amp;quot;,{&amp;quot;tagName&amp;quot;:&amp;quot;p&amp;quot;,&amp;quot;attributes&amp;quot;:{},&amp;quot;namespaceURI&amp;quot;:&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;}]&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;canvas转成的画布是&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;Base64，也无法使用&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;uni.previewImage预览；只能通过image标签直接显示 提示用户长按保存&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;section style=&quot;text-align: center&quot;&gt;&lt;/section&gt;&lt;section class=&quot;code-snippet__fix code-snippet__js&quot;&gt;&lt;ul class=&quot;code-snippet__line-index code-snippet__js list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/section&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 18px;letter-spacing: 1px;font-weight: bold&quot;&gt;# 源码下载&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;由于代码很长，打包下载本地运行看看效果（注意需要真机才能长按保存）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span textstyle=&quot;&quot; style=&quot;font-size: 15px;letter-spacing: 1px&quot;&gt;https://www.123865.com/s/SmZtVv-fnegh&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;转：https://mp.weixin.qq.com/s/mNEuIGzcPL2n4vDQmoeSgg&lt;/p&gt;</description><pubDate>Wed, 08 Apr 2026 16:14:44 +0800</pubDate></item><item><title>抢红包系统设计</title><link>https://www.zhangkeda.com/?id=570</link><description>&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; data-pm-slice=&quot;0 0 []&quot;&gt;&lt;span leaf=&quot;&quot;&gt;实现类似微信红包的抢红包功能，支持拼手气红包、普通红包、高并发秒杀。&lt;/span&gt;&lt;/p&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;系统功能&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;核心功能：&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;1. 发红包（拼手气/普通）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;2. 抢红包&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;3. 红包详情&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;4. 红包记录&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;技术难点：&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- 高并发（1万人同时抢）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- 数据一致性（不能超发）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- 金额随机算法&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- 性能优化&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;业务规则&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h3 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 20px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;红包类型&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1. 拼手气红包&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 总金额固定（如100元）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 个数固定（如10个）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 每个金额随机&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 最小0.01元&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;2. 普通红包&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 总金额固定（如100元）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 个数固定（如10个）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 每个金额相等（10元）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 20px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;业务约束&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1. 每人只能抢一次&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;2. 红包24小时过期&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;3. 过期金额退回发送者&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;4. 最少2个红包&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;5. 单个红包最大200元&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;数据库设计&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;-- 红包表&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CREATE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TABLE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;red_packets (&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;PRIMARY&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;KEY&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;AUTO_INCREMENT,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; user_id&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;发送者&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;type&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TINYINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;1拼手气 2普通&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; total_amount&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DECIMAL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;总金额&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; total_count&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;红包个数&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; remain_amount&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DECIMAL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;剩余金额&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; remain_count&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;剩余个数&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;status&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TINYINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;1进行中 2已抢完 3已过期&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; expired_at&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;过期时间&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; created_at&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INDEX&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;idx_user (user_id),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INDEX&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;idx_status (&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;status&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INDEX&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;idx_expired (expired_at)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;-- 红包明细表&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CREATE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TABLE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;red_packet_details (&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;PRIMARY&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;KEY&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;AUTO_INCREMENT,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; packet_id&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;红包ID&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; user_id&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;领取者（NULL表示未领取）&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; amount&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DECIMAL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;金额&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; grabbed_at&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;领取时间&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; created_at&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INDEX&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;idx_packet (packet_id),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INDEX&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;idx_user (user_id)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;-- 用户账户表&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CREATE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TABLE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;user_accounts (&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;PRIMARY&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;KEY&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;AUTO_INCREMENT,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; user_id&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;UNIQUE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; balance&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DECIMAL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;余额&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;version&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;乐观锁版本号&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; updated_at&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;ON&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;UPDATE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;-- 账户流水表&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CREATE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TABLE&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;account_logs (&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;PRIMARY&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;KEY&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;AUTO_INCREMENT,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; user_id&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;type&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TINYINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;1发红包 2抢红包 3退款&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; amount&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DECIMAL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; balance&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DECIMAL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;COMMENT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;操作后余额&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; packet_id&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;BIGINT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #56B6C2;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; created_at&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DEFAULT&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;INDEX&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;idx_user (user_id)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;strong style=&quot;box-sizing: border-box; cursor: pointer; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0px; padding: 0px; border-style: none; border-width: 3px; border-color: rgba(0, 0, 0, 0.4); border-radius: 0px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;表设计要点：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul style=&quot;box-sizing: border-box; margin-top: 8px; margin-bottom: 8px; cursor: pointer; padding: 0px 0px 0px 25px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 14px;cursor: pointer;color: rgb(30, 107, 184);line-height: 1.8em;letter-spacing: 0em;background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin: 0px 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;overflow-wrap: break-word;word-break: break-all;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;red_packets&lt;/span&gt;&lt;/code&gt;&lt;span leaf=&quot;&quot;&gt;：红包主表，记录总金额和剩余金额&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 14px;cursor: pointer;color: rgb(30, 107, 184);line-height: 1.8em;letter-spacing: 0em;background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin: 0px 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;overflow-wrap: break-word;word-break: break-all;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;red_packet_details&lt;/span&gt;&lt;/code&gt;&lt;span leaf=&quot;&quot;&gt;：红包明细，预先生成所有红包&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 14px;cursor: pointer;color: rgb(30, 107, 184);line-height: 1.8em;letter-spacing: 0em;background: none left top / auto no-repeat scroll padding-box border-box rgba(27, 31, 35, 0.05);width: auto;margin: 0px 2px;padding: 2px 4px;border-style: none;border-width: 3px;border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4);border-radius: 4px;overflow-wrap: break-word;word-break: break-all;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;user_accounts.version&lt;/span&gt;&lt;/code&gt;&lt;span leaf=&quot;&quot;&gt;：乐观锁，防止并发扣款问题&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;第一步：发红包&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h3 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 20px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1.1 红包金额算法&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;App&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Services&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;RedPacketService&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;/**&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 拼手气红包算法（二倍均值法）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 原理：&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 每次抢到的金额 = 随机(0.01, 剩余平均值 * 2)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 例如：100元10个红包&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 第1个：随机(0.01, 20)，假设抢到15元&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 第2个：随机(0.01, (100-15)/9*2 = 18.89)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* ...&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 最后1个：剩余所有金额&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;generateLuckyAmounts&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(float $totalAmount, int $count)&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;array&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amounts = [];&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $remainAmount = $totalAmount;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $remainCount = $count;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;for&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($i =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;; $i &amp;lt; $count -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;; $i++) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 计算当前可抢的最大金额（剩余平均值的2倍）&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $avg = $remainAmount / $remainCount;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $max = $avg *&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 随机金额（保留2位小数）&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amount = mt_rand(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $max *&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;100&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;) /&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;100&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amount = max(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0.01&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $amount); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 最少0.01元&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amounts[] = $amount;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $remainAmount -= $amount;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $remainCount--;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 最后一个红包是剩余所有金额&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amounts[] = round($remainAmount,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$amounts;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;/**&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 普通红包算法&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;generateNormalAmounts&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(float $totalAmount, int $count)&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;array&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amount = round($totalAmount / $count,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 处理除不尽的情况&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amounts = array_fill(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $count, $amount);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $diff = $totalAmount - ($amount * $count);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($diff &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amounts[&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;] += $diff; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 第一个红包补上差额&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$amounts;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;strong style=&quot;box-sizing: border-box; cursor: pointer; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0px; padding: 0px; border-style: none; border-width: 3px; border-color: rgba(0, 0, 0, 0.4); border-radius: 0px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;算法说明：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul style=&quot;box-sizing: border-box; margin-top: 8px; margin-bottom: 8px; cursor: pointer; padding: 0px 0px 0px 25px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span class=&quot;&quot; link-id=&quot;link-1775610581037-0.02086381982167751&quot;&gt;二倍均值法&lt;/span&gt;保证了金额的随机性和公平性&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;最后一个红包拿剩余所有金额，避免精度问题&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;普通红包平均分配，第一个补差额&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 20px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1.2 发红包接口&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;App&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Http&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Controllers&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;use&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Illuminate&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Http&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Request&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;use&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Illuminate&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Support&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Facades&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DB&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;RedPacketController&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;extends&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Controller&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;RedPacketService $service;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;__construct&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(RedPacketService $service)&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;service = $service;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;/**&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* 发红包&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;send&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(Request $request)&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 1. 验证参数&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $request-&amp;gt;validate([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;required|in:1,2&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 1拼手气 2普通&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;total_amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;required|numeric|min:0.02|max:200&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;total_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;required|integer|min:2|max:100&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $userId = auth()-&amp;gt;id();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $type = $request-&amp;gt;input(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $totalAmount = $request-&amp;gt;input(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;total_amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $totalCount = $request-&amp;gt;input(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;total_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 2. 检查余额&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $account = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_accounts&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $userId)-&amp;gt;first();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($account-&amp;gt;balance &amp;lt; $totalAmount) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;response()-&amp;gt;json([&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;error&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;余额不足&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;400&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::beginTransaction();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;try&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 3. 扣除余额（乐观锁）&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $affected = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_accounts&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $userId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;version&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $account-&amp;gt;version)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;&amp;gt;=&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $totalAmount)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;balance - {$totalAmount}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;version&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;version + 1&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($affected ===&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;throw&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;余额不足或并发冲突&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 4. 创建红包&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $packetId = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packets&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;insertGetId([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $userId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $type,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;total_amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $totalAmount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;total_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $totalCount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $totalAmount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $totalCount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;status&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;expired_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; now()-&amp;gt;addHours(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;24&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;created_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; now(),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 5. 生成红包明细&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $amounts = $type ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;service-&amp;gt;generateLuckyAmounts($totalAmount, $totalCount)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; :&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;service-&amp;gt;generateNormalAmounts($totalAmount, $totalCount);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $details = [];&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;foreach&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($amounts&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$amount) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $details[] = [&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packetId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $amount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;created_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; now(),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ];&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packet_details&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;insert($details);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 6. 记录流水&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;account_logs&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;insert([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $userId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 发红包&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; -$totalAmount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $account-&amp;gt;balance - $totalAmount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packetId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;created_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; now(),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::commit();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;response()-&amp;gt;json([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packetId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;message&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;发送成功&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;catch&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;(\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$e) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::rollBack();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;response()-&amp;gt;json([&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;error&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $e-&amp;gt;getMessage()],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;500&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;strong style=&quot;box-sizing: border-box; cursor: pointer; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0px; padding: 0px; border-style: none; border-width: 3px; border-color: rgba(0, 0, 0, 0.4); border-radius: 0px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;新手易错点：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ol style=&quot;box-sizing: border-box; margin-top: 8px; margin-bottom: 8px; cursor: pointer; padding: 0px 0px 0px 25px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;❌ 忘记使用事务，导致数据不一致&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;❌ 不使用乐观锁，并发扣款会出问题&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;❌ 金额计算精度问题（使用 DECIMAL 而不是 FLOAT）&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;/ol&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;第二步：抢红包（方案对比）&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h3 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 20px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2.1 方案一：MySQL 悲观锁（不推荐）&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;/**&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* 使用 FOR UPDATE 锁定红包&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* 缺点：&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* - 性能差（串行执行）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* - 锁等待时间长&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* - 不适合高并发&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;grabV1&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(int $packetId, int $userId)&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; DB::beginTransaction();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;try&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 1. 锁定红包（悲观锁）&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $packet = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packets&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packetId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;status&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;lockForUpdate() &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 加锁&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;first();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;(!$packet || $packet-&amp;gt;remain_count &amp;lt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;throw&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;红包已抢完&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 2. 检查是否已抢过&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $exists = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packet_details&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packetId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $userId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;exists();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($exists) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;throw&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;已经抢过了&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 3. 随机获取一个未领取的红包&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $detail = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packet_details&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packetId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;whereNull(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;lockForUpdate()&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;first();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 4. 领取红包&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packet_details&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $detail-&amp;gt;id)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $userId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;grabbed_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; now(),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 5. 更新红包剩余&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packets&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packetId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;remain_amount - {$detail-&amp;gt;amount}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_count - 1&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;status&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;IF(remain_count - 1 = 0, 2, status)&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 6. 增加用户余额&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_accounts&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $userId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;balance + {$detail-&amp;gt;amount}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::commit();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$detail-&amp;gt;amount;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;catch&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;(\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$e) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::rollBack();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;throw&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$e;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;strong style=&quot;box-sizing: border-box; cursor: pointer; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0px; padding: 0px; border-style: none; border-width: 3px; border-color: rgba(0, 0, 0, 0.4); border-radius: 0px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;性能测试：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul style=&quot;box-sizing: border-box; margin-top: 8px; margin-bottom: 8px; cursor: pointer; padding: 0px 0px 0px 25px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1000人抢10个红包&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;耗时：约 5-10 秒&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&lt;span class=&quot;&quot; link-id=&quot;link-1775610581037-0.773297794086448&quot;&gt;TPS&lt;/span&gt;：约 100-200&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 20px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2.2 方案二：Redis + Lua（推荐）&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;/**&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* 使用 Redis 原子操作&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* 优点：&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* - 性能高（内存操作）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* - 原子性（Lua 脚本）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* - 适合高并发&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;grabV2&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(int $packetId, int $userId)&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 1. 检查是否已抢过（Redis Set）&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $key =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;red_packet:grabbed:{$packetId}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;(Redis::sismember($key, $userId)) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;throw&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;已经抢过了&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 2. 使用 Lua 脚本原子操作&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $lua =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;lt;&amp;lt;&amp;lt;LUA&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;-- 检查红包是否存在&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;local packet_key = KEYS[1]&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;local detail_key = KEYS[2]&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;local grabbed_key = KEYS[3]&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;local user_id = ARGV[1]&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;-- 检查是否已抢过&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;if redis.call(&amp;#39;SISMEMBER&amp;#39;, grabbed_key, user_id) == 1 then&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; return {err = &amp;#39;already_grabbed&amp;#39;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;-- 弹出一个红包&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;local detail = redis.call(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;LPOP&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, detail_key)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;not detail then&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;{err =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;empty&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;end&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;-- 标记已抢&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;redis.call(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;SADD&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, grabbed_key, user_id)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;-- 减少剩余数量&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;redis.call(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;HINCRBY&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, packet_key,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;-1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;detail&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;LUA;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $packetKey =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;red_packet:{$packetId}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $detailKey =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;red_packet:details:{$packetId}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $grabbedKey =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;red_packet:grabbed:{$packetId}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $result = Redis::eval($lua,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;3&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packetKey, $detailKey, $grabbedKey, $userId);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;isset&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;($result[&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;err&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;])) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;throw&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;($result[&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;err&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;empty&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;红包已抢完&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;已经抢过了&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $detail = json_decode($result,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 3. 异步写入数据库&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; dispatch(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;UpdateRedPacketJob($packetId, $userId, $detail[&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;], $detail[&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;]));&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$detail[&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;];&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;/**&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* 初始化 Redis 数据&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;initRedis&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(int $packetId)&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $packet = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packets&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;find($packetId);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $details = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packet_details&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packetId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;get();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 红包信息&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; Redis::hmset(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;red_packet:{$packetId}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, [&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;total_amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packet-&amp;gt;total_amount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packet-&amp;gt;total_count,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 红包明细（List）&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;foreach&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($details&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$detail) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Redis::rpush(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;red_packet:details:{$packetId}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, json_encode([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $detail-&amp;gt;id,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $detail-&amp;gt;amount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]));&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 设置过期时间（24小时）&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; Redis::expire(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;red_packet:{$packetId}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;86400&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; Redis::expire(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;red_packet:details:{$packetId}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;86400&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;strong style=&quot;box-sizing: border-box; cursor: pointer; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0px; padding: 0px; border-style: none; border-width: 3px; border-color: rgba(0, 0, 0, 0.4); border-radius: 0px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;性能测试：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul style=&quot;box-sizing: border-box; margin-top: 8px; margin-bottom: 8px; cursor: pointer; padding: 0px 0px 0px 25px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1000人抢10个红包&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;耗时：约 0.1-0.5 秒&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin-top: 5px; margin-bottom: 5px; color: rgb(1, 1, 1); line-height: 1.8em; letter-spacing: 0em;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;TPS：约 2000-10000&lt;/span&gt;&lt;/section&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;strong style=&quot;box-sizing: border-box; cursor: pointer; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0px; padding: 0px; border-style: none; border-width: 3px; border-color: rgba(0, 0, 0, 0.4); border-radius: 0px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;方案对比：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;section style=&quot;box-sizing: border-box; cursor: pointer; margin: 0px; padding: 0px; overflow-x: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;table&gt;&lt;thead&gt;&lt;tr style=&quot;box-sizing: border-box;cursor: pointer;&quot; class=&quot;firstRow&quot;&gt;&lt;th style=&quot;box-sizing: border-box; cursor: pointer; line-height: 1.5em; letter-spacing: 0em; text-align: left; background: none left top / auto no-repeat scroll padding-box border-box rgb(240, 240, 240); height: auto; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px; min-width: 85px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;方案&lt;/span&gt;&lt;/section&gt;&lt;/th&gt;&lt;th style=&quot;box-sizing: border-box; cursor: pointer; line-height: 1.5em; letter-spacing: 0em; text-align: left; background: none left top / auto no-repeat scroll padding-box border-box rgb(240, 240, 240); height: auto; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px; min-width: 85px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;优点&lt;/span&gt;&lt;/section&gt;&lt;/th&gt;&lt;th style=&quot;box-sizing: border-box; cursor: pointer; line-height: 1.5em; letter-spacing: 0em; text-align: left; background: none left top / auto no-repeat scroll padding-box border-box rgb(240, 240, 240); height: auto; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px; min-width: 85px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;缺点&lt;/span&gt;&lt;/section&gt;&lt;/th&gt;&lt;th style=&quot;box-sizing: border-box; cursor: pointer; line-height: 1.5em; letter-spacing: 0em; text-align: left; background: none left top / auto no-repeat scroll padding-box border-box rgb(240, 240, 240); height: auto; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px; min-width: 85px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;适用场景&lt;/span&gt;&lt;/section&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr style=&quot;box-sizing: border-box; cursor: pointer; background-image: none; background-position: left top; background-size: auto; background-repeat: no-repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; width: auto; height: auto;&quot;&gt;&lt;td style=&quot;box-sizing: border-box; cursor: pointer; min-width: 85px; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;MySQL 悲观锁&lt;/span&gt;&lt;/section&gt;&lt;/td&gt;&lt;td style=&quot;box-sizing: border-box; cursor: pointer; min-width: 85px; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;实现简单，数据一致性强&lt;/span&gt;&lt;/section&gt;&lt;/td&gt;&lt;td style=&quot;box-sizing: border-box; cursor: pointer; min-width: 85px; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;性能差，不适合高并发&lt;/span&gt;&lt;/section&gt;&lt;/td&gt;&lt;td style=&quot;box-sizing: border-box; cursor: pointer; min-width: 85px; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;小规模（&amp;lt;100人）&lt;/span&gt;&lt;/section&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box; cursor: pointer; background: none left top / auto no-repeat scroll padding-box border-box rgb(248, 248, 248); width: auto; height: auto;&quot;&gt;&lt;td style=&quot;box-sizing: border-box; cursor: pointer; min-width: 85px; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;Redis + Lua&lt;/span&gt;&lt;/section&gt;&lt;/td&gt;&lt;td style=&quot;box-sizing: border-box; cursor: pointer; min-width: 85px; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;性能高，适合高并发&lt;/span&gt;&lt;/section&gt;&lt;/td&gt;&lt;td style=&quot;box-sizing: border-box; cursor: pointer; min-width: 85px; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;实现复杂，需要数据同步&lt;/span&gt;&lt;/section&gt;&lt;/td&gt;&lt;td style=&quot;box-sizing: border-box; cursor: pointer; min-width: 85px; border-color: rgba(204, 204, 204, 0.4); border-radius: 0px;&quot;&gt;&lt;section&gt;&lt;span leaf=&quot;&quot;&gt;大规模（&amp;gt;1000人）&lt;/span&gt;&lt;/section&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/section&gt;&lt;/p&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;第三步：异步写入数据库&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;App&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Jobs&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;use&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Illuminate&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Bus&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Queueable&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;use&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Illuminate&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Contracts&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Queue&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;ShouldQueue&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;use&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Illuminate&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Support&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Facades&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DB&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;UpdateRedPacketJob&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;implements&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;ShouldQueue&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;use&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Queueable&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;int $packetId;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;int $userId;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;int $detailId;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;float $amount;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;__construct&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(int $packetId, int $userId, int $detailId, float $amount)&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;packetId = $packetId;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;userId = $userId;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;detailId = $detailId;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;amount = $amount;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;handle&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::beginTransaction();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;try&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 1. 更新红包明细&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packet_details&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;detailId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;userId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;grabbed_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; now(),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 2. 更新红包剩余&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packets&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;packetId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;remain_amount - {$this-&amp;gt;amount}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_count - 1&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 3. 增加用户余额&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_accounts&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;userId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;balance + {$this-&amp;gt;amount}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;version&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;version + 1&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 4. 记录流水&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;account_logs&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;insert([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;userId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 抢红包&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;amount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_accounts&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;userId)-&amp;gt;value(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;packetId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;created_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; now(),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::commit();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;catch&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;(\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$e) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::rollBack();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \Log::error(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;UpdateRedPacketJob failed&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, [&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;packetId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;userId,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;error&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $e-&amp;gt;getMessage(),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;第四步：红包详情&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;/**&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;* 红包详情&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;detail&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(int $packetId)&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 1. 红包信息&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $packet = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packets&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;find($packetId);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 2. 领取记录&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $records = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packet_details as d&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;leftJoin(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;users as u&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;d.user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;=&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;u.id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;d.packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packetId)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;whereNotNull(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;d.user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;select(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;u.nickname&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;d.amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;d.grabbed_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;orderBy(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;d.grabbed_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;get();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 3. 标记最佳手气&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($records-&amp;gt;isNotEmpty()) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $maxAmount = $records-&amp;gt;max(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;foreach&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($records&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$record) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $record-&amp;gt;is_best = ($record-&amp;gt;amount == $maxAmount);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;response()-&amp;gt;json([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packet,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;records&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $records,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;第五步：定时任务（退款）&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;App&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Console&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Commands&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;use&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Illuminate&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Console&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Command&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;use&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Illuminate&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Support&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Facades&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;DB&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;RefundExpiredRedPackets&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;extends&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #E6C07B;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Command&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$signature =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;redpacket:refund&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$description =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;退款过期红包&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;handle&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 查找过期且未抢完的红包&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $packets = DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packets&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;status&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;expired_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;&amp;lt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, now())&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;remain_count&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;&amp;gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;get();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;foreach&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($packets&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$packet) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::beginTransaction();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;try&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 1. 更新红包状态&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;red_packets&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packet-&amp;gt;id)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;status&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;3&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;]); &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 已过期&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 2. 退款给发送者&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;($packet-&amp;gt;remain_amount &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_accounts&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packet-&amp;gt;user_id)&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt;update([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::raw(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;balance + {$packet-&amp;gt;remain_amount}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 3. 记录流水&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;account_logs&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;insert([&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packet-&amp;gt;user_id,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #D19A66;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;3&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 退款&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;amount&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packet-&amp;gt;remain_amount,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; DB::table(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_accounts&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;where(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;user_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;, $packet-&amp;gt;user_id)-&amp;gt;value(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;balance&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;packet_id&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; $packet-&amp;gt;id,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;created_at&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;=&amp;gt; now(),&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::commit();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;info(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;红包 {$packet-&amp;gt;id} 退款成功&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;);&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;catch&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;(\&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;Exception&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;$e) {&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DB::rollBack();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;-&amp;gt;error(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;红包 {$packet-&amp;gt;id} 退款失败: &amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;. $e-&amp;gt;getMessage());&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;strong style=&quot;box-sizing: border-box; cursor: pointer; background: none left top / auto no-repeat scroll padding-box border-box rgba(0, 0, 0, 0); width: auto; height: auto; margin: 0px; padding: 0px; border-style: none; border-width: 3px; border-color: rgba(0, 0, 0, 0.4); border-radius: 0px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;定时任务配置：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// app/Console/Kernel.php&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #C678DD;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #61AEEE;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;schedule&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;(Schedule $schedule)&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;// 每小时执行一次&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; $schedule-&amp;gt;command(&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;#39;redpacket:refund&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;)-&amp;gt;hourly();&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;压力测试&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h3 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 20px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;使用 Apache Bench&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;# 1000个并发请求&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;ab -n 1000 -c 100 -p grab.json -T application/json \&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;http://localhost/api/red-packet/grab&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span style=&quot;box-sizing: border-box;color: #5C6370;font-style: italic;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;# grab.json 内容&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;packet_id&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;: 123,&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;user_id&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;: 456&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 20px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;使用 JMeter&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1. 创建线程组&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 线程数：1000&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- Ramp-Up：10秒&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;2. 添加 HTTP 请求&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 方法：POST&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 路径：/api/red-packet/grab&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- Body：{&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;color: #98C379;cursor: pointer;line-height: 26px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;&amp;quot;packet_id&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot;&gt;: 123}&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;3. 添加监听器&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 聚合报告&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 查看结果树&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;性能优化&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;1. Redis 预加载&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 发红包时立即写入 Redis&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 避免首次抢红包时加载&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;2. 限流&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 单用户每秒最多抢3次&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 防止恶意刷接口&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;3. 降级&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- Redis 故障时降级到 MySQL&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 保证可用性&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;4. 监控&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 抢红包成功率&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- 接口响应时间&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp;- Redis 命中率&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr style=&quot;box-sizing: initial; height: 1px; overflow: visible; cursor: pointer; margin: 10px 0px; padding: 0px; border-style: solid none none; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-color: rgb(0, 0, 0) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4); border-radius: 0px; background: none left top / auto no-repeat scroll padding-box border-box rgb(255, 255, 255); width: auto; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; font-size: 16px; text-wrap: wrap;&quot;/&gt;&lt;h2 style=&quot;box-sizing: border-box; margin: 30px 0px 15px; color: rgba(0, 0, 0, 0.85); font-weight: 500; cursor: pointer; padding: 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;box-sizing: border-box; cursor: pointer; font-size: 22px; color: #000000; line-height: 1.5em; letter-spacing: 0em; font-weight: bold; display: block;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;总结&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;pre style=&quot;box-sizing: border-box; font-size: 16px; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; cursor: pointer; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; padding: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;code style=&quot;box-sizing: border-box;font-family: Consolas, Monaco, Menlo, monospace;font-size: 12px;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);cursor: pointer;border-radius: 5px;&quot;&gt;&lt;span leaf=&quot;&quot;&gt;抢红包核心：&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;1. 金额算法：二倍均值法&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;2. 并发控制：Redis + Lua&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;3. 数据一致性：异步写入 + 补偿&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;4. 性能优化：内存操作 + 队列&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;技术栈：&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- Redis（高并发）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- Lua（原子操作）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- MySQL（持久化）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- Queue（异步处理）&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;性能指标：&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- TPS：10000+&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- 响应时间：&amp;lt; 100ms&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;span leaf=&quot;&quot;&gt;- 成功率：99.9%&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box;cursor: pointer;&quot;/&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; cursor: pointer; font-size: 16px; line-height: 1.8em; padding: 8px 0px; font-family: Optima, &amp;quot;Microsoft YaHei&amp;quot;, PingFangSC-regular, serif; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span leaf=&quot;&quot;&gt;抢红包是高并发场景的经典案例！&lt;/span&gt;&lt;/p&gt;&lt;p&gt;转：码上微光&lt;br/&gt;&lt;/p&gt;</description><pubDate>Wed, 08 Apr 2026 09:37:01 +0800</pubDate></item><item><title>thinkphp6.1中分页类调用</title><link>https://www.zhangkeda.com/?id=569</link><description>&lt;pre class=&quot;prism-highlight prism-language-php&quot;&gt;$list&amp;nbsp;=&amp;nbsp;YourModel-&amp;gt;paginate([
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;list_rows&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;15
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;simple&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;false,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;page\Bootstrap&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;var_page&amp;#39;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;page&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;query&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;$this-&amp;gt;request-&amp;gt;get()
]);&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;color: #060A26; font-family: system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, Cantarell, &amp;quot;Helvetica Neue&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;PingFang TC&amp;quot;, &amp;quot;PingFang HK&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, &amp;quot;Microsoft JhengHei&amp;quot;; font-size: 16px; white-space: pre-wrap; background-color: #EBF5FF;&quot;&gt;使用了分页类是extend中的page文件夹下面的Bootstrap.php。并且在provide.php中配置了&amp;#39;think\Paginator&amp;#39; &amp;nbsp; &amp;nbsp;=&amp;gt; \page\Bootstrap::class&lt;/span&gt;&lt;/p&gt;&lt;p&gt;和TP5有区别了：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-php&quot;&gt;$list&amp;nbsp;=&amp;nbsp;YourModel-&amp;gt;paginate($page,&amp;nbsp;$countNum,&amp;nbsp;[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;type&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;page\Bootstrap&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;var_page&amp;#39;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;#39;page&amp;#39;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;simple&amp;#39;=&amp;gt;true,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;query&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;gt;&amp;nbsp;$this-&amp;gt;request-&amp;gt;get()
]);&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;color: #060A26; font-family: system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, Cantarell, &amp;quot;Helvetica Neue&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;PingFang TC&amp;quot;, &amp;quot;PingFang HK&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, &amp;quot;Microsoft JhengHei&amp;quot;; font-size: 16px; white-space: pre-wrap; background-color: #EBF5FF;&quot;&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Fri, 09 Jan 2026 15:52:29 +0800</pubDate></item><item><title>phpstudy提示错误：cURL error 60 配置SSL CA证书 </title><link>https://www.zhangkeda.com/?id=568</link><description>&lt;h3 style=&quot;box-sizing: border-box; outline: 0px; margin: 24px 0px 8px; padding: 0px; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, SimHei, Arial, SimSun; font-size: 20px; color: rgb(79, 79, 79); line-height: 30px; font-synthesis-style: auto; overflow-wrap: break-word; text-wrap: wrap; background-color: rgb(255, 255, 255);&quot;&gt;&lt;a href=&quot;https://www.cnblogs.com/qxandxt/p/18338310&quot; id=&quot;cb_post_title_url&quot; title=&quot;phpstudy配置SSL CA证书&quot; rel=&quot;nofollow&quot; style=&quot;box-sizing: border-box; outline: none; margin: 24px 0px 8px; padding: 0px; text-decoration-line: none; cursor: pointer; color: rgb(78, 161, 219); font-synthesis-style: auto; overflow-wrap: break-word;&quot;&gt;phpstudy配置SSL CA证书&lt;/a&gt;&lt;/h3&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;本地Windows环境，&amp;nbsp;&lt;span class=&quot;words-blog hl-git-1&quot; data-tit=&quot;phpstudy&quot; data-pretit=&quot;phpstudy&quot; style=&quot;box-sizing: border-box; outline: 0px; margin: 0px 3px 0px 0px; padding: 0px 18px 0px 0px; font-synthesis-style: auto; overflow-wrap: break-word; cursor: pointer; background: url(&amp;quot;../img/gitcode-key.png&amp;quot;) right center / 14px 14px no-repeat transparent; box-shadow: none; color: #4EA1DB !important;&quot;&gt;phpstudy&lt;/span&gt;&amp;nbsp;集成 php7 后，出现错误提示：&lt;br style=&quot;box-sizing: border-box; outline: 0px; font-synthesis-style: auto; overflow-wrap: break-word;&quot;/&gt;cURL error 60: SSL certificate problem: unable to&amp;nbsp;&lt;a href=&quot;https://so.csdn.net/so/search?q=get&amp;spm=1001.2101.3001.7020&quot; target=&quot;_blank&quot; class=&quot;hl hl-1&quot; data-report-click=&quot;{&quot; spm=&quot;&quot;&gt;get&lt;/a&gt;&amp;nbsp;local issuer certificate&lt;br style=&quot;box-sizing: border-box; outline: 0px; font-synthesis-style: auto; overflow-wrap: break-word;&quot;/&gt;查询问题：&lt;span style=&quot;box-sizing: border-box; outline: 0px; font-weight: 700; font-synthesis-style: auto; overflow-wrap: break-word;&quot;&gt;SSL CA证书配置缺失&lt;/span&gt;导致。&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;1、从&lt;span class=&quot;words-blog hl-git-1&quot; data-tit=&quot;CURL&quot; data-pretit=&quot;curl&quot; style=&quot;box-sizing: border-box; outline: 0px; margin: 0px 3px 0px 0px; padding: 0px 18px 0px 0px; font-synthesis-style: auto; overflow-wrap: break-word; cursor: pointer; background: url(&amp;quot;../img/gitcode-key.png&amp;quot;) right center / 14px 14px no-repeat transparent; box-shadow: none; color: #4EA1DB !important;&quot;&gt;CURL&lt;/span&gt;&amp;nbsp;官网下载&lt;a href=&quot;https://so.csdn.net/so/search?q=CA%20%E8%AF%81%E4%B9%A6&amp;spm=1001.2101.3001.7020&quot; target=&quot;_blank&quot; class=&quot;hl hl-1&quot; data-report-click=&quot;{&quot; spm=&quot;&quot;&gt;CA 证书&lt;/a&gt;（cacert.pem）&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;可 选择下载：&lt;a href=&quot;https://links.jianshu.com/go?to=https%3A%2F%2Fcurl.haxx.se%2Fdocs%2Fcaextract.html&quot; title=&quot;https://curl.haxx.se/docs/caextract.html&quot; rel=&quot;nofollow&quot; style=&quot;box-sizing: border-box; outline: none; margin: 0px; padding: 0px; text-decoration-line: none; cursor: pointer; color: rgb(78, 161, 219); font-synthesis-style: auto; overflow-wrap: break-word;&quot;&gt;https://curl.haxx.se/docs/caextract.html&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;或 直接下载：&lt;a href=&quot;https://links.jianshu.com/go?to=https%3A%2F%2Fcurl.haxx.se%2Fca%2Fcacert.pem&quot; title=&quot;https://curl.haxx.se/ca/cacert.pem&quot; rel=&quot;nofollow&quot; style=&quot;box-sizing: border-box; outline: none; margin: 0px; padding: 0px; text-decoration-line: none; cursor: pointer; color: rgb(78, 161, 219); font-synthesis-style: auto; overflow-wrap: break-word;&quot;&gt;https://curl.haxx.se/ca/cacert.pem&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;2、找到 phpstudy 安装路径，对应php版本包&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;例 安装路径下 php包：D:\phpstudy_pro\&lt;span class=&quot;words-blog hl-git-1&quot; data-tit=&quot;Extensions&quot; data-pretit=&quot;extensions&quot; style=&quot;box-sizing: border-box; outline: 0px; margin: 0px 3px 0px 0px; padding: 0px 18px 0px 0px; font-synthesis-style: auto; overflow-wrap: break-word; cursor: pointer; background: url(&amp;quot;../img/gitcode-key.png&amp;quot;) right center / 14px 14px no-repeat transparent; box-shadow: none; color: #4EA1DB !important;&quot;&gt;Extensions&lt;/span&gt;\php\php7.3.4nts&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;将下载的cacert.pem文件，放入 \extras\ssl\&amp;nbsp;&lt;a href=&quot;https://so.csdn.net/so/search?q=%E6%96%87%E4%BB%B6%E5%A4%B9&amp;spm=1001.2101.3001.7020&quot; target=&quot;_blank&quot; class=&quot;hl hl-1&quot; data-report-click=&quot;{&quot; spm=&quot;&quot;&gt;文件夹&lt;/a&gt;下&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;3、修改配置 php.ini 文件&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;启用openssl, curl扩展&lt;/p&gt;&lt;pre data-index=&quot;0&quot; class=&quot;new-version hljs set-code-show&quot; name=&quot;code&quot; style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 24px; padding: 36px 8px 8px; position: relative; overflow: auto hidden; color: rgb(180, 180, 180); background-color: rgb(40, 44, 52); text-wrap: wrap; overflow-wrap: break-word; font-family: Consolas, Inconsolata, Courier, monospace; line-height: 22px; max-height: unset; border-radius: 5px; font-synthesis-style: auto;&quot;&gt;extension=curl
extension=openssl&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif, SimHei, SimSun; text-wrap: wrap; background-color: rgb(255, 255, 255); line-height: 24px !important;&quot;&gt;然后修改两处CA 证书存放位置&lt;/p&gt;&lt;pre data-index=&quot;1&quot; class=&quot;new-version hljs set-code-show&quot; name=&quot;code&quot; style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 24px; padding: 36px 8px 8px; position: relative; overflow: auto hidden; color: rgb(180, 180, 180); background-color: rgb(40, 44, 52); text-wrap: wrap; overflow-wrap: break-word; font-family: Consolas, Inconsolata, Courier, monospace; line-height: 22px; max-height: unset; border-radius: 5px; font-synthesis-style: auto;&quot;&gt;curl.cainfo&amp;nbsp;=&amp;nbsp;&amp;quot;D:\phpstudy_pro\Extensions\php\php7.3.4nts\extras\ssl\cacert.pem&amp;quot;
openssl.cafile=&amp;quot;D:\phpstudy_pro\Extensions\php\php7.3.4nts\extras\ssl\cacert.pem&amp;quot;&lt;/pre&gt;</description><pubDate>Fri, 05 Dec 2025 15:20:28 +0800</pubDate></item><item><title>在thinkphp6中使用依赖注入或容器来创建对象</title><link>https://www.zhangkeda.com/?id=567</link><description>&lt;p&gt;很多时候，在自己的控制器中需要调用另一个控制器中的方法，但是没有直接的继承关系，比如两个控制器同时继承了一个common类。如果我们直接new一个控制器中的类，就会提示&lt;/p&gt;&lt;pre data-spm-anchor-id=&quot;5176.28103460.0.i15.2f2e1db8PodMdi&quot; style=&quot;box-sizing: border-box; overflow: auto; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 0px; overflow-wrap: normal; background-color: rgb(30, 30, 30); border-radius: 6px; color: rgb(221, 221, 221); line-height: 1.45; padding: 16px 8px; letter-spacing: 0.08px;&quot;&gt;Too&amp;nbsp;few&amp;nbsp;arguments&amp;nbsp;to&amp;nbsp;function&amp;nbsp;app\common\controller\WechatApi::__construct(),&amp;nbsp;0&amp;nbsp;passed&lt;/pre&gt;&lt;p data-spm-anchor-id=&quot;5176.28103460.0.i21.2f2e1db8PodMdi&quot; style=&quot;white-space: pre-wrap; box-sizing: border-box; margin-bottom: 1em; margin-top: 1em; word-break: break-word; color: rgb(44, 44, 54); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; background-color: rgb(255, 255, 255);&quot;&gt;当前在 &lt;code node=&quot;[object Object]&quot; style=&quot;box-sizing: border-box; margin: 0px; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; background-color: rgba(175, 184, 193, 0.2); border-radius: 6px; padding: 0.2em 0.4em; white-space-collapse: break-spaces;&quot;&gt;Login&lt;/code&gt; 控制器中的方法里这样使用了 &lt;code node=&quot;[object Object]&quot; style=&quot;box-sizing: border-box; margin: 0px; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; background-color: rgba(175, 184, 193, 0.2); border-radius: 6px; padding: 0.2em 0.4em; white-space-collapse: break-spaces;&quot;&gt;WechatApi&lt;/code&gt;：&lt;/p&gt;&lt;pre data-spm-anchor-id=&quot;5176.28103460.0.i23.2f2e1db8PodMdi&quot; style=&quot;box-sizing: border-box; overflow: auto; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 0px; overflow-wrap: normal; background-color: rgb(30, 30, 30); border-radius: 6px; color: rgb(221, 221, 221); line-height: 1.45; padding: 16px 8px; letter-spacing: 0.08px;&quot;&gt;$wxapi&amp;nbsp;=&amp;nbsp;new&amp;nbsp;WechatApi();
$wxapi-&amp;gt;WechatOAuth(&amp;#39;snsapi_base&amp;#39;);&lt;/pre&gt;&lt;p data-spm-anchor-id=&quot;5176.28103460.0.i21.2f2e1db8PodMdi&quot; style=&quot;white-space: pre-wrap; box-sizing: border-box; margin-bottom: 1em; margin-top: 1em; word-break: break-word; color: rgb(44, 44, 54); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;但&lt;/span&gt;&lt;code node=&quot;[object Object]&quot; style=&quot;box-sizing: border-box; margin: 0px; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; background-color: rgba(175, 184, 193, 0.2); border-radius: 6px; padding: 0.2em 0.4em; white-space: break-spaces; color: rgb(44, 44, 54); letter-spacing: 0.08px;&quot;&gt;WechatApi&lt;/code&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt; 类定义如下：&lt;/span&gt;&lt;/p&gt;&lt;p data-spm-anchor-id=&quot;5176.28103460.0.i21.2f2e1db8PodMdi&quot; style=&quot;white-space: pre-wrap; box-sizing: border-box; margin-bottom: 1em; margin-top: 1em; word-break: break-word; color: rgb(44, 44, 54); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;box-sizing: border-box; overflow: auto; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 0px; overflow-wrap: normal; background-color: rgb(30, 30, 30); border-radius: 6px; color: rgb(221, 221, 221); line-height: 1.45; padding: 16px 8px; letter-spacing: 0.08px;&quot;&gt;class&amp;nbsp;WechatApi&amp;nbsp;extends&amp;nbsp;Hub{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
public&amp;nbsp;function&amp;nbsp;__construct(App&amp;nbsp;$app)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parent::__construct($app);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
public&amp;nbsp;function&amp;nbsp;WechatOAuth()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;&lt;p data-spm-anchor-id=&quot;5176.28103460.0.i21.2f2e1db8PodMdi&quot; style=&quot;white-space: pre-wrap; box-sizing: border-box; margin-bottom: 1em; margin-top: 1em; word-break: break-word; color: rgb(44, 44, 54); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;这里 &lt;/span&gt;&lt;code node=&quot;[object Object]&quot; data-spm-anchor-id=&quot;5176.28103460.0.i31.2f2e1db8PodMdi&quot; style=&quot;box-sizing: border-box; margin: 0px; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; background-color: rgba(175, 184, 193, 0.2); border-radius: 6px; padding: 0.2em 0.4em; white-space: break-spaces; color: rgb(44, 44, 54); letter-spacing: 0.08px;&quot;&gt;new WechatApi()&lt;/code&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt; 没有传入 &lt;/span&gt;&lt;code node=&quot;[object Object]&quot; style=&quot;box-sizing: border-box; margin: 0px; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; background-color: rgba(175, 184, 193, 0.2); border-radius: 6px; padding: 0.2em 0.4em; white-space: break-spaces; color: rgb(44, 44, 54); letter-spacing: 0.08px;&quot;&gt;$app&lt;/code&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt; 参数，所以会报错，&lt;/span&gt;或者是Hub中有构造函数被继承了。&lt;/p&gt;&lt;p data-spm-anchor-id=&quot;5176.28103460.0.i21.2f2e1db8PodMdi&quot; style=&quot;white-space: pre-wrap; box-sizing: border-box; margin-bottom: 1em; margin-top: 1em; word-break: break-word; color: rgb(44, 44, 54); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;在 ThinkPHP 6.1 中，&lt;/span&gt;&lt;span data-spm-anchor-id=&quot;5176.28103460.0.i17.2f2e1db8PodMdi&quot; style=&quot;box-sizing: border-box; font-weight: 600; color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;建议使用依赖注入或容器来创建对象&lt;/span&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;，而不是手动 &lt;/span&gt;&lt;code node=&quot;[object Object]&quot; style=&quot;box-sizing: border-box; margin: 0px; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; background-color: rgba(175, 184, 193, 0.2); border-radius: 6px; padding: 0.2em 0.4em; white-space: break-spaces; color: rgb(44, 44, 54); letter-spacing: 0.08px;&quot;&gt;new&lt;/code&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;。你可以使用框架提供的容器来自动解析 &lt;/span&gt;&lt;code node=&quot;[object Object]&quot; style=&quot;box-sizing: border-box; margin: 0px; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; background-color: rgba(175, 184, 193, 0.2); border-radius: 6px; padding: 0.2em 0.4em; white-space: break-spaces; color: rgb(44, 44, 54); letter-spacing: 0.08px;&quot;&gt;WechatApi&lt;/code&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;，前提是它的依赖能被容器解析。&lt;/span&gt;&lt;/p&gt;&lt;p data-spm-anchor-id=&quot;5176.28103460.0.i21.2f2e1db8PodMdi&quot; style=&quot;white-space: pre-wrap; box-sizing: border-box; margin-bottom: 1em; margin-top: 1em; word-break: break-word; color: rgb(44, 44, 54); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;box-sizing: border-box; overflow: auto; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 0px; overflow-wrap: normal; background-color: rgb(30, 30, 30); border-radius: 6px; color: rgb(221, 221, 221); line-height: 1.45; padding: 16px 8px; letter-spacing: 0.08px;&quot;&gt;public&amp;nbsp;function&amp;nbsp;checkWechatLogin(){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;使用容器创建&amp;nbsp;WechatApi&amp;nbsp;实例，自动注入&amp;nbsp;App&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$wxapi&amp;nbsp;=&amp;nbsp;Container::getInstance()-&amp;gt;make(WechatApi::class);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$wxapi-&amp;gt;WechatOAuth(&amp;#39;snsapi_base&amp;#39;);
}&lt;/pre&gt;&lt;p data-spm-anchor-id=&quot;5176.28103460.0.i21.2f2e1db8PodMdi&quot; style=&quot;white-space: pre-wrap; box-sizing: border-box; margin-bottom: 1em; margin-top: 1em; word-break: break-word; color: rgb(44, 44, 54); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #2C2C36; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;或者更简洁一点（适用于控制器方法）：&lt;/span&gt;&lt;/p&gt;&lt;pre data-spm-anchor-id=&quot;5176.28103460.0.i41.2f2e1db8PodMdi&quot; style=&quot;box-sizing: border-box; overflow: auto; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13px; margin-top: 0px; margin-bottom: 0px; overflow-wrap: normal; background-color: rgb(30, 30, 30); border-radius: 6px; color: rgb(221, 221, 221); line-height: 1.45; padding: 16px 8px; letter-spacing: 0.08px;&quot;&gt;public&amp;nbsp;function&amp;nbsp;checkWechatLogin(WechatApi&amp;nbsp;$wxapi){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$wxapi-&amp;gt;WechatOAuth(&amp;#39;snsapi_base&amp;#39;);
}&lt;/pre&gt;&lt;p data-spm-anchor-id=&quot;5176.28103460.0.i21.2f2e1db8PodMdi&quot; style=&quot;white-space: pre-wrap; box-sizing: border-box; margin-bottom: 1em; margin-top: 1em; word-break: break-word; color: rgb(44, 44, 54); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;这种方式是 &lt;/span&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 600; font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;依赖注入&lt;/span&gt;&lt;span style=&quot;font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;，由框架自动帮你实例化并传入 &lt;/span&gt;&lt;code node=&quot;[object Object]&quot; style=&quot;box-sizing: border-box; margin: 0px; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; background-color: rgba(175, 184, 193, 0.2); border-radius: 6px; padding: 0.2em 0.4em; white-space: break-spaces; color: rgb(143, 145, 168); letter-spacing: 0.08px;&quot;&gt;App&lt;/code&gt;&lt;span style=&quot;font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif, &amp;quot;Source Han Serif&amp;quot;; font-size: 16px; letter-spacing: 0.08px; white-space: pre-wrap; background-color: #FFFFFF;&quot;&gt;。&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;</description><pubDate>Thu, 05 Jun 2025 11:12:44 +0800</pubDate></item><item><title>天地图用服务端去调用接口提示403错误，解决办法</title><link>https://www.zhangkeda.com/?id=566</link><description>&lt;p&gt;天地图用服务端去调用接口提示403错误，这里很有可能就是跨域问题。&lt;/p&gt;&lt;p&gt;可以使用天地图官方的处理跨域的地址去处理：&lt;a href=&quot;https://api.tianditu.gov.cn/apiserver/ajaxproxy?proxyReqUrl=https://api.tianditu.gov.cn/v2/search?postStr=&amp;quot;+postStr+&amp;quot;&amp;type=query&amp;tk=&amp;quot;+tdt_key。&quot; _src=&quot;https://api.tianditu.gov.cn/apiserver/ajaxproxy?proxyReqUrl=https://api.tianditu.gov.cn/v2/search?postStr=&amp;quot;+postStr+&amp;quot;&amp;type=query&amp;tk=&amp;quot;+tdt_key。&quot;&gt;https://api.tianditu.gov.cn/apiserver/ajaxproxy?proxyReqUrl=https://api.tianditu.gov.cn/v2/search?postStr=学校&amp;amp;type=query&amp;amp;tk=秘钥&amp;quot; 。&lt;/a&gt;&lt;/p&gt;&lt;p&gt;如果你直接去访问：&lt;a href=&quot;https://api.tianditu.gov.cn/v2/search?postStr=&amp;quot;+postStr+&amp;quot;&amp;type=query&amp;tk=&amp;quot;+tdt_key就会提示403错误。&quot; _src=&quot;https://api.tianditu.gov.cn/v2/search?postStr=&amp;quot;+postStr+&amp;quot;&amp;type=query&amp;tk=&amp;quot;+tdt_key就会提示403错误。&quot;&gt;&lt;a href=&quot;https://api.tianditu.gov.cn/apiserver/ajaxproxy?proxyReqUrl=https://api.tianditu.gov.cn/v2/search?postStr=%22+postStr+%22&amp;type=query&amp;tk=%22+tdt_key%E3%80%82&quot; _src=&quot;https://api.tianditu.gov.cn/apiserver/ajaxproxy?proxyReqUrl=https://api.tianditu.gov.cn/v2/search?postStr=&amp;quot;+postStr+&amp;quot;&amp;type=query&amp;tk=&amp;quot;+tdt_key。&quot; style=&quot;text-wrap: wrap;&quot;&gt;https://api.tianditu.gov.cn/v2/search?postStr=学校&amp;amp;type=query&amp;amp;tk=秘钥&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 就会提示403错误。&lt;/a&gt;&lt;/p&gt;&lt;p&gt;这里的是调用了天地图的搜索接口。&lt;/p&gt;</description><pubDate>Sun, 27 Apr 2025 15:12:31 +0800</pubDate></item><item><title>在使用do.js进行js管理时遇到的问题</title><link>https://www.zhangkeda.com/?id=565</link><description>&lt;p&gt;&lt;span style=&quot;color: #404040; font-family: DeepSeek-CJK-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Noto Sans&amp;quot;, Ubuntu, Cantarell, &amp;quot;Helvetica Neue&amp;quot;, Oxygen, &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16.002px; text-wrap: wrap;&quot;&gt;Do.js 是一个轻量级的 JavaScript 模块加载器和 DOM 就绪事件处理器，它主要用于管理 JavaScript 和 CSS 文件的异步加载、处理模块依赖关系以及执行 DOM 就绪后的回调函数。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;比如我有a.js,在页面中包含a.js时想一起加载其他的js文件，在其他文件加载完后处理js事件。这样就可以用到这个轻量级的模块加载工具do.js。&lt;/p&gt;&lt;p&gt;首先这个do.js是基于jquery实现的，所以在使用的时候必须要有jquery在do.js文件中需要配置jquery的地址：&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://www.zhangkeda.com/zb_users/upload/2025/04/202504091744187673722144.png&quot; title=&quot;微信图片_20250409163415.png&quot; alt=&quot;微信图片_20250409163415.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 18px; color: #FF0000;&quot;&gt;&lt;strong&gt;如果你的页面中已经存在了jquery，那么在do.js的文件中核心库这里配置一个空的js文件，如果你不配置则会报错。&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;然后再html中加入&lt;/p&gt;&lt;pre style=&quot;background-color:#2b2b2b;color:#a9b7c6;font-family:&amp;#39;JetBrains Mono&amp;#39;;font-size:10.5pt;&quot;&gt;&amp;lt;script&amp;nbsp;src=&amp;quot;__PUBLIC__/js/do.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;p&gt;在引入&lt;/p&gt;&lt;pre style=&quot;background-color:#2b2b2b;color:#a9b7c6;font-family:&amp;#39;JetBrains Mono&amp;#39;;font-size:10.5pt;&quot;&gt;&amp;lt;script&amp;nbsp;src=&amp;quot;__PUBLIC__/js/a.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;p&gt;在a.js文件中就可以引入其他的js文件，并且可以有依赖关系：&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://www.zhangkeda.com/zb_users/upload/2025/04/202504091744187825405623.png&quot; title=&quot;微信图片_20250409163647.png&quot; alt=&quot;微信图片_20250409163647.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;比如这里我引入了两个js，一个是gcoord.global.prod.js 和 一个天地图的js文件，可以支持远程地址。&lt;/p&gt;&lt;p&gt;然后使用：&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://www.zhangkeda.com/zb_users/upload/2025/04/202504151744681468629273.png&quot; title=&quot;微信图片_20250415094309.png&quot; alt=&quot;微信图片_20250415094309.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;这类的gcoordJs表示将&lt;span style=&quot;text-wrap: wrap;&quot;&gt;gcoord.global.prod.js命名成&lt;span style=&quot;text-wrap: wrap;&quot;&gt;gcoordJs模块了。这里表示当两个模块加载成功后，在里面可以执行自己想要的操作，这里比如可以进行天地图的一些接口调用。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;在使用这个js的时候遇到一个bug，必须重点说明一下：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://www.zhangkeda.com/zb_users/upload/2025/04/202504151744681581575605.png&quot; title=&quot;微信图片_20250415094607.png&quot; alt=&quot;微信图片_20250415094607.png&quot;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #C00000; font-size: 18px;&quot;&gt;&lt;strong&gt;没有依赖其他的模块，那么里面的requires:[]这个必须去掉，不然无法加载成功，类似下面的情况：&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #C00000; font-size: 18px;&quot;&gt;&lt;strong&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://www.zhangkeda.com/zb_users/upload/2025/04/202504151744681143875187.png&quot; title=&quot;微信图片_20250415093820.png&quot; alt=&quot;微信图片_20250415093820.png&quot;/&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 14px; color: #000000;&quot;&gt;&lt;strong&gt;如果两个js存在依赖关系：&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color:#c00000&quot;&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;&lt;strong&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://www.zhangkeda.com/zb_users/upload/2025/04/202504151744681243705864.png&quot; title=&quot;微信图片_20250415093955.png&quot; alt=&quot;微信图片_20250415093955.png&quot;/&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;这里表示gcoordJs需要依赖tiandituJS。就是加载gcoordJs的时候会同时加载tiandituJS。&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18px;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap: wrap;&quot;&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #C00000; font-size: 18px;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap: wrap; color: #FF0000; font-size: 20px;&quot;&gt;特别注意：在add一个文件后，必须要使用Do(&amp;#39;&amp;#39;)方法去实现，不然没有效果。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #C00000; font-size: 18px;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;比如我现在要实现预加载css文件：&lt;/p&gt;&lt;pre style=&quot;background-color:#2b2b2b;color:#a9b7c6;font-family:&amp;#39;JetBrains Mono&amp;#39;;font-size:10.5pt;&quot;&gt;Do.add(&amp;#39;tdt-css&amp;#39;,&amp;nbsp;{path:&amp;nbsp;&amp;#39;__PUBLIC__/css/tdtcss.css&amp;#39;,&amp;nbsp;type:&amp;nbsp;&amp;#39;css&amp;#39;});&lt;/pre&gt;&lt;p&gt;如果单纯只这样添加一下，页面加载时不会去预加载这个css文件的，必须执行一下：&lt;/p&gt;&lt;pre style=&quot;background-color:#2b2b2b;color:#a9b7c6;font-family:&amp;#39;JetBrains Mono&amp;#39;;font-size:10.5pt;&quot;&gt;Do(&amp;#39;tdt-css&amp;#39;,&amp;nbsp;()&amp;nbsp;=&amp;gt;&amp;nbsp;{

}）&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Wed, 09 Apr 2025 16:29:18 +0800</pubDate></item><item><title>composer使用phpstudy的php环境，如果改变php版本如何处理</title><link>https://www.zhangkeda.com/?id=564</link><description>&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;首先安装composer后，先在系统的环境变量中添加php路径，比如之前的路径：C:\zhangsan\work\phpstudy_pro\Extensions\php\php7.3.4nts ，现在要改成：&lt;span style=&quot;text-wrap: wrap;&quot;&gt;C:\zhangsan\work\phpstudy_pro\Extensions\php\php8.0.2.4nts，这样php版本就变成了8.0的了。但是这个时候你去执行composer命令会提示&amp;nbsp;&lt;span style=&quot;color: #2C2C36; font-family: ui-monospace, SFMono-Regular, &amp;quot;SF Mono&amp;quot;, Menlo, Consolas, &amp;quot;Liberation Mono&amp;quot;, monospace; font-size: 13.6px; letter-spacing: 0.08px; white-space: break-spaces; background-color: rgba(175, 184, 193, 0.2);&quot;&gt;&amp;#39;composer&amp;#39; 不是内部或外部命令。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;这里我们需要将composer两个文件拷贝到：&lt;span style=&quot;text-wrap: wrap;&quot;&gt;C:\zhangsan\work\phpstudy_pro\Extensions\php\php8.0.2文件夹下面去，分别是composer.bat，composer.phar。然后去执行就正常了。&lt;/span&gt;&lt;/p&gt;</description><pubDate>Tue, 11 Mar 2025 09:33:00 +0800</pubDate></item><item><title>ThinkPHP5.1关于条件为[NOT]NULL的写法</title><link>https://www.zhangkeda.com/?id=563</link><description>&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://www.zhangkeda.com/zb_users/upload/2024/12/202412121733993343722285.png&quot; title=&quot;微信图片_20241212164846.png&quot; alt=&quot;微信图片_20241212164846.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Thu, 12 Dec 2024 16:46:31 +0800</pubDate></item></channel></rss>