{"id":93,"date":"2026-08-08T11:58:13","date_gmt":"2026-08-08T03:58:13","guid":{"rendered":"https:\/\/www.deartester.com\/index.php\/2026\/08\/08\/%e6%8e%a5%e5%8f%a3%e6%b5%8b%e8%af%95%e4%b8%8d%e6%ad%a2%e6%a0%a1%e9%aa%8c%e7%8a%b6%e6%80%81%e7%a0%81-%e4%bb%8e4%e4%b8%aa%e7%bb%b4%e5%ba%a6%e4%bf%9d%e9%9a%9c%e6%8e%a5%e5%8f%a3%e8%b4%a8\/"},"modified":"2026-09-03T23:17:18","modified_gmt":"2026-09-03T15:17:18","slug":"%e6%8e%a5%e5%8f%a3%e6%b5%8b%e8%af%95%e4%b8%8d%e6%ad%a2%e6%a0%a1%e9%aa%8c%e7%8a%b6%e6%80%81%e7%a0%81-%e4%bb%8e4%e4%b8%aa%e7%bb%b4%e5%ba%a6%e4%bf%9d%e9%9a%9c%e6%8e%a5%e5%8f%a3%e8%b4%a8","status":"publish","type":"post","link":"https:\/\/www.deartester.com\/index.php\/2026\/08\/08\/%e6%8e%a5%e5%8f%a3%e6%b5%8b%e8%af%95%e4%b8%8d%e6%ad%a2%e6%a0%a1%e9%aa%8c%e7%8a%b6%e6%80%81%e7%a0%81-%e4%bb%8e4%e4%b8%aa%e7%bb%b4%e5%ba%a6%e4%bf%9d%e9%9a%9c%e6%8e%a5%e5%8f%a3%e8%b4%a8\/","title":{"rendered":"\u63a5\u53e3\u6d4b\u8bd5\u4e0d\u6b62\u6821\u9a8c\u72b6\u6001\u7801\u2014\u2014\u4ece4\u4e2a\u7ef4\u5ea6\u4fdd\u969c\u63a5\u53e3\u8d28\u91cf\u5c11\u8fd4\u5de550%"},"content":{"rendered":"<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 18px;color: rgb(123, 12, 0);font-weight: bold;\">\u63a5\u53e3\u6d4b\u8bd5\u7684\u56db\u5c42\u8d28\u91cf\u5730\u56fe<\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(136, 136, 136);font-weight: bold;font-style: italic;\">\u4ece\u53ea\u770b\u72b6\u6001\u7801\uff0c\u5230\u628a\u63a5\u53e3\u8d28\u91cf\u6d4b\u900f\u7684\u56db\u4e2a\u53f0\u9636<\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-aistatus=\"1\" data-imgfileid=\"100000654\" data-ratio=\"0.37777777777777777\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" type=\"block\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1KtEic8xEbMFB7Tz39FkNMfdiaALic48aCrH5lb9WgEZ9Aia3hqkCAnbn8P3CHzibZnrln01eic7ia3WrroXPwr6Prl3sDJH3KHwarMME\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;font-weight: bold;\">\u6211\u5e72\u6d4b\u8bd510 \u591a\u4e2a\u5e74\u5934\u4e86\uff0c\u89c1\u8fc7\u592a\u591a\u8fd9\u6837\u7684\u573a\u666f\uff1a<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u63a5\u53e3\u8fd4\u56de&nbsp;<\/span><\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">HTTP 200<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\uff0c\u7528\u4f8b PASS\uff0c\u6d4b\u8bd5\u62a5\u544a\u7eff\u6cb9\u6cb9\u4e00\u7247\uff0c\u622a\u56fe\u53d1\u7fa4\u91cc\u8fd8\u633a\u6709\u6210\u5c31\u611f\u3002\u7b2c\u4e8c\u5929\u4e0a\u7ebf\uff0c\u5ba2\u670d\u7fa4\u70b8\u4e86\uff1a<\/span><\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">&#8220;\u6211\u4e0b\u5355\u6210\u529f\u4e86\uff0c\u94b1\u4e5f\u6263\u4e86\uff0c\u4f46\u5e93\u5b58\u6ca1\u51cf\uff0c\u4ed3\u5e93\u90a3\u8fb9\u6839\u672c\u6ca1\u6536\u5230\u5355\u3002&#8221;<\/span><\/span><\/strong><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u4f60\u56de\u5934\u7ffb\u7528\u4f8b\uff0c\u5c31\u4e24\u884c\u65ad\u8a00\uff1a<\/span><\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">assert resp.status_code == 200<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u3001<\/span><\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">assert resp.json()[\"code\"] == 0<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u3002<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: rgb(0, 82, 255);\">\u63a5\u53e3\u672c\u8eab\u6ca1\u574f\u3002\u662f\u4f60\u6d4b\u7684\u65b9\u5f0f\u592a\u6d45\u4e86\u3002<\/span><\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u8fd9\u7c7b\u8fd4\u5de5\u5728\u63a5\u53e3\u6d4b\u8bd5\u91cc\u7279\u522b\u5e38\u89c1\u3002\u4e0d\u662f\u80fd\u529b\u95ee\u9898\uff0c\u662f\u4e60\u60ef\u95ee\u9898\u2014\u2014\u6211\u4eec\u88ab Postman \u90a3\u4e2a\u7eff\u8272\u7684 200 \u60ef\u574f\u4e86\uff0c\u770b\u5230\u5b83\u5c31\u89c9\u5f97&#8221;\u8fd9\u4e2a\u63a5\u53e3\u8fc7\u4e86&#8221;\u3002<\/span><\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u4eca\u5929\u5206\u4eab\u4e00\u5957\u6211\u8fd9\u4e9b\u5e74\u6162\u6162\u78e8\u51fa\u6765\u7684<\/span><\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: rgb(255, 41, 65);\">\u56db\u7ef4\u9a8c\u8bc1\u6846\u67b6<\/span><\/span><\/strong><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u3002\u6211\u7528\u5b83\u5e26\u8fc7\u4e09\u4e2a\u56e2\u961f\uff0c\u63a5\u53e3\u7528\u4f8b\u7684\u6709\u6548\u8986\u76d6\u4ece\u4e0d\u5230 40% \u63d0\u5230 80% \u4ee5\u4e0a\uff0c\u6bcf\u4e2a\u8fed\u4ee3\u7684\u8fd4\u5de5\u5de5\u65f6\u780d\u6389\u4e00\u534a\u5de6\u53f3\u3002\u4e0d\u662f\u5f00\u53d1\u7a81\u7136\u53d8\u5f3a\u4e86\uff0c\u662f\u6211\u4eec\u628a\u95ee\u9898\u63d0\u524d\u6293\u51fa\u6765\u4e86\uff0c\u9700\u8981\u8fd4\u5de5\u7684\u4e1c\u897f\u672c\u6765\u5c31\u53d8\u5c11\u4e86\u3002<\/span><\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u56db\u4e2a\u7ef4\u5ea6\uff1a<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">\u7ed3\u6784\u6821\u9a8c \u2192 \u6570\u636e\u4e00\u81f4\u6027 \u2192 \u4e1a\u52a1\u94fe\u8def \u2192 \u5e76\u53d1\u5e42\u7b49<\/span><\/span><\/strong><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\">\u542c\u7740\u7b80\u5355\uff0c\u4f46\u6211\u89c1\u8fc7\u592a\u591a\u56e2\u961f\u5361\u5728\u5934\u4e00\u4e2a\u7ef4\u5ea6\u5c31\u52a8\u4e0d\u4e86\u3002\u54b1\u4eec\u4e00\u4e2a\u4e00\u4e2a\u62c6\uff0c\u5168\u7bc7\u90fd\u662f\u53ef\u4ee5\u76f4\u63a5\u6284\u8d70\u6539\u6539\u5c31\u80fd\u8dd1\u7684\u4ee3\u7801\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5148\u8bf4\u660e\u4e00\u4e0b\uff0c\u6587\u7ae0\u540e\u534a\u6bb5\u6709\u4e2a\u5b8c\u6574\u7684\u5b9e\u6218\u6848\u4f8b\u2014\u2014\u4e00\u4e2a\u7535\u5546\u8ba2\u5355\u63a5\u53e3\uff0c\u4ece\u63a5\u53e3\u6587\u6863\u5230\u7528\u4f8b\u8bbe\u8ba1\uff0c\u5230\u4ee3\u7801\uff0c\u5230\u8dd1\u51fa\u6765\u7684 4 \u4e2a\u771f\u5b9e\u95ee\u9898\uff0c\u5230\u4fee\u590d\u9a8c\u8bc1\uff0c\u5168\u6d41\u7a0b\u8d70\u4e00\u904d\u3002\u5982\u679c\u4f60\u65f6\u95f4\u7d27\uff0c\u53ef\u4ee5\u76f4\u63a5\u8df3\u5230\u7b2c 05 \u7ae0\u770b\u90a3\u4e2a\u6848\u4f8b\uff0c\u56de\u5934\u518d\u8865\u524d\u9762\u7684\u539f\u7406\u3002<\/span><\/p>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<h2 style=\"font-size: 21px;color: rgb(15, 52, 96);margin: 44px 0px 18px;padding-left: 14px;border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(255, 167, 38);font-weight: 700;margin-right: 8px;\"><span leaf=\"\">01<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u7ef4\u5ea6\u4e00\uff1a\u54cd\u5e94\u7ed3\u6784\u6821\u9a8c<\/span><\/span><\/h2>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">1.1 \u53ea\u9a8c\u72b6\u6001\u7801\uff0c\u5230\u5e95\u4f1a\u6f0f\u6389\u4ec0\u4e48<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">HTTP 200 \u8fd9\u4e2a\u4e1c\u897f\uff0c\u5b83\u53ea\u8bf4\u660e\u4e00\u4ef6\u4e8b\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u670d\u52a1\u5668\u628a\u8fd9\u4e2a\u8bf7\u6c42\u5904\u7406\u5b8c\u4e86\uff0c\u6ca1\u5d29<\/span><\/strong><span leaf=\"\">\u3002\u81f3\u4e8e\u5904\u7406\u5f97\u5bf9\u4e0d\u5bf9\u3001\u8fd4\u56de\u7684\u6570\u636e\u80fd\u4e0d\u80fd\u7528\uff0c\u5b83\u4e00\u4e2a\u5b57\u90fd\u6ca1\u8bf4\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6211\u968f\u624b\u4e3e\u4e09\u4e2a\u6211\u4eb2\u624b\u8e29\u8fc7\u7684\u5751\uff0c\u4f60\u516b\u6210\u4e5f\u9047\u5230\u8fc7\uff1a<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"3 2 []\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5751 A\uff1a\u8ba2\u5355\u53f7\u662f null\u3002<\/span><\/strong><span leaf=\"\">&nbsp;\u4e0b\u5355\u63a5\u53e3\u8fd4\u56de 200\uff0c<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">code<\/span><\/code><span leaf=\"\">&nbsp;\u4e5f\u662f 0\uff0c\u4f46&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">data.order_id<\/span><\/code><span leaf=\"\">&nbsp;\u662f&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">null<\/span><\/code><span leaf=\"\">\u3002\u524d\u7aef\u62ff\u7740 null \u53bb\u67e5\u8ba2\u5355\u3001\u53bb\u53d1\u8d77\u652f\u4ed8\u3001\u53bb\u7533\u8bf7\u9000\u6b3e\uff0c\u4e00\u8def\u5168\u5e9f\u3002\u800c\u6211\u4eec\u7684\u7528\u4f8b\u5462\uff1f\u53ea\u65ad\u8a00\u4e86\u72b6\u6001\u7801\uff0c\u7eff\u7684\u3002\u8fd9\u4e2a bug \u662f\u4ea7\u54c1\u81ea\u5df1\u70b9\u51fa\u6765\u7684\uff0c\u5f53\u65f6\u633a\u5c34\u5c2c\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"3 2 []\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5751 B\uff1a\u79ef\u5206\u5b57\u6bb5\u53d8\u6210\u4e86\u5b57\u7b26\u4e32\u3002<\/span><\/strong><span leaf=\"\">&nbsp;\u7528\u6237\u79ef\u5206\u67e5\u8be2\u63a5\u53e3\uff0c<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">points<\/span><\/code><span leaf=\"\">&nbsp;\u672c\u8be5\u662f\u6574\u6570&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">1000<\/span><\/code><span leaf=\"\">\uff0c\u67d0\u6b21\u6539\u52a8\u540e\u53d8\u6210\u4e86\u5b57\u7b26\u4e32&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">\"1000\"<\/span><\/code><span leaf=\"\">\u3002\u540e\u7aef\u540c\u5b66\u8bf4&#8221;\u503c\u6ca1\u53d8\u554a&#8221;\uff0c\u786e\u5b9e\u503c\u6ca1\u53d8\uff0c\u4f46\u524d\u7aef\u505a&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">points + earned<\/span><\/code><span leaf=\"\">&nbsp;\u7684\u65f6\u5019\u53d8\u6210\u4e86\u5b57\u7b26\u4e32\u62fc\u63a5\uff0c\u9875\u9762\u4e0a\u663e\u793a&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">1000200<\/span><\/code><span leaf=\"\">\u3002\u7528\u6237\u4ee5\u4e3a\u81ea\u5df1\u4e00\u591c\u66b4\u5bcc\uff0c\u5ba2\u670d\u89e3\u91ca\u4e86\u4e00\u5929\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"3 2 []\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5751 C\uff1a\u8fd4\u56de\u4e86\u4e0d\u8be5\u8fd4\u56de\u7684\u5b57\u6bb5\u3002<\/span><\/strong><span leaf=\"\">&nbsp;\u5546\u54c1\u8be6\u60c5\u63a5\u53e3\u91cc\u6084\u6084\u591a\u4e86\u4e2a&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">cost_price<\/span><\/code><span leaf=\"\">\uff08\u6210\u672c\u4ef7\uff09\u3002\u524d\u7aef\u6ca1\u6e32\u67d3\uff0c\u770b\u7740\u6ca1\u4e8b\u3002\u4f46\u63a5\u53e3\u54cd\u5e94\u662f\u660e\u6587\u7684\uff0c\u6d4f\u89c8\u5668 F12 \u4e00\u5f00\u5c31\u80fd\u770b\u89c1\u3002\u8fd9\u79cd\u4e8b\u4e00\u65e6\u88ab\u622a\u56fe\u53d1\u51fa\u53bb\uff0c\u5c31\u4e0d\u662f\u6280\u672f\u95ee\u9898\u4e86\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u8fd9\u4e09\u4e2a bug \u6709\u4e2a\u5171\u540c\u70b9\uff1a<\/span><\/strong><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);text-decoration: underline;\">\u63a5\u53e3\u90fd\u8fd4\u56de 200\uff0c\u7528\u4f8b\u90fd PASS\uff0c\u95ee\u9898\u90fd\u662f\u4e0a\u7ebf\u540e\u624d\u53d1\u73b0\u7684\u3002<\/span><\/span><\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(255, 41, 65);\">\u771f\u5b9e\u6545\u969c\u590d\u76d8 \u00b7 \u88ab try \u541e\u6389\u7684\u5f02\u5e38<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u67d0\u5e74\u53cc\u5341\u4e00\u9884\u70ed\uff0c\u6211\u4eec\u7684\u4e0b\u5355\u63a5\u53e3\u5728\u5927\u4fc3\u5f53\u5929\u51fa\u73b0\u4e86\u4e00\u6279&#8221;\u5047\u6210\u529f&#8221;\u8ba2\u5355\uff1a\u7528\u6237\u770b\u5230\u4e0b\u5355\u6210\u529f\uff0c\u8ba2\u5355\u8868\u91cc\u6709\u8bb0\u5f55\uff0c\u4f46\u5e93\u5b58\u4e00\u4ef6\u6ca1\u6263\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6252\u4ee3\u7801\u624d\u53d1\u73b0\uff0c\u5e93\u5b58\u6263\u51cf\u90a3\u6bb5\u903b\u8f91\u88ab\u5305\u5728\u4e00\u4e2a\u5927&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">try<\/span><\/code><span leaf=\"\">&nbsp;\u91cc\uff0c<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">except<\/span><\/code><span leaf=\"\">&nbsp;\u5757\u53ea\u6253\u4e86\u4e00\u884c\u65e5\u5fd7\u5c31&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">pass<\/span><\/code><span leaf=\"\">&nbsp;\u6389\u4e86\uff0c\u5916\u5c42\u7167\u6837\u8fd4\u56de 200\u3002\u6d4b\u8bd5\u73af\u5883\u6570\u636e\u91cf\u5c0f\u3001\u5e93\u5b58\u670d\u52a1\u54cd\u5e94\u5feb\uff0c\u90a3\u4e2a\u5f02\u5e38\u5206\u652f\u4ece\u6765\u6ca1\u88ab\u89e6\u53d1\u8fc7\uff0c\u538b\u6839\u6d4b\u4e0d\u51fa\u6765\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u540e\u6765\u6211\u4eec\u52a0\u4e86\u4e00\u6761\u786c\u89c4\u5219\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u51e1\u662f\u6d89\u53ca\u94b1\u548c\u5e93\u5b58\u7684\u63a5\u53e3\uff0c\u8fd4\u56de\u4f53\u7684\u6bcf\u4e2a\u5173\u952e\u5b57\u6bb5\u90fd\u8981\u88ab\u65ad\u8a00\uff0c\u540c\u65f6\u5fc5\u987b\u67e5\u5e93\u786e\u8ba4\u3002<\/span><\/strong><span leaf=\"\">\u8fd9\u6761\u89c4\u5219\u5c31\u662f\u56db\u7ef4\u6846\u67b6\u91cc\u524d\u4e24\u7ef4\u7684\u96cf\u5f62\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">1.2 \u7528 JSON Schema \u628a\u9884\u671f\u7ed3\u6784\u5199\u6b7b<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u89e3\u6cd5\u5176\u5b9e\u5f88\u6734\u7d20\uff1a<\/span><\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">\u628a\u63a5\u53e3&#8221;\u5e94\u8be5\u957f\u4ec0\u4e48\u6837&#8221;\u63d0\u524d\u5199\u4e0b\u6765\uff0c\u6bcf\u6b21\u8c03\u7528\u5b8c\u81ea\u52a8\u6bd4\u5bf9\u3002<\/span><\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">Python \u91cc\u7528&nbsp;<\/span><\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">jsonschema<\/span><\/span><\/code><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;\">&nbsp;\u8fd9\u4e2a\u5e93\u5c31\u591f\u4e86\u3002\u5b83\u7684\u597d\u5904\u662f\u2014\u2014\u4f60\u5199\u4e00\u4efd Schema\uff0c\u540e\u9762\u4e0a\u767e\u6761\u7528\u4f8b\u7684\u7ed3\u6784\u6821\u9a8c\u5168\u90fd\u81ea\u52a8\u8986\u76d6\uff0c\u4e0d\u7528\u6bcf\u6761\u7528\u4f8b\u90fd\u624b\u5199\u4e00\u5806 assert\u3002<\/span><\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">\u547d\u4ee4\u884c \u00b7 \u5b89\u88c5\u4f9d\u8d56<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"nginx\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># jsonschema \u505a\u7ed3\u6784\u6821\u9a8c\uff0cpytest-xdist \u7528\u6765\u5e76\u884c\u8dd1\u7528\u4f8b<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">pip<\/span>&nbsp;install jsonschema requests pytest pytest-xdist pymysql pyyaml<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u4e0b\u9762\u8fd9\u4efd Schema \u662f\u6211\u4eec\u7ebf\u4e0a\u8ba2\u5355\u521b\u5efa\u63a5\u53e3\u5728\u7528\u7684\uff08\u8131\u654f\u8fc7\uff09\uff0c\u5b83\u540c\u65f6\u7ba1\u4f4f\u4e86\u5b57\u6bb5\u5b58\u5728\u6027\u3001\u7c7b\u578b\u3001\u679a\u4e3e\u503c\u3001\u5b57\u7b26\u4e32\u683c\u5f0f\u3001\u6570\u5b57\u8303\u56f4\u3001\u6570\u7ec4\u957f\u5ea6\u8fd9\u516d\u4ef6\u4e8b\uff1a<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"background-color: rgb(0, 213, 255);\">order_schema.py \u2014 \u8ba2\u5355\u521b\u5efa\u63a5\u53e3\u7684\u54cd\u5e94\u7ed3\u6784\u5b9a\u4e49<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># JSON Schema \u5b98\u65b9\u6587\u6863: https:\/\/json-schema.org\/<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;jsonschema<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============ \u8ba2\u5355\u521b\u5efa\u63a5\u53e3 POST \/api\/v1\/orders ============<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u8fd9\u4efd Schema \u5199\u4e00\u6b21\uff0c\u6240\u6709\u4e0b\u5355\u76f8\u5173\u7528\u4f8b\u7684\u7ed3\u6784\u6821\u9a8c\u5c31\u90fd\u8986\u76d6\u4e86<\/span><\/span><\/code><code><span leaf=\"\">ORDER_CREATE_SCHEMA = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"$schema\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"http:\/\/json-schema.org\/draft-07\/schema#\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"object\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># required\uff1a\u8fd9\u4e09\u4e2a\u9876\u5c42\u5b57\u6bb5\u5c11\u4e00\u4e2a\u5c31\u76f4\u63a5\u62a5\u9519<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"required\"<\/span>: [<span class=\"code-snippet__string\">\"code\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"message\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"data\"<\/span>],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"properties\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"code\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"integer\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"enum\"<\/span>: [<span class=\"code-snippet__number\">0<\/span>], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u6210\u529f\u573a\u666f\u53ea\u63a5\u53d7 0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"message\"<\/span>: {<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"string\"<\/span>}, &nbsp;<span class=\"code-snippet__comment\"># \u5141\u8bb8\u7a7a\u4e32\uff0c\u4f46\u4e0d\u63a5\u53d7 null<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"data\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"object\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"required\"<\/span>: [<span class=\"code-snippet__string\">\"order_id\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"status\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"total_amount\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"properties\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8ba2\u5355\u53f7\uff1a20 \u4f4d\u5927\u5199\u5b57\u6bcd + \u6570\u5b57\uff0c\u9632 null\u3001\u9632\u7a7a\u4e32\u3001\u9632\u622a\u65ad<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"order_id\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"string\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"pattern\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"^[A-Z0-9]{20}$\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8ba2\u5355\u72b6\u6001\uff1a\u679a\u4e3e\u5361\u6b7b\uff0c\u9632\u540e\u7aef\u5077\u5077\u52a0\u65b0\u72b6\u6001\u6ca1\u901a\u77e5\u6d4b\u8bd5<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"status\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"string\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"enum\"<\/span>: [<span class=\"code-snippet__string\">\"pending\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"paid\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"shipped\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__string\">\"delivered\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"completed\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"closed\"<\/span>],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u91d1\u989d\uff1anumber \u7c7b\u578b + \u8303\u56f4\uff0c\u9632\u8d1f\u6570\u3001\u9632 0 \u5143\u5355\u3001\u9632\u5b57\u7b26\u4e32\u91d1\u989d<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"total_amount\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"number\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"minimum\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0.01<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"maximum\"<\/span>:&nbsp;<span class=\"code-snippet__number\">999999.99<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u65f6\u95f4\uff1aISO 8601\uff0c\u9632\u540e\u7aef\u67d0\u5929\u6539\u6210\u6beb\u79d2\u65f6\u95f4\u6233<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"created_at\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"string\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"pattern\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5546\u54c1\u5217\u8868\uff1a\u81f3\u5c11 1 \u4ef6\uff0c\u6bcf\u4ef6\u7684 sku\/\u6570\u91cf\/\u5355\u4ef7\u90fd\u8981\u5408\u6cd5<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"array\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"minItems\"<\/span>:&nbsp;<span class=\"code-snippet__number\">1<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"maxItems\"<\/span>:&nbsp;<span class=\"code-snippet__number\">99<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"object\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"required\"<\/span>: [<span class=\"code-snippet__string\">\"sku_id\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"price\"<\/span>],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"properties\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"sku_id\"<\/span>: {<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"string\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"pattern\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"^[A-Z0-9]{10}$\"<\/span>},<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>: {<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"integer\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"minimum\"<\/span>:&nbsp;<span class=\"code-snippet__number\">1<\/span>},<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"price\"<\/span>: {<span class=\"code-snippet__string\">\"type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"number\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"minimum\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0<\/span>},<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5173\u952e\u4e00\u884c\uff1a\u4e0d\u5141\u8bb8\u51fa\u73b0 Schema \u91cc\u6ca1\u5b9a\u4e49\u7684\u5b57\u6bb5<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6210\u672c\u4ef7\u3001\u5185\u90e8\u5907\u6ce8\u8fd9\u7c7b\u5b57\u6bb5\u4e00\u65e6\u6f0f\u51fa\u6765\uff0c\u8fd9\u91cc\u76f4\u63a5\u7ea2<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"additionalProperties\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">False<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; },<\/span><\/code><code><span leaf=\"\">}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">validate_order_response<\/span>(<span class=\"code-snippet__params\">response_json:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">dict<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__literal\">None<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u6821\u9a8c\u4e0b\u5355\u63a5\u53e3\u54cd\u5e94\u7ed3\u6784\uff0c\u5931\u8d25\u65f6\u629b\u51fa\u5e26\u5b9a\u4f4d\u4fe1\u606f\u7684\u65ad\u8a00\u9519\u8bef\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; jsonschema.validate(instance=response_json, schema=ORDER_CREATE_SCHEMA)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;jsonschema.ValidationError&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># e.path \u80fd\u544a\u8bc9\u4f60\u662f\u54ea\u4e00\u5c42\u7684\u54ea\u4e2a\u5b57\u6bb5\u6302\u4e86\uff0c\u6392\u67e5\u65f6\u7279\u522b\u7701\u4e8b<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; path =&nbsp;<span class=\"code-snippet__string\">\" \u2192 \"<\/span>.join(<span class=\"code-snippet__built_in\">str<\/span>(p)&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;p&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;e.path)&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u6839\u8282\u70b9\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">raise<\/span>&nbsp;AssertionError(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u54cd\u5e94\u7ed3\u6784\u6821\u9a8c\u5931\u8d25\\n &nbsp;\u4f4d\u7f6e:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{path}<\/span><\/span><span class=\"code-snippet__string\">\\n &nbsp;\u539f\u56e0:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e.message}<\/span><\/span><span class=\"code-snippet__string\">\\n &nbsp;\u5b9e\u9645\u503c:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e.instance}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; )&nbsp;<span class=\"code-snippet__keyword\">from<\/span>&nbsp;e<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;jsonschema.SchemaError&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">raise<\/span>&nbsp;RuntimeError(<span class=\"code-snippet__string\">f\"Schema \u81ea\u5df1\u5199\u9519\u4e86\uff0c\u5148\u6539 Schema:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">from<\/span>&nbsp;e<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(172, 57, 255);font-weight: bold;\">\u8fd9\u4efd Schema \u91cc\u7279\u522b\u70b9\u51fa\u4e09\u884c\uff0c\u5b83\u4eec\u662f\u771f\u6b63\u5e72\u6d3b\u7684\uff1a<\/span><\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\"><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">\"pattern\": \"^[A-Z0-9]{20}$\"<\/span><\/code><br \/>\n<section><span leaf=\"\">&nbsp;\u2014\u2014 \u8ba2\u5355\u53f7\u662f null\u3001\u662f\u7a7a\u4e32\u3001\u88ab\u622a\u65ad\u6210 18 \u4f4d\uff0c\u5168\u90fd\u4f1a\u7ea2\u3002\u524d\u9762\u8bf4\u7684\u5751 A \u5c31\u662f\u88ab\u5b83\u6321\u4e0b\u6765\u7684\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">\"type\": \"number\"<\/span><\/code><br \/>\n<section><span leaf=\"\">&nbsp;\u2014\u2014 \u91d1\u989d\u4e00\u65e6\u53d8\u6210\u5b57\u7b26\u4e32\u5c31\u7ea2\u3002\u5751 B \u90a3\u79cd\u7c7b\u578b\u6f02\u79fb\uff0cSchema \u662f\u5929\u7136\u514b\u661f\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">\"additionalProperties\": False<\/span><\/code><br \/>\n<section><span leaf=\"\">&nbsp;\u2014\u2014 \u591a\u51fa\u6765\u7684\u5b57\u6bb5\u76f4\u63a5\u7ea2\u3002\u5751 C \u7684\u6210\u672c\u4ef7\u6cc4\u9732\uff0c\u5c31\u662f\u8fd9\u4e00\u884c\u6293\u5230\u7684\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-indent: 0px;text-align: center;\"><span leaf=\"\">\ud83d\udca1&nbsp;<span textstyle=\"\" style=\"font-size: 16px;font-weight: bold;\">\u4e00\u4e2a\u5bb9\u6613\u88ab\u5ffd\u7565\u7684\u7ea2\u5229<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">Schema \u5176\u5b9e\u662f\u63a5\u53e3\u6587\u6863\u7684&#8221;\u53ef\u6267\u884c\u7248\u672c&#8221;\u3002\u540e\u7aef\u6539\u5b57\u6bb5\u6ca1\u901a\u77e5\u4f60\uff1fSchema \u6821\u9a8c\u7acb\u523b\u5931\u8d25\uff0c\u6bd4\u7b49\u524d\u7aef\u53cd\u9988\u5feb\u5f97\u591a\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u800c\u4e14\u5f88\u591a\u56e2\u961f\u7684\u524d\u7aef\u4f1a\u81ea\u5df1\u5199\u515c\u5e95\u903b\u8f91\uff08<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">data.order_id || ''<\/span><\/code><span leaf=\"\">\uff09\uff0c\u5b57\u6bb5\u6ca1\u4e86\u9875\u9762\u4e5f\u4e0d\u62a5\u9519\u2014\u2014\u95ee\u9898\u53cd\u800c\u88ab\u85cf\u8d77\u6765\u4e86\uff0c\u7b49\u5230\u8d22\u52a1\u5bf9\u8d26\u624d\u53d1\u73b0\u3002Schema \u4e0d\u4f1a\u66ff\u8c01\u515c\u5e95\uff0c\u8fd9\u6b63\u662f\u6211\u4eec\u8981\u7684\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">1.3 \u5728 Pytest \u91cc\u628a\u5b83\u53d8\u6210\u4e00\u884c\u65ad\u8a00<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">Schema \u5199\u597d\u4e86\uff0c\u522b\u8ba9\u6bcf\u4e2a\u4eba\u5728\u81ea\u5df1\u7684\u7528\u4f8b\u6587\u4ef6\u91cc&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">import jsonschema<\/span><\/code><span leaf=\"\">&nbsp;\u7136\u540e\u5404\u5199\u5404\u7684\u3002\u5c01\u88c5\u6210\u4e00\u4e2a\u901a\u7528\u65ad\u8a00\uff0c\u653e\u516c\u5171\u6a21\u5757\u91cc\uff0c\u5168\u7ec4\u7edf\u4e00\u8c03\u7528\uff1a<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"background-color: rgb(0, 213, 255);\">utils\/assertions.py \u2014 \u901a\u7528\u65ad\u8a00\u5c01\u88c5<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;requests<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;jsonschema<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;typing&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;<span class=\"code-snippet__type\">Dict<\/span>,&nbsp;<span class=\"code-snippet__type\">Any<\/span>,&nbsp;<span class=\"code-snippet__type\">Optional<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">assert_schema<\/span>(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; response: requests.Response,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; schema:&nbsp;<span class=\"code-snippet__type\">Dict<\/span>[<span class=\"code-snippet__built_in\">str<\/span>,&nbsp;<span class=\"code-snippet__type\">Any<\/span>],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; status_code:&nbsp;<span class=\"code-snippet__built_in\">int<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__number\">200<\/span>,<\/span><\/code><code><span leaf=\"\">) -&gt;&nbsp;<span class=\"code-snippet__built_in\">dict<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7ef4\u5ea6\u4e00 \u00b7 \u7ed3\u6784\u6821\u9a8c\u7edf\u4e00\u5165\u53e3<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u53c2\u6570:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; response: &nbsp; &nbsp;requests \u7684\u54cd\u5e94\u5bf9\u8c61<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; schema: &nbsp; &nbsp; &nbsp;JSON Schema \u5b57\u5178<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; status_code: \u671f\u671b\u7684 HTTP \u72b6\u6001\u7801\uff0c\u9ed8\u8ba4 200<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd4\u56de:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; \u89e3\u6790\u540e\u7684\u54cd\u5e94 JSON\uff08dict\uff09\uff0c\u65b9\u4fbf\u540e\u7eed\u7ee7\u7eed\u65ad\u8a00\u4e1a\u52a1\u5b57\u6bb5<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># Step1 \u5148\u5361 HTTP \u72b6\u6001\u7801\uff0c\u5931\u8d25\u65f6\u628a\u54cd\u5e94\u4f53\u524d 300 \u5b57\u6253\u51fa\u6765<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;response.status_code == status_code, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e00\u00b7\u7ed3\u6784] HTTP \u72b6\u6001\u7801\u4e0d\u7b26\uff1a\u671f\u671b&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{status_code}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u5b9e\u9645&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{response.status_code}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u54cd\u5e94\u4f53:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{response.text[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">300<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># Step2 \u80fd\u4e0d\u80fd\u89e3\u6790\u6210 JSON\uff0c\u8fd9\u4e00\u6b65\u7ecf\u5e38\u6302\u5728\u7f51\u5173\u8fd4\u56de HTML \u9519\u8bef\u9875\u4e0a<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; data = response.json()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;ValueError:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; pytest.fail(<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e00\u00b7\u7ed3\u6784] \u54cd\u5e94\u4e0d\u662f\u5408\u6cd5 JSON\uff1a<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{response.text[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">300<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># Step3 \u7ed3\u6784\u6821\u9a8c<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; jsonschema.validate(instance=data, schema=schema)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;jsonschema.ValidationError&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; path =&nbsp;<span class=\"code-snippet__string\">\" \u2192 \"<\/span>.join(<span class=\"code-snippet__built_in\">str<\/span>(p)&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;p&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;e.path)&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;<span class=\"code-snippet__string\">\"\u6839\u8282\u70b9\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; pytest.fail(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e00\u00b7\u7ed3\u6784] \u6821\u9a8c\u5931\u8d25\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\" &nbsp;\u4f4d\u7f6e &nbsp;:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{path}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\" &nbsp;\u539f\u56e0 &nbsp;:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e.message}<\/span><\/span><span class=\"code-snippet__string\">\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\" &nbsp;\u5b9e\u9645\u503c:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e.instance}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;data<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">assert_biz_code<\/span>(<span class=\"code-snippet__params\">response: requests.Response, expected:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">int<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">0<\/span><\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">dict<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6821\u9a8c\u4e1a\u52a1\u72b6\u6001\u7801\uff08\u54cd\u5e94\u4f53\u91cc\u7684 code \u5b57\u6bb5\uff09\uff0c\u5e76\u628a data \u8fd4\u56de\u51fa\u6765<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u56e2\u961f\u91cc\u5e38\u89c1\u7684\u4e1a\u52a1\u7801\u7ea6\u5b9a\uff1a<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; \u6210\u529f<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; 401 \u672a\u767b\u5f55 \/ Token \u8fc7\u671f<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; 403 \u65e0\u6743\u9650<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; 4004 \u5e93\u5b58\u4e0d\u8db3<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; 4005 \u4f18\u60e0\u5238\u4e0d\u53ef\u7528<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; body = response.json()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; actual = body.get(<span class=\"code-snippet__string\">\"code\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;actual == expected, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e00\u00b7\u7ed3\u6784] \u4e1a\u52a1\u7801\u4e0d\u7b26\uff1a\u671f\u671b&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{expected}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u5b9e\u9645&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{actual}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u63a5\u53e3\u63d0\u793a:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{body.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'message'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">,&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'N\/A'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;body.get(<span class=\"code-snippet__string\">\"data\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;{}<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u7528\u8d77\u6765\u5c31\u4e24\u884c\uff1a<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">\u7528\u4f8b\u91cc\u7684\u8c03\u7528\u65b9\u5f0f<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"ini\"><code><span leaf=\"\"><span class=\"code-snippet__attr\">resp<\/span>&nbsp;= session.post(f<span class=\"code-snippet__string\">\"{BASE_URL}\/api\/v1\/orders\"<\/span>, json=payload)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attr\">data<\/span>&nbsp;= assert_schema(resp, ORDER_CREATE_SCHEMA) &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7ed3\u6784 + \u72b6\u6001\u7801\u4e00\u8d77\u8fc7<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attr\">order_id<\/span>&nbsp;= data[<span class=\"code-snippet__string\">\"data\"<\/span>][<span class=\"code-snippet__string\">\"order_id\"<\/span>] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u62ff\u5230\u5c31\u80fd\u5f80\u4e0b\u4f20<\/span><\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">1.4 \u8fb9\u754c\u503c\uff1aSchema \u80fd\u66ff\u4f60\u76ef\u4f4f\u7684\u90a3\u4e9b\u7ec6\u8282<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">Schema \u7684\u4ef7\u503c\u4e0d\u53ea\u662f&#8221;\u5b57\u6bb5\u5728\u4e0d\u5728&#8221;\uff0c\u66f4\u5728\u4e8e\u5b83\u80fd\u4e00\u6b21\u6027\u628a\u8fb9\u754c\u89c4\u5219\u5168\u9489\u6b7b\u3002\u6211\u6574\u7406\u4e86\u4e00\u5f20\u5e38\u7528\u5bf9\u7167\u8868\uff0c\u4f60\u53ef\u4ee5\u7167\u7740\u5f80\u81ea\u5df1\u7684 Schema \u91cc\u8865\uff1a<\/span><\/p>\n<table style=\"width: 704px;border-collapse: collapse;font-size: 14px;background: rgb(255, 255, 255);\">\n<thead>\n<tr>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u5b57\u6bb5\u7c7b\u578b<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u8981\u76ef\u7684\u8fb9\u754c<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">Schema \u5173\u952e\u5b57<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u80fd\u6321\u4f4f\u4ec0\u4e48\u7ebf\u4e0a\u95ee\u9898<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5b57\u7b26\u4e32<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u957f\u5ea6\u4e0b\u9650 \/ \u4e0a\u9650<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">minLength \/ maxLength<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8d85\u957f\u6635\u79f0\u6491\u7206\u5b57\u6bb5\u3001\u7a7a\u4e32\u5f53\u6709\u6548\u503c<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5b57\u7b26\u4e32<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u683c\u5f0f<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">pattern \/ format<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u624b\u673a\u53f7\u5c11\u4e00\u4f4d\u3001\u90ae\u7bb1\u7f3a @\u3001\u8ba2\u5355\u53f7\u88ab\u622a\u65ad<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6570\u5b57<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u53d6\u503c\u533a\u95f4<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">minimum \/ maximum<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8d1f\u6570\u91d1\u989d\u3001\u5e93\u5b58\u6263\u6210 -1\u30010 \u5143\u8ba2\u5355<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6570\u5b57<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u7c7b\u578b\u7cbe\u5ea6<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">type: integer \/ number<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u91d1\u989d\u53d8\u5b57\u7b26\u4e32\u3001\u6570\u91cf\u51fa\u73b0\u5c0f\u6570<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u679a\u4e3e<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5141\u8bb8\u503c\u6e05\u5355<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">enum<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u540e\u7aef\u5077\u52a0\u72b6\u6001\u6ca1\u540c\u6b65\u3001\u62fc\u5199\u9519\u7684\u72b6\u6001\u503c<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6570\u7ec4<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5143\u7d20\u4e2a\u6570<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">minItems \/ maxItems<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8fd4\u56de\u7a7a\u6570\u7ec4\u5f53\u6210\u529f\u3001\u6279\u91cf\u63a5\u53e3\u4e0d\u9650\u6d41<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5bf9\u8c61<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u989d\u5916\u5b57\u6bb5<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">additionalProperties<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5185\u90e8\u5b57\u6bb5\u6cc4\u9732\u3001\u810f\u5b57\u6bb5\u6c61\u67d3\u524d\u7aef<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u53ef\u7a7a\u6027<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u662f\u5426\u5141\u8bb8 null<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">type: [&#8220;string&#8221;,&#8221;null&#8221;]<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8be5\u6709\u503c\u7684\u5b57\u6bb5\u8fd4\u56de null<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u53ef\u80fd\u6709\u540c\u5b66\u8981\u95ee\u4e86\uff1a\u6bcf\u4e2a\u63a5\u53e3\u90fd\u5199\u8fd9\u4e48\u4e00\u5927\u5768 Schema\uff0c\u662f\u4e0d\u662f\u592a\u8d39\u65f6\u95f4\uff1f<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6211\u7684\u5b9e\u9645\u505a\u6cd5\u662f\u5206\u7ea7\uff1a<\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6838\u5fc3\u63a5\u53e3\uff08\u6d89\u53ca\u94b1\u3001\u5e93\u5b58\u3001\u7528\u6237\u8eab\u4efd\u3001\u6743\u9650\uff09<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u5fc5\u987b\u5199\u5b8c\u6574 Schema\uff0c\u4e00\u4e2a\u5b57\u6bb5\u90fd\u4e0d\u653e\u8fc7\u3002\u8fd9\u7c7b\u63a5\u53e3\u51fa\u95ee\u9898\u5c31\u662f\u8d44\u635f\u6216\u8005\u6570\u636e\u6cc4\u9732\uff0c\u6ca1\u5f97\u5546\u91cf\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u666e\u901a\u4e1a\u52a1\u63a5\u53e3<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u5199\u4e00\u4efd&#8221;\u7cbe\u7b80 Schema&#8221;\uff0c\u53ea\u5217 required \u91cc\u7684\u5173\u952e\u5b57\u6bb5 + \u7c7b\u578b\uff0c\u8fb9\u754c\u89c4\u5219\u6311\u91cd\u70b9\u5199\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u8fb9\u7f18\u67e5\u8be2\u3001\u5386\u53f2\u9057\u7559\u63a5\u53e3<\/span><\/strong><br \/>\n<section><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">assert \"xxx\" in data<\/span><\/code><span leaf=\"\">&nbsp;\u8fd9\u79cd\u8f7b\u6821\u9a8c\u5c31\u884c\uff0c\u522b\u4e3a\u4e86\u5b8c\u7f8e\u4e3b\u4e49\u628a\u65f6\u95f4\u8017\u5728\u8fd9\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6709\u4e2a\u7ecf\u9a8c\u6570\u5b57\u6211\u5370\u8c61\u5f88\u6df1\uff1a\u4e00\u4e2a\u63a5\u53e3\u7684\u54cd\u5e94\u5b57\u6bb5\u91cc\uff0c\u5927\u7ea6 20% \u662f\u5173\u952e\u5b57\u6bb5\uff0c\u5269\u4e0b 80% \u662f\u8f85\u52a9\u5c55\u793a\u5b57\u6bb5\u3002Schema \u7684 required \u53ea\u9700\u8981\u76ef\u4f4f\u90a3 20%\uff0c\u5c31\u80fd\u8986\u76d6\u7edd\u5927\u90e8\u5206\u98ce\u9669\u3002\u4e0d\u8981\u8ffd\u6c42\u628a\u6bcf\u4e2a\u5b57\u6bb5\u90fd\u5b9a\u4e49\u5f97\u5b8c\u7f8e\uff0c\u90a3\u662f\u5728\u7ed9\u81ea\u5df1\u627e\u6d3b\u5e72\u3002<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\">\ud83d\udca1&nbsp;<span textstyle=\"\" style=\"font-size: 16px;font-weight: bold;\">Schema \u600e\u4e48\u7ef4\u62a4\u624d\u4e0d\u7d2f<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u628a Schema \u6587\u4ef6\u548c\u63a5\u53e3\u6587\u6863\u653e\u5728\u540c\u4e00\u4e2a\u76ee\u5f55\uff0c\u547d\u540d\u5bf9\u9f50\uff08<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">order_create.json<\/span><\/code><span leaf=\"\">&nbsp;\u5bf9\u5e94&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">POST \/orders<\/span><\/code><span leaf=\"\">\uff09\u3002\u518d\u72e0\u4e00\u70b9\uff0c\u628a Schema \u6821\u9a8c\u585e\u8fdb CI\uff1a\u540e\u7aef\u5408\u4ee3\u7801\u524d\u8dd1\u4e00\u904d\u5951\u7ea6\u6d4b\u8bd5\uff0c\u7ed3\u6784\u53d8\u4e86\u5f53\u573a\u62e6\u4f4f\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u6837\u63a5\u53e3\u8d28\u91cf\u7684\u95e8\u7981\u5c31\u524d\u79fb\u5230\u4e86\u5f00\u53d1\u9636\u6bb5\uff0c\u800c\u4e0d\u662f\u7b49\u63d0\u6d4b\u4e86\u624d\u7531\u6d4b\u8bd5\u6765\u53d1\u73b0\u2014\u2014\u8fd9\u4e2d\u95f4\u7701\u4e0b\u6765\u7684\u6c9f\u901a\u6210\u672c\uff0c\u6bd4\u4f60\u60f3\u8c61\u7684\u5927\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 19px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 700;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 19px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 700;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u63a5\u53e3\u6d4b\u8bd5\u56db\u7ef4\u9a8c\u8bc1\u6a21\u578b<\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(136, 136, 136);font-weight: bold;font-style: italic;\">\u4e00\u6b21\u63a5\u53e3\u8c03\u7528\u8981\u8dd1\u5b8c\u7684\u56db\u9053\u5173\uff0c\u4ee5\u53ca\u6bcf\u9053\u5173\u7684\u68c0\u67e5\u70b9<\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.4527777777777778\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" type=\"block\" data-imgfileid=\"100000655\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BWmfcibGhS1Kyu0eibn7XgMYicwo1vFJ5avhlV5lVeFh3SJmSp6euibicjPABn2UJL2yFPsnoJSs8FKBNQ3mhgOPUMLevW0J0icubHG9b8iaeZVKmg\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<h2 style=\"font-size: 21px;color: rgb(15, 52, 96);margin: 44px 0px 18px;padding-left: 14px;border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(255, 167, 38);font-weight: 700;margin-right: 8px;\"><span leaf=\"\">02<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u7ef4\u5ea6\u4e8c\uff1a\u6570\u636e\u5e93\u4e00\u81f4\u6027\u6821\u9a8c<\/span><\/span><\/h2>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">2.1 \u63a5\u53e3\u8fd4\u56de\u6210\u529f \u2260 \u6570\u636e\u771f\u7684\u5199\u8fdb\u53bb\u4e86<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u8fd9\u662f\u6211\u8ba4\u4e3a\u88ab\u4f4e\u4f30\u5f97\u8f83\u4e25\u91cd\u7684\u4e00\u4e2a\u7ef4\u5ea6\u3002<\/span><\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u63a5\u53e3\u8fd4\u56de 200\uff0c\u4e0d\u4ee3\u8868\u6570\u636e\u843d\u5e93\u4e86\u3002\u6211\u5217\u51e0\u79cd\u771f\u5b9e\u53d1\u751f\u8fc7\u7684\u60c5\u51b5\uff1a<\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u4e8b\u52a1\u6084\u6084\u56de\u6eda\u4e86<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u540e\u7aef\u5728\u4e00\u4e2a\u5927\u4e8b\u52a1\u91cc\u5e72\u4e86\u4e09\u4ef6\u4e8b\uff0c\u7b2c 3 \u4ef6\u5931\u8d25\u89e6\u53d1\u56de\u6eda\uff0c\u4f46\u5f02\u5e38\u88ab catch \u4f4f\u4e86\uff0c\u5916\u5c42\u7167\u6837\u8fd4\u56de\u6210\u529f\u3002\u54cd\u5e94\u4f53\u770b\u8d77\u6765\u4e00\u5207\u6b63\u5e38\uff0c\u5e93\u91cc\u5565\u4e5f\u6ca1\u6709\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5f02\u6b65\u5199\u5165\u8fd8\u6ca1\u843d\u5730<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u63a5\u53e3\u53ea\u5f80 MQ \u91cc\u4e22\u4e86\u6761\u6d88\u606f\u5c31\u8fd4\u56de\u4e86\uff0c\u6d88\u8d39\u8005\u6162\u534a\u62cd\u3002\u4f60\u7d27\u63a5\u7740\u67e5\u5e93\uff0c\u67e5\u4e86\u4e2a\u5bc2\u5bde\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5199\u9519\u5e93\u4e86<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u8fd9\u4e2a\u542c\u8d77\u6765\u79bb\u8c31\u4f46\u771f\u53d1\u751f\u8fc7\u2014\u2014\u914d\u7f6e\u6587\u4ef6\u91cc\u6570\u636e\u6e90\u5199\u9519\uff0c\u6d4b\u8bd5\u73af\u5883\u7684\u5199\u64cd\u4f5c\u6253\u5230\u4e86\u53e6\u4e00\u5957\u5e93\u4e0a\u3002\u63a5\u53e3\u8fd4\u56de\u6210\u529f\uff0c\u4f60\u67e5\u7684\u90a3\u4e2a\u5e93\u5f53\u7136\u6ca1\u6570\u636e\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u7f13\u5b58\u6ca1\u66f4\u65b0<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u5199\u63a5\u53e3\u66f4\u65b0\u4e86 DB\uff0c\u4f46\u7f13\u5b58 key \u6ca1\u6e05\u3002\u67e5\u8be2\u63a5\u53e3\u4ece Redis \u62ff\u5230\u65e7\u503c\u8fd4\u56de\u7ed9\u4f60\uff0c\u4f60\u8fd8\u4ee5\u4e3a\u5199\u5165\u5931\u8d25\u4e86\u3002\u53cd\u8fc7\u6765\u7684\u60c5\u51b5\u66f4\u5751\uff1aDB \u66f4\u65b0\u5931\u8d25\u4f46\u7f13\u5b58\u5199\u6210\u529f\u4e86\uff0c\u67e5\u51fa\u6765\u662f\u65b0\u503c\uff0c\u5176\u5b9e\u5e93\u91cc\u8fd8\u662f\u65e7\u7684\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u89e3\u6cd5\u7279\u522b\u6734\u7d20\uff0c\u5c31\u4e00\u53e5\u8bdd\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">\u8c03\u5b8c\u63a5\u53e3\uff0c\u76f4\u63a5\u8fde\u5e93\u67e5\u4e00\u6b21\u3002<\/span><\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u54cd\u5e94\u4f53\u662f\u540e\u7aef&#8221;\u544a\u8bc9\u4f60&#8221;\u7684\uff0c\u6570\u636e\u5e93\u91cc\u7684\u884c\u624d\u662f\u4e8b\u5b9e\u3002\u8fd9\u4e24\u8005\u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u5c31\u662f\u7ef4\u5ea6\u4e8c\u8981\u6293\u7684\u4e1c\u897f\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: rgb(215, 171, 169);\">\u6211\u5e26\u65b0\u4eba\u7684\u65f6\u5019\u6709\u4e2a\u5fc5\u8003\u9898\uff1a\u7ed9\u4f60\u4e00\u4e2a\u4e0b\u5355\u63a5\u53e3\uff0c\u600e\u4e48\u8bc1\u660e\u5b83\u771f\u7684\u4e0b\u5355\u6210\u529f\u4e86\uff1f<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: rgb(215, 171, 169);font-weight: bold;\">\u56de\u7b54&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 16px;color: rgb(215, 171, 169);\">&#8220;\u770b\u8fd4\u56de 200&#8243;\u7684\uff0c\u56de\u53bb\u91cd\u60f3\u3002<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: rgb(215, 171, 169);font-weight: bold;\">\u56de\u7b54&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 16px;color: rgb(215, 171, 169);\">&#8220;\u67e5 orders \u8868&#8221;\u7684\uff0c\u53ca\u683c\u3002&nbsp;<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: rgb(215, 171, 169);font-weight: bold;\">\u56de\u7b54&nbsp;<\/span><span textstyle=\"\" style=\"font-size: 16px;color: rgb(215, 171, 169);\">&#8220;\u67e5 orders \u8868 + order_items \u8868 + inventory \u8868\uff0c\u4e09\u5f20\u8868\u6570\u636e\u8981\u5bf9\u5f97\u4e0a&#8221;\u7684\uff0c\u53ef\u4ee5\u76f4\u63a5\u4e0a\u624b\u5e72\u6d3b\u3002<\/span><\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">2.2 \u7528 pymysql \u505a\u5199\u5165\u6821\u9a8c\uff08\u542b\u907f\u5751\uff09<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u76f4\u63a5\u4e0a\u4ee3\u7801\u3002\u8fd9\u662f\u6211\u4eec\u9879\u76ee\u91cc\u5728\u7528\u7684\u6570\u636e\u5e93\u6821\u9a8c\u6a21\u5757\uff0c\u53bb\u6389\u4e86\u4e1a\u52a1\u7ec6\u8282\uff1a<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">utils\/db_helper.py \u2014 \u6570\u636e\u5e93\u6821\u9a8c\u5de5\u5177<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pymysql<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;contextlib&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;contextmanager<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;typing&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;<span class=\"code-snippet__type\">Optional<\/span>,&nbsp;<span class=\"code-snippet__type\">List<\/span>,&nbsp;<span class=\"code-snippet__type\">Dict<\/span><\/span><\/code><code><span leaf=\"\">DB_CONF = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"host\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"10.20.30.40\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"port\"<\/span>:&nbsp;<span class=\"code-snippet__number\">3306<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"qa_readonly\"<\/span>, &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u5f3a\u70c8\u5efa\u8bae\u7ed9\u6d4b\u8bd5\u5355\u72ec\u5f00\u53ea\u8bfb\u8d26\u53f7<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"password\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"***\"<\/span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5b9e\u9645\u4ece\u73af\u5883\u53d8\u91cf\u8bfb\uff0c\u522b\u786c\u7f16\u7801\u8fdb\u4ed3\u5e93<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"database\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"mall_order\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"charset\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"utf8mb4\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"cursorclass\"<\/span>: pymysql.cursors.DictCursor, &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u67e5\u51fa\u6765\u76f4\u63a5\u662f dict\uff0c\u597d\u7528<\/span><\/span><\/code><code><span leaf=\"\">}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@contextmanager<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">db_conn<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u6bcf\u6b21\u7528\u5b8c\u5c31\u5173\uff0c\u522b\u8ba9\u8fde\u63a5\u8de8\u7528\u4f8b\u590d\u7528\uff0c\u4e8b\u52a1\u72b6\u6001\u4f1a\u4e92\u76f8\u6c61\u67d3\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; conn = pymysql.connect(**DB_CONF)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5173\u952e\uff1a\u628a\u9694\u79bb\u7ea7\u522b\u964d\u5230 READ COMMITTED<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u9ed8\u8ba4\u7684 REPEATABLE READ \u4f1a\u8ba9\u4f60\u5728\u540c\u4e00\u4e2a\u8fde\u63a5\u91cc\u53cd\u590d\u67e5\u5230\u65e7\u5feb\u7167\uff0c<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u660e\u660e\u63a5\u53e3\u5df2\u7ecf\u5199\u8fdb\u53bb\u4e86\uff0c\u4f60\u5c31\u662f\u67e5\u4e0d\u5230\u2014\u2014\u6211\u5728\u8fd9\u4e0a\u9762\u683d\u8fc7\u4e00\u6574\u4e2a\u4e0b\u5348<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;conn.cursor()&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;cur:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cur.execute(<span class=\"code-snippet__string\">\"SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;conn<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">finally<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; conn.close()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">query_one<\/span>(<span class=\"code-snippet__params\">sql:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, args:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">tuple<\/span><\/span><span class=\"code-snippet__params\">&nbsp;= ()<\/span>) -&gt;&nbsp;<span class=\"code-snippet__type\">Optional<\/span>[<span class=\"code-snippet__type\">Dict<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u67e5\u5355\u884c\u3002\u4e00\u6761 SQL \u628a\u9700\u8981\u7684\u5b57\u6bb5\u4e00\u6b21\u67e5\u5168\uff0c\u522b\u4e3a\u6bcf\u4e2a\u65ad\u8a00\u67e5\u4e00\u6b21\u5e93\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;db_conn()&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;conn:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;conn.cursor()&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;cur:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cur.execute(sql, args)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;cur.fetchone()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">query_all<\/span>(<span class=\"code-snippet__params\">sql:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, args:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">tuple<\/span><\/span><span class=\"code-snippet__params\">&nbsp;= ()<\/span>) -&gt;&nbsp;<span class=\"code-snippet__type\">List<\/span>[<span class=\"code-snippet__type\">Dict<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;db_conn()&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;conn:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;conn.cursor()&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;cur:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cur.execute(sql, args)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;cur.fetchall()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wait_until<\/span>(<span class=\"code-snippet__params\">sql:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, args:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">tuple<\/span><\/span><span class=\"code-snippet__params\">&nbsp;= (), timeout:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">float<\/span><\/span><span class=\"code-snippet__params\">&nbsp;=&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">5.0<\/span><\/span><span class=\"code-snippet__params\">,<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;interval:&nbsp;<span class=\"code-snippet__built_in\">float<\/span>&nbsp;=&nbsp;<span class=\"code-snippet__number\">0.3<\/span>) -&gt;&nbsp;<span class=\"code-snippet__type\">Optional<\/span>[<span class=\"code-snippet__type\">Dict<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8f6e\u8be2\u7b49\u5f85\u6570\u636e\u51fa\u73b0\uff0c\u4e13\u6cbb\u5f02\u6b65\u5199\u5165\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6bd4 time.sleep(3) \u597d\u5728\u4e24\u70b9\uff1a<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; 1. \u6570\u636e\u65e9\u5230\u5c31\u65e9\u8fd4\u56de\uff0c\u4e0d\u6d6a\u8d39\u7528\u4f8b\u6267\u884c\u65f6\u95f4<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; 2. \u8d85\u65f6\u65f6\u95f4\u53ef\u63a7\uff0c\u4e0d\u4f1a\u56e0\u4e3a\u73af\u5883\u6162\u4e00\u70b9\u5c31\u6574\u6279\u7528\u4f8b\u6302\u6389<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7528\u6cd5:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; row = wait_until(\"SELECT * FROM orders WHERE order_id=%s\", (oid,))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; assert row, \"5 \u79d2\u5185\u8ba2\u5355\u6ca1\u843d\u5e93\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; deadline = time.time() + timeout<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">while<\/span>&nbsp;time.time() &lt; deadline:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; row = query_one(sql, args)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;row:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;row<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; time.sleep(interval)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__literal\">None<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u8fd9\u4e2a\u6a21\u5757\u91cc\u6709\u4e24\u4e2a\u70b9\u662f\u6211\u8e29\u5751\u8e29\u51fa\u6765\u7684\uff0c\u5355\u72ec\u8bf4\u8bf4\u3002<\/span><\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(122, 79, 214);\">\u7b2c 1 \u4e2a\uff1a\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b<\/span><\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong><span leaf=\"\" style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">MySQL \u9ed8\u8ba4\u662f REPEATABLE READ\u3002\u5982\u679c\u4f60\u7528\u540c\u4e00\u4e2a\u8fde\u63a5\u67e5\u4e86\u4e24\u6b21\uff0c\u7b2c 1 \u6b21\u6ca1\u67e5\u5230\uff0c\u5373\u4fbf\u4e2d\u95f4\u63a5\u53e3\u5df2\u7ecf\u5199\u8fdb\u53bb\u4e86\uff0c\u7b2c 2 \u6b21\u4f60\u8fd8\u662f\u67e5\u4e0d\u5230\u2014\u2014\u56e0\u4e3a\u4f60\u8bfb\u7684\u662f\u540c\u4e00\u4e2a\u4e8b\u52a1\u5feb\u7167\u3002\u6211\u5f53\u5e74\u4e3a\u8fd9\u4e2a\u95ee\u9898\u6000\u7591\u8fc7\u540e\u7aef\u3001\u6000\u7591\u8fc7\u7f51\u7edc\u3001\u6000\u7591\u8fc7\u4eba\u751f\uff0c\u540e\u6765\u662f DBA \u4e00\u53e5\u8bdd\u70b9\u9192\u7684\u3002<\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(122, 79, 214);\">\u7b2c 2 \u4e2a\uff1a\u4e3b\u4ece\u5ef6\u8fdf<\/span><\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5982\u679c\u6d4b\u8bd5\u73af\u5883\u662f\u4e3b\u4ece\u67b6\u6784\uff0c\u5199\u5b8c\u7acb\u523b\u67e5\u4ece\u5e93\uff0c\u5f88\u53ef\u80fd\u67e5\u5230\u65e7\u6570\u636e\u3002\u6211\u4eec\u7684\u505a\u6cd5\u662f\uff1a<\/span><\/strong><strong style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6d4b\u8bd5\u7528\u7684\u6570\u636e\u5e93\u8fde\u63a5\u76f4\u63a5\u6307\u5411\u4e3b\u5e93<\/span><\/strong><span leaf=\"\" style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\uff0c\u6216\u8005\u5728\u9700\u8981\u9a8c\u8bc1\u4e3b\u4ece\u540c\u6b65\u65f6\uff0c\u5355\u72ec\u5199\u4e00\u6761\u7528\u4f8b\u6765\u6d4b\u5ef6\u8fdf\uff0c\u800c\u4e0d\u662f\u8ba9\u6240\u6709\u7528\u4f8b\u90fd\u88ab\u5ef6\u8fdf\u6298<\/span><span leaf=\"\">\u817e\u3002<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">test_db_consistency.py \u2014 \u4e0b\u5355\u63a5\u53e3\u7684\u6570\u636e\u4e00\u81f4\u6027\u6821\u9a8c<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;utils.db_helper&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;query_one, query_all, wait_until<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;utils.assertions&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;assert_schema<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;schemas.order_schema&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;ORDER_CREATE_SCHEMA<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_order_create_db_consistency<\/span>(<span class=\"code-snippet__params\">api_session, base_url, test_sku<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u7ef4\u5ea6\u4e8c\uff1a\u4e0b\u5355\u6210\u529f\u540e\uff0c\u4e09\u5f20\u8868\u7684\u6570\u636e\u5fc5\u987b\u5168\u90e8\u5bf9\u5f97\u4e0a\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u524d\u7f6e\uff1a\u8bb0\u5f55\u4e0b\u5355\u524d\u7684\u5e93\u5b58\uff0c\u4f5c\u4e3a\u5bf9\u7167\u57fa\u51c6 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; before = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT available_qty, locked_qty FROM inventory WHERE sku_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (test_sku,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;before,&nbsp;<span class=\"code-snippet__string\">f\"\u6d4b\u8bd5 SKU&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{test_sku}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5728\u5e93\u5b58\u8868\u91cc\u4e0d\u5b58\u5728\uff0c\u5148\u9020\u6570\u636e\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u8c03\u63a5\u53e3 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; payload = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"U100000001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: test_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">2<\/span>}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; resp = api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span>, json=payload)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; body = assert_schema(resp, ORDER_CREATE_SCHEMA)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order_id = body[<span class=\"code-snippet__string\">\"data\"<\/span>][<span class=\"code-snippet__string\">\"order_id\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u6821\u9a8c\u70b91\uff1a\u8ba2\u5355\u4e3b\u8868 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7528 wait_until \u800c\u4e0d\u662f sleep\uff0c\u5f02\u6b65\u5199\u5165\u4e5f\u80fd\u515c\u4f4f<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order = wait_until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT order_id, user_id, status, total_amount, is_deleted \"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"FROM orders WHERE order_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (order_id,), timeout=<span class=\"code-snippet__number\">5<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order,&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u63a5\u53e3\u8fd4\u56de\u6210\u529f\uff0c\u4f46 5 \u79d2\u5185 orders \u8868\u67e5\u4e0d\u5230&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order_id}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order[<span class=\"code-snippet__string\">\"status\"<\/span>] ==&nbsp;<span class=\"code-snippet__string\">\"pending\"<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u65b0\u5efa\u8ba2\u5355\u72b6\u6001\u5e94\u4e3a pending\uff0c\u5b9e\u9645&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'status'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order[<span class=\"code-snippet__string\">\"is_deleted\"<\/span>] ==&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6ce8\u610f\uff1a\u91d1\u989d\u4e00\u5b9a\u8981\u7528 Decimal \u6216\u8005\u8f6c\u5b57\u7b26\u4e32\u6bd4\uff0c\u522b\u7528 float \u76f4\u63a5 ==<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">str<\/span>(order[<span class=\"code-snippet__string\">\"total_amount\"<\/span>]) ==&nbsp;<span class=\"code-snippet__built_in\">str<\/span>(body[<span class=\"code-snippet__string\">\"data\"<\/span>][<span class=\"code-snippet__string\">\"total_amount\"<\/span>]), (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u63a5\u53e3\u8fd4\u56de\u91d1\u989d\u4e0e\u5e93\u4e2d\u91d1\u989d\u4e0d\u4e00\u81f4\uff1a\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u63a5\u53e3&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{body[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'data'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">][<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'total_amount'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;vs \u5e93&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'total_amount'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u6821\u9a8c\u70b92\uff1a\u8ba2\u5355\u660e\u7ec6\u5b50\u8868 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; items = query_all(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT sku_id, quantity, price FROM order_items WHERE order_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (order_id,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(items) ==&nbsp;<span class=\"code-snippet__number\">1<\/span>,&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u660e\u7ec6\u884c\u6570\u4e0d\u5bf9\uff0c\u671f\u671b 1\uff0c\u5b9e\u9645&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">len<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(items)}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;items[<span class=\"code-snippet__number\">0<\/span>][<span class=\"code-snippet__string\">\"quantity\"<\/span>] ==&nbsp;<span class=\"code-snippet__number\">2<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u6821\u9a8c\u70b93\uff1a\u5e93\u5b58\u8868\uff08\u8fd9\u4e00\u6b65\u5f88\u5bb9\u6613\u88ab\u6f0f\u6389\uff09 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; after = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT available_qty, locked_qty FROM inventory WHERE sku_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (test_sku,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;after[<span class=\"code-snippet__string\">\"available_qty\"<\/span>] == before[<span class=\"code-snippet__string\">\"available_qty\"<\/span>] -&nbsp;<span class=\"code-snippet__number\">2<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u53ef\u552e\u5e93\u5b58\u6ca1\u6263\uff1a\u4e0b\u5355\u524d&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{before[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'available_qty'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u4e0b\u5355\u540e&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{after[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'available_qty'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u671f\u671b\u51cf 2\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;after[<span class=\"code-snippet__string\">\"locked_qty\"<\/span>] == before[<span class=\"code-snippet__string\">\"locked_qty\"<\/span>] +&nbsp;<span class=\"code-snippet__number\">2<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u9884\u5360\u5e93\u5b58\u6ca1\u52a0\uff0c\u4e0b\u5355\u9501\u5e93\u903b\u8f91\u53ef\u80fd\u6ca1\u8d70\u5230\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><\/pre>\n<\/section>\n<section style=\"text-indent: 2em;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u4f60\u6ce8\u610f\u770b\u5012\u6570\u7b2c\u4e8c\u6bb5\u2014\u2014<\/span><\/span><strong style=\"color: rgb(22, 33, 62);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5e93\u5b58\u8868\u6821\u9a8c<\/span><\/strong><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\"><span leaf=\"\">\u3002\u6587\u7ae0\u5f00\u5934\u90a3\u4e2a&#8221;\u4e0b\u5355\u6210\u529f\u4f46\u5e93\u5b58\u6ca1\u6263&#8221;\u7684\u6545\u969c\uff0c\u5c31\u662f\u8fd9\u51e0\u884c\u80fd\u6293\u5230\u7684\u3002\u5b83\u8ddf\u63a5\u53e3\u54cd\u5e94\u5b8c\u5168\u6ca1\u5173\u7cfb\uff0c\u54cd\u5e94\u91cc\u538b\u6839\u4e0d\u8fd4\u56de\u5e93\u5b58\uff0c\u4f60\u4e0d\u67e5\u5e93\u5c31\u6c38\u8fdc\u4e0d\u77e5\u9053\u3002<\/span><\/span><\/span><\/section>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\">\ud83d\udca1&nbsp;<span textstyle=\"\" style=\"font-size: 16px;font-weight: bold;\">\u5199\u6570\u636e\u5e93\u6821\u9a8c\u7684\u56db\u6761\u7eaa\u5f8b<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">1\uff09\u4e00\u6b21\u67e5\u5168\u3002<\/span><\/strong><span leaf=\"\">\u540c\u4e00\u5f20\u8868\u7684\u591a\u4e2a\u5b57\u6bb5\uff0c\u4e00\u6761 SQL \u67e5\u51fa\u6765\uff0c\u522b\u4e3a\u6bcf\u4e2a\u65ad\u8a00\u5355\u72ec\u8dd1\u4e00\u6b21 SQL\u3002\u7528\u4f8b\u6162\u5c31\u6162\u5728\u8fd9\u79cd\u5730\u65b9\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">2\uff09\u8fde\u63a5\u4e0d\u590d\u7528\u3002<\/span><\/strong><span leaf=\"\">\u6bcf\u4e2a\u7528\u4f8b\u72ec\u7acb\u8fde\u63a5\uff0c\u907f\u514d\u4e8b\u52a1\u72b6\u6001\u4e92\u76f8\u5e72\u6270\uff0c\u5e76\u884c\u8dd1\u7528\u4f8b\u65f6\u5c24\u5176\u91cd\u8981\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">3\uff09SQL \u5c3d\u91cf\u6807\u51c6\u3002<\/span><\/strong><span leaf=\"\">\u5982\u679c\u9879\u76ee\u91cc MySQL \u548c PostgreSQL \u6df7\u7528\uff0c\u5c11\u7528\u65b9\u8a00\u51fd\u6570\uff0c\u4e0d\u7136\u6362\u4e2a\u73af\u5883\u5168\u6302\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">4\uff09\u91d1\u989d\u522b\u7528 float \u6bd4\u3002<\/span><\/strong><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">0.1 + 0.2 != 0.3<\/span><\/code><span leaf=\"\">&nbsp;\u8fd9\u4e2a\u7ecf\u5178\u95ee\u9898\u5728\u91d1\u989d\u65ad\u8a00\u91cc\u4f1a\u771f\u7684\u5751\u5230\u4f60\uff0c\u7528&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">Decimal<\/span><\/code><span leaf=\"\">&nbsp;\u6216\u8005\u8f6c\u6210\u5b57\u7b26\u4e32\u6bd4\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">2.3 \u4e8b\u52a1\u56de\u6eda\u9a8c\u8bc1\uff1a\u6545\u610f\u8ba9\u5b83\u5931\u8d25<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5f88\u591a\u56e2\u961f\u4e0d\u6d4b\u4e8b\u52a1\u56de\u6eda\uff0c\u7406\u7531\u662f&#8221;\u8fd9\u662f\u540e\u7aef\u8be5\u4fdd\u8bc1\u7684&#8221;\u3002\u8fd9\u8bdd\u6ca1\u9519\uff0c\u4f46<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u63a5\u53e3\u6d4b\u8bd5\u662f\u552f\u4e00\u80fd\u7aef\u5230\u7aef\u9a8c\u8bc1\u4e8b\u52a1\u8fb9\u754c\u7684\u73af\u8282<\/span><\/strong><span leaf=\"\">\u2014\u2014\u5355\u5143\u6d4b\u8bd5\u91cc\u4e8b\u52a1\u662f\u88ab mock \u6389\u7684\uff0c\u4f60\u6839\u672c\u4e0d\u77e5\u9053\u771f\u5b9e\u573a\u666f\u4e0b\u7684\u4e8b\u52a1\u8303\u56f4\u6709\u591a\u5927\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6d4b\u6cd5\u5f88\u7b80\u5355\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6545\u610f\u6784\u9020\u4e00\u4e2a\u5fc5\u7136\u5931\u8d25\u7684\u8bf7\u6c42\uff0c\u7136\u540e\u53bb\u5e93\u91cc\u786e\u8ba4\u4ec0\u4e48\u90fd\u6ca1\u7559\u4e0b\u3002<\/span><\/strong><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">test_transaction.py \u2014 \u4e8b\u52a1\u56de\u6eda\u9a8c\u8bc1<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_order_rollback_on_insufficient_stock<\/span>(<span class=\"code-snippet__params\">api_session, base_url, low_stock_sku<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7ef4\u5ea6\u4e8c\u00b7\u4e8b\u52a1\u56de\u6eda\uff1a\u5e93\u5b58\u4e0d\u8db3\u65f6\u4e0b\u5355\uff0c\u8ba2\u5355\u8868 \/ \u660e\u7ec6\u8868 \/ \u5e93\u5b58\u8868\u90fd\u4e0d\u8be5\u6709\u53d8\u5316\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; low_stock_sku \u8fd9\u4e2a fixture \u4f1a\u5148\u628a\u67d0\u4e2a SKU \u7684\u5e93\u5b58\u6539\u6210 1\uff0c<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7136\u540e\u6211\u4eec\u4e0b\u5355 5 \u4ef6\uff0c\u5fc5\u7136\u5931\u8d25\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; before_inv = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT available_qty, locked_qty FROM inventory WHERE sku_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (low_stock_sku,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; before_cnt = query_one(<span class=\"code-snippet__string\">\"SELECT COUNT(*) AS c FROM orders\"<\/span>)[<span class=\"code-snippet__string\">\"c\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; resp = api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span>, json={<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"U100000001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: low_stock_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">5<\/span>}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; })<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4e1a\u52a1\u4e0a\u5e94\u8be5\u660e\u786e\u5931\u8d25\uff0c\u800c\u4e0d\u662f\u8fd4\u56de\u4e00\u4e2a\"\u90e8\u5206\u6210\u529f\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;resp.status_code ==&nbsp;<span class=\"code-snippet__number\">200<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;resp.json()[<span class=\"code-snippet__string\">\"code\"<\/span>] ==&nbsp;<span class=\"code-snippet__number\">4004<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\u5e93\u5b58\u4e0d\u8db3\u65f6\u4e1a\u52a1\u7801\u5e94\u4e3a 4004\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u56de\u6eda\u6821\u9a8c\uff1a\u4e09\u5904\u90fd\u4e0d\u80fd\u6709\u6b8b\u7559 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; after_cnt = query_one(<span class=\"code-snippet__string\">\"SELECT COUNT(*) AS c FROM orders\"<\/span>)[<span class=\"code-snippet__string\">\"c\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;after_cnt == before_cnt, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u56de\u6eda] \u4e0b\u5355\u5931\u8d25\u5374\u591a\u4e86&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{after_cnt - before_cnt}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6761\u8ba2\u5355\uff0c\u4e8b\u52a1\u6ca1\u56de\u6eda\u5e72\u51c0\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; after_inv = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT available_qty, locked_qty FROM inventory WHERE sku_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (low_stock_sku,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;after_inv == before_inv, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u56de\u6eda] \u4e0b\u5355\u5931\u8d25\u4f46\u5e93\u5b58\u88ab\u6539\u4e86\uff1a<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{before_inv}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u2192&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{after_inv}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u8fd9\u6761\u7528\u4f8b\u6211\u4eec\u8dd1\u51fa\u8fc7\u4e00\u4e2a\u633a\u6709\u610f\u601d\u7684 bug\uff1a<\/span>\u5e93\u5b58\u4e0d\u8db3\u786e\u5b9e\u8fd4\u56de\u4e86 4004\uff0c\u8ba2\u5355\u8868\u4e5f\u786e\u5b9e\u6ca1\u8bb0\u5f55\uff0c\u4f46&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">locked_qty<\/span><\/code><span leaf=\"\">&nbsp;\u6da8\u4e86 5\u3002\u539f\u56e0\u662f\u540e\u7aef\u5148\u9501\u5e93\u5b58\u518d\u6821\u9a8c\u53ef\u7528\u91cf\uff0c\u6821\u9a8c\u5931\u8d25\u540e\u5fd8\u4e86\u91ca\u653e\u9501\u5b9a\u91cf\u3002\u8fd9\u4e2a&#8221;\u5e7d\u7075\u9884\u5360&#8221;\u5728\u6d4b\u8bd5\u73af\u5883\u79ef\u7d2f\u4e00\u5468\u4e4b\u540e\uff0c\u90a3\u4e2a SKU \u5c31\u518d\u4e5f\u4e0b\u4e0d\u4e86\u5355\u4e86\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u518d\u8fdb\u9636\u4e00\u70b9\u7684\u73a9\u6cd5\u662f<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(2, 30, 170);\">\u6a21\u62df\u90e8\u5206\u5931\u8d25<\/span><\/span><\/strong><span leaf=\"\">\u3002\u4e0b\u5355\u6d89\u53ca\u8ba2\u5355\u5199\u5165 + \u5e93\u5b58\u6263\u51cf + \u79ef\u5206\u53d1\u653e\u4e09\u6b65\uff0c\u4f60\u53ef\u4ee5\u628a\u79ef\u5206\u670d\u52a1\u7684\u5730\u5740\u6307\u5230\u4e00\u4e2a\u5fc5\u7136\u8d85\u65f6\u7684\u6869\u4e0a\uff0c\u7136\u540e\u9a8c\u8bc1\u524d\u4e24\u6b65\u662f\u5426\u5b8c\u6574\u56de\u6eda\u3002\u8fd9\u7c7b\u6d4b\u8bd5\u9700\u8981\u73af\u5883\u914d\u5408\uff0c\u4f46\u4ef7\u503c\u5f88\u9ad8\u2014\u2014\u7ebf\u4e0a\u5927\u90e8\u5206\u6570\u636e\u4e0d\u4e00\u81f4\uff0c\u90fd\u662f\u8fd9\u79cd&#8221;\u90e8\u5206\u6210\u529f&#8221;\u9020\u6210\u7684\u3002<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;font-weight: bold;\">\u771f\u5b9e\u6545\u969c\u590d\u76d8 \u00b7 \u5e7d\u7075\u8ba2\u5355<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u67d0\u6b21\u6d4b\u8bd5\u73af\u5883\u91cc\u5192\u51fa\u4e00\u6279\u8be1\u5f02\u8ba2\u5355\uff1a\u72b6\u6001\u663e\u793a&#8221;\u5df2\u652f\u4ed8&#8221;\uff0c\u4f46\u652f\u4ed8\u6d41\u6c34\u8868\u91cc\u67e5\u4e0d\u5230\u5bf9\u5e94\u8bb0\u5f55\uff0c\u7528\u6237\u8d26\u6237\u4e5f\u6ca1\u6263\u6b3e\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u67e5\u4e86\u4e24\u5929\u624d\u5b9a\u4f4d\u5230\uff1a\u652f\u4ed8\u56de\u8c03\u63a5\u53e3\u5728\u5e76\u53d1\u5199\u5165\u65f6\uff0c\u5199\u4e3b\u5e93\u3001\u8bfb\u4ece\u5e93\uff0c\u4ece\u5e93\u6709\u5927\u7ea6 200ms \u5ef6\u8fdf\u3002\u56de\u8c03\u903b\u8f91\u91cc\u6709\u4e2a&#8221;\u5148\u67e5\u540e\u5199&#8221;\u7684\u5224\u65ad\uff0c\u5e76\u53d1\u65f6\u4e24\u4e2a\u8bf7\u6c42\u90fd\u4ece\u4ece\u5e93\u8bfb\u5230&#8221;\u672a\u652f\u4ed8&#8221;\uff0c\u4e8e\u662f\u5404\u5199\u4e86\u4e00\u6761\u72b6\u6001\u66f4\u65b0\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4fee\u590d\u65b9\u6848\u662f\u56de\u8c03\u94fe\u8def\u5f3a\u5236\u8d70\u4e3b\u5e93 + \u52a0\u5206\u5e03\u5f0f\u9501\u3002\u4f46\u66f4\u503c\u5f97\u8bf4\u7684\u662f\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u8fd9\u4e2a bug \u662f\u6211\u4eec\u52a0\u4e0a\u6570\u636e\u5e93\u4e00\u81f4\u6027\u6821\u9a8c\u4e4b\u540e\u7b2c 3 \u5929\u8dd1\u51fa\u6765\u7684<\/span><\/strong><span leaf=\"\">\uff0c\u5728\u6b64\u4e4b\u524d\u5b83\u5df2\u7ecf\u5728\u73af\u5883\u91cc\u8eba\u4e86\u4e24\u4e2a\u6708\uff0c\u56e0\u4e3a\u63a5\u53e3\u4e00\u76f4\u8fd4\u56de 200\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">2.4 \u8f6f\u5220\u9664\u4e0e\u7ea7\u8054\uff1a\u5220\u9664\u63a5\u53e3\u6ca1\u90a3\u4e48\u7b80\u5355<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">&#8220;\u5220\u9664\u8ba2\u5355&#8221;\u8fd9\u4e2a\u52a8\u4f5c\uff0c\u6d4b\u8d77\u6765\u6bd4\u60f3\u8c61\u4e2d\u590d\u6742\u3002\u63a5\u53e3\u8fd4\u56de 200 \u53ea\u662f\u8d77\u70b9\uff0c\u4f60\u81f3\u5c11\u8981\u786e\u8ba4\u8fd9\u51e0\u4ef6\u4e8b\uff1a<\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u4e3b\u8868\u7684&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">is_deleted<\/span><\/code><span leaf=\"\">&nbsp;\u662f\u4e0d\u662f\u771f\u7684\u7f6e\u6210\u4e86 1<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">updated_at\/ deleted_at&nbsp;<\/span><span leaf=\"\" style=\"color:rgba(0, 0, 0, 0.9);font-size:17px;font-family:&quot;mp-quote&quot;, &quot;PingFang SC&quot;, system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;line-height:1.6;letter-spacing:0.034em;font-style:normal;font-weight:normal;\"><span textstyle=\"\" style=\"font-size: 13px;\">\u6709\u6ca1\u6709\u88ab\u5237\u65b0\u6210\u5220\u9664\u65f6\u95f4<\/span><\/span><\/code><\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u5b50\u8868\uff08\u8ba2\u5355\u660e\u7ec6\u3001\u652f\u4ed8\u8bb0\u5f55\u3001\u53d1\u7968\u8bb0\u5f55\uff09\u6709\u6ca1\u6709\u540c\u6b65\u8f6f\u5220\u9664<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u518d\u8c03\u4e00\u6b21\u5217\u8868\u67e5\u8be2\u63a5\u53e3\uff0c\u8fd9\u6761\u8ba2\u5355\u8fd8\u80fd\u4e0d\u80fd\u88ab\u67e5\u51fa\u6765\uff08JOIN \u91cc\u6709\u6ca1\u6709\u8fc7\u6ee4&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">is_deleted<\/span><\/code><span leaf=\"\">\uff09<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u518d\u8c03\u4e00\u6b21\u5220\u9664\u63a5\u53e3\uff0c\u4f1a\u4e0d\u4f1a\u62a5\u9519\u6216\u8005\u91cd\u590d\u8ba1\u6570\uff08\u5e42\u7b49\u6027\uff0c\u8fd9\u91cc\u5df2\u7ecf\u5f00\u59cb\u548c\u7ef4\u5ea6\u56db\u4ea4\u53c9\u4e86\uff09<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6211\u89c1\u8fc7\u4e00\u4e2a\u771f\u5b9e\u6848\u4f8b\uff1a\u8ba2\u5355\u8f6f\u5220\u9664\u540e\uff0c\u8ba2\u5355\u5217\u8868\u63a5\u53e3\u8fc7\u6ee4\u4e86\uff0c\u4f46&#8221;\u6211\u7684\u4f18\u60e0\u5238&#8221;\u9875\u9762\u91cc\u7684\u5173\u8054\u8ba2\u5355\u6ca1\u8fc7\u6ee4\uff0c\u7528\u6237\u70b9\u8fdb\u53bb\u770b\u5230\u4e00\u4e2a 404 \u9875\u9762\u3002\u8fd9\u5c31\u662f\u5178\u578b\u7684<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(122, 79, 214);\">\u7ea7\u8054\u8fc7\u6ee4\u6f0f\u7f51<\/span><\/span><\/strong><span leaf=\"\">\u2014\u2014\u4e3b\u6d41\u7a0b\u6d4b\u4e86\uff0c\u8fb9\u7f18\u5165\u53e3\u6ca1\u6d4b\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd8\u6709\u4e2a\u66f4\u9690\u853d\u7684\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(122, 79, 214);\">\u5220\u9664\u987a\u5e8f<\/span><\/span><\/strong><span leaf=\"\">\u3002\u7406\u8bba\u4e0a\u5e94\u8be5\u5148\u6807\u8bb0\u5b50\u8868\u518d\u6807\u8bb0\u4e3b\u8868\uff0c\u5982\u679c\u987a\u5e8f\u53cd\u4e86\uff0c\u5728\u5e76\u53d1\u5220\u9664\u65f6\u53ef\u80fd\u51fa\u73b0&#8221;\u4e3b\u8868\u5df2\u5220\u3001\u5b50\u8868\u8fd8\u5728&#8221;\u7684\u4e2d\u95f4\u6001\u3002\u8fd9\u4e2a\u7528\u666e\u901a\u7528\u4f8b\u6d4b\u4e0d\u51fa\u6765\uff0c\u5f97\u914d\u5408\u7ef4\u5ea6\u56db\u7684\u5e76\u53d1\u6d4b\u8bd5\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><br  \/><\/span><\/p>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 19px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 700;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u6570\u636e\u5e93\u4e00\u81f4\u6027\u6821\u9a8c\u6d41\u7a0b<\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(136, 136, 136);font-weight: bold;\">\u4ece\u300c\u63a5\u53e3\u8bf4\u6210\u529f\u300d\u5230\u300c\u6570\u636e\u786e\u5b9e\u5bf9\u300d\uff0c\u4e2d\u95f4\u8981\u8d70\u7684\u516d\u6b65<\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.524074074074074\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" type=\"block\" data-imgfileid=\"100000656\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BWmfcibGhS1Idj9icUcFlErGic8pMNksTuaBhTibwico0Z9LibyNnOjuFuEMcwJBgaOwKZyr6LomQJyJLhqkkM0w2saqicYsI0b1hN731iaicIDAGcTo\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<h2 style=\"font-size: 21px;color: rgb(15, 52, 96);margin: 44px 0px 18px;padding-left: 14px;border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(255, 167, 38);font-weight: 700;margin-right: 8px;\"><span leaf=\"\">03<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u7ef4\u5ea6\u4e09\uff1a\u4e1a\u52a1\u94fe\u8def\u5173\u8054\u6821\u9a8c<\/span><\/span><\/h2>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">3.1 \u5355\u63a5\u53e3\u90fd\u901a\u4e86\uff0c\u94fe\u8def\u5374\u65ad\u4e86<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u4e2a\u573a\u666f\u6211\u6562\u8bf4 90% \u7684\u56e2\u961f\u90fd\u9047\u5230\u8fc7\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6bcf\u4e2a\u63a5\u53e3\u5355\u72ec\u6d4b\u90fd\u662f\u7eff\u7684\uff0c\u4e32\u8d77\u6765\u8dd1\u5c31\u51fa\u4e8b\u3002<\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e3e\u4e2a\u6211\u4eec\u771f\u5b9e\u7ecf\u5386\u8fc7\u7684\u4f8b\u5b50\u3002\u4e0b\u5355 \u2192 \u652f\u4ed8 \u2192 \u53d1\u8d27 \u2192 \u7b7e\u6536\uff0c\u56db\u4e2a\u63a5\u53e3\uff0c\u5355\u6d4b\u5168\u8fc7\u3002\u4e0a\u7ebf\u540e\u8fd0\u8425\u627e\u8fc7\u6765\uff1a\u4e00\u6279\u8ba2\u5355\u652f\u4ed8\u6210\u529f\u4e86\uff0c\u5546\u5bb6\u540e\u53f0\u663e\u793a&#8221;\u5df2\u652f\u4ed8&#8221;\uff0c\u4f46\u4ed3\u5e93\u90a3\u8fb9\u59cb\u7ec8\u6ca1\u6536\u5230\u53d1\u8d27\u4efb\u52a1\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u67e5\u4e0b\u6765\u662f\u8fd9\u4e48\u56de\u4e8b\uff1a\u4e0b\u5355\u63a5\u53e3\u628a\u8ba2\u5355\u72b6\u6001\u5199\u6b7b\u6210&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">pending<\/span><\/code><span leaf=\"\">\uff1b\u652f\u4ed8\u6210\u529f\u540e\u7684\u72b6\u6001\u66f4\u65b0\uff0c\u8d70\u7684\u662f MQ \u5f02\u6b65\u6d88\u8d39\u8005\uff1b\u90a3\u4e2a\u6d88\u8d39\u8005\u56e0\u4e3a\u8fde\u63a5\u6c60\u914d\u7f6e\u95ee\u9898\uff0c\u5904\u7406\u65f6\u5076\u53d1\u8d85\u65f6\u5931\u8d25\uff0c\u4e14\u6ca1\u6709\u91cd\u8bd5\u3002\u4e8e\u662f\u8ba2\u5355\u72b6\u6001\u5361\u5728&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">pending<\/span><\/code><span leaf=\"\">\uff0c\u800c\u53d1\u8d27\u4efb\u52a1\u7684\u89e6\u53d1\u6761\u4ef6\u662f&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">status == 'paid'<\/span><\/code><span leaf=\"\">\uff0c\u81ea\u7136\u6c38\u8fdc\u4e0d\u89e6\u53d1\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4f60\u770b\uff0c\u6bcf\u4e2a\u63a5\u53e3\u90fd&#8221;\u6b63\u786e&#8221;\u5730\u5b8c\u6210\u4e86\u81ea\u5df1\u90a3\u90e8\u5206\u5de5\u4f5c\u3002\u95ee\u9898\u51fa\u5728<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u63a5\u53e3\u4e0e\u63a5\u53e3\u4e4b\u95f4\u7684\u90a3\u6bb5\u7a7a\u767d<\/span><\/strong><span leaf=\"\">\u2014\u2014\u800c\u8fd9\u6bb5\u7a7a\u767d\uff0c\u5355\u63a5\u53e3\u6d4b\u8bd5\u6c38\u8fdc\u770b\u4e0d\u5230\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u94fe\u8def\u6d4b\u8bd5\u96be\u505a\uff0c\u4e3b\u8981\u5361\u5728\u4e09\u70b9\uff1a<\/span><\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u7ef4\u62a4\u6210\u672c\u9ad8<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u4e00\u6761\u94fe\u8def\u6d89\u53ca 4-6 \u4e2a\u63a5\u53e3\uff0c\u4efb\u4f55\u4e00\u4e2a\u63a5\u53e3\u6539\u5b57\u6bb5\uff0c\u6574\u6761\u94fe\u8def\u7684\u7528\u4f8b\u90fd\u5f97\u8ddf\u7740\u6539\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6570\u636e\u51c6\u5907\u590d\u6742<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u94fe\u8def\u7684\u6bcf\u4e2a\u8282\u70b9\u90fd\u8981\u6c42\u524d\u7f6e\u6570\u636e\u5904\u4e8e\u6b63\u786e\u72b6\u6001\uff0c\u9020\u6570\u636e\u7684\u4ee3\u7801\u7ecf\u5e38\u6bd4\u6d4b\u8bd5\u4ee3\u7801\u8fd8\u957f\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5931\u8d25\u5b9a\u4f4d\u96be<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u94fe\u8def\u6302\u4e86\uff0c\u662f\u54ea\u4e2a\u73af\u8282\u7684\u9505\uff1f\u662f\u6570\u636e\u6ca1\u51c6\u5907\u597d\u8fd8\u662f\u903b\u8f91\u771f\u6709\u95ee\u9898\uff1f\u6392\u67e5\u4e00\u6b21\u534a\u5c0f\u65f6\u8d77\u6b65\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6240\u4ee5\u6211\u7684\u5efa\u8bae\u5f88\u5b9e\u9645\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u522b\u60f3\u7740\u8986\u76d6\u6240\u6709\u94fe\u8def\u7ec4\u5408\uff0c\u6293\u4e3b\u5e72\u5c31\u884c\u3002<\/span><\/strong><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-align: center;\"><span leaf=\"\">\u4f18\u5148\u7ea7\u6392\u5e8f\uff1a<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">P0<\/span><\/strong><span leaf=\"\">&nbsp;\u2014 \u6838\u5fc3\u6b63\u5411\u4e3b\u94fe\u8def\uff08\u4e0b\u5355\u2192\u652f\u4ed8\u2192\u53d1\u8d27\u2192\u7b7e\u6536\u2192\u5b8c\u6210\uff09\uff0c1 \u6761\uff1b<\/span><span leaf=\"\"><br  \/><\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">P1<\/span><\/strong><span leaf=\"\">&nbsp;\u2014 \u6838\u5fc3\u9006\u5411\u94fe\u8def\uff08\u9000\u6b3e\u2192\u5e93\u5b58\u56de\u8865\u2192\u9000\u6b3e\u5230\u8d26\uff09\uff0c1-2 \u6761\uff1b<\/span><span leaf=\"\"><br  \/><\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">P2<\/span><\/strong><span leaf=\"\">&nbsp;\u2014 \u9ad8\u9891\u5f02\u5e38\u94fe\u8def\uff08\u8d85\u65f6\u672a\u652f\u4ed8\u81ea\u52a8\u5173\u5355\u3001\u652f\u4ed8\u5931\u8d25\u91cd\u8bd5\uff09\uff0c2-3 \u6761\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><span leaf=\"\">\u52a0\u8d77\u6765 5 \u6761\u5de6\u53f3\u7684\u94fe\u8def\u7528\u4f8b\uff0c\u80fd\u8986\u76d6\u6389\u5927\u90e8\u5206\u8de8\u63a5\u53e3\u95ee\u9898\u3002\u522b\u8d2a\u591a\uff0c\u94fe\u8def\u7528\u4f8b\u8d35\u5728\u7a33\uff0c\u4e0d\u5728\u591a\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">3.2 \u6570\u636e\u4f20\u9012\u6821\u9a8c\uff1a\u4e00\u4e2a\u8ba2\u5355\u53f7\u8d70\u5b8c\u5168\u7a0b<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u94fe\u8def\u6d4b\u8bd5\u7684\u6838\u5fc3\u52a8\u4f5c\uff0c\u662f<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u9a8c\u8bc1\u6570\u636e\u5728\u63a5\u53e3\u4e4b\u95f4\u4f20\u9012\u65f6\u6ca1\u6709\u53d8\u5f62<\/span><\/strong><span leaf=\"\">\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e00\u4e2a\u8ba2\u5355\u53f7\uff0c\u4ece\u4e0b\u5355\u63a5\u53e3\u7684\u54cd\u5e94\u91cc\u51fa\u6765\uff0c\u8fdb\u5230\u652f\u4ed8\u63a5\u53e3\u7684\u8bf7\u6c42\u53c2\u6570\uff0c\u518d\u8fdb\u5230\u53d1\u8d27\u63a5\u53e3\u7684\u67e5\u8be2\u6761\u4ef6\uff0c\u4e00\u8def\u4e0a\u4e0d\u80fd\u88ab\u622a\u65ad\u3001\u4e0d\u80fd\u5927\u5c0f\u5199\u53d8\u5316\u3001\u4e0d\u80fd\u88ab\u91cd\u65b0\u751f\u6210\u3002\u91d1\u989d\u540c\u7406\u2014\u2014\u4ece\u4e0b\u5355\u5230\u652f\u4ed8\u5230\u5bf9\u8d26\uff0c\u4e00\u5206\u94b1\u90fd\u4e0d\u80fd\u5dee\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u542c\u8d77\u6765\u662f\u5e9f\u8bdd\uff0c\u4f46\u771f\u51fa\u8fc7\u4e8b\u3002\u6211\u4eec\u6709\u6b21\u9047\u5230\u91d1\u989d\u4ece&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">99.90<\/span><\/code><span leaf=\"\">&nbsp;\u53d8\u6210&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">99.9<\/span><\/code><span leaf=\"\">\uff0c\u672c\u6765\u65e0\u6240\u8c13\uff0c\u4f46\u4e0b\u6e38\u5bf9\u8d26\u7cfb\u7edf\u7528\u7684\u662f\u5b57\u7b26\u4e32\u6bd4\u5bf9\uff0c\u76f4\u63a5\u5224\u5b9a\u91d1\u989d\u4e0d\u7b26\uff0c\u628a\u6574\u6279\u8ba2\u5355\u6253\u8fdb\u4e86\u4eba\u5de5\u5ba1\u6838\u961f\u5217\u3002<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">test_order_chain.py \u2014 \u4e3b\u94fe\u8def\u6570\u636e\u4f20\u9012\u6821\u9a8c<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;decimal&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;Decimal<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;utils.db_helper&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;query_one, wait_until<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;utils.assertions&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;assert_schema, assert_biz_code<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.mark.chain<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_order_pay_ship_chain<\/span>(<span class=\"code-snippet__params\">api_session, base_url, test_sku<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7ef4\u5ea6\u4e09 \u00b7 \u4e3b\u94fe\u8def\uff1a\u4e0b\u5355 \u2192 \u652f\u4ed8 \u2192 \u53d1\u8d27 \u2192 \u67e5\u8be2<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6821\u9a8c\u91cd\u70b9\u4e0d\u662f\"\u6bcf\u6b65\u8fd4\u56de 200\"\uff0c\u800c\u662f\uff1a<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; \u00b7 order_id \u4e00\u8def\u4e0d\u53d8<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; \u00b7 \u91d1\u989d\u4e00\u8def\u4e0d\u53d8<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; \u00b7 \u6bcf\u4e00\u6b65\u4e4b\u540e\uff0c\u72b6\u6001\u548c\u5173\u8054\u5b57\u6bb5\u540c\u6b65\u66f4\u65b0<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># ===== \u73af\u82821\uff1a\u4e0b\u5355 =====<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; r1 = api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span>, json={<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"U100000001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: test_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">1<\/span>}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; })<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; d1 = assert_biz_code(r1)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order_id = d1[<span class=\"code-snippet__string\">\"order_id\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; amount = Decimal(<span class=\"code-snippet__built_in\">str<\/span>(d1[<span class=\"code-snippet__string\">\"total_amount\"<\/span>]))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;d1[<span class=\"code-snippet__string\">\"status\"<\/span>] ==&nbsp;<span class=\"code-snippet__string\">\"pending\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># ===== \u73af\u82822\uff1a\u652f\u4ed8\u56de\u8c03\uff08\u628a\u4e0a\u4e00\u6b65\u7684 order_id \u539f\u6837\u5e26\u8fdb\u6765\uff09 =====<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; r2 = api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/payments\/callback\"<\/span>, json={<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"order_id\"<\/span>: order_id,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"pay_amount\"<\/span>:&nbsp;<span class=\"code-snippet__built_in\">str<\/span>(amount), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u91d1\u989d\u7528\u5b57\u7b26\u4e32\u4f20\uff0c\u9632\u7cbe\u5ea6\u4e22\u5931<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"channel\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"alipay\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"trade_no\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"TRADE<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order_id[-<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">8<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">:]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; })<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; d2 = assert_biz_code(r2)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4f20\u9012\u6821\u9a8c\u2460\uff1a\u652f\u4ed8\u63a5\u53e3\u8fd4\u56de\u7684\u8ba2\u5355\u53f7\uff0c\u5fc5\u987b\u548c\u4e0b\u5355\u65f6\u4e00\u6a21\u4e00\u6837<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;d2[<span class=\"code-snippet__string\">\"order_id\"<\/span>] == order_id, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u8ba2\u5355\u53f7\u5728\u652f\u4ed8\u73af\u8282\u53d8\u4e86\uff1a<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order_id}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u2192&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{d2[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'order_id'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4f20\u9012\u6821\u9a8c\u2461\uff1a\u91d1\u989d\u4e0d\u80fd\u6709\u4efb\u4f55\u6f02\u79fb<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;Decimal(<span class=\"code-snippet__built_in\">str<\/span>(d2[<span class=\"code-snippet__string\">\"pay_amount\"<\/span>])) == amount, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u652f\u4ed8\u91d1\u989d\u6f02\u79fb\uff1a\u4e0b\u5355&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{amount}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u652f\u4ed8&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{d2[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'pay_amount'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u72b6\u6001\u6821\u9a8c\uff1a\u652f\u4ed8\u540e\u8ba2\u5355\u5fc5\u987b\u53d8\u6210 paid\uff0c\u540c\u65f6\u652f\u4ed8\u6d41\u6c34\u8981\u843d\u5e93<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order = wait_until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT status, paid_at FROM orders WHERE order_id=%s AND status='paid'\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (order_id,), timeout=<span class=\"code-snippet__number\">8<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order,&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u652f\u4ed8\u56de\u8c03\u8fd4\u56de\u6210\u529f\uff0c\u4f46 8 \u79d2\u5185\u8ba2\u5355\u72b6\u6001\u6ca1\u53d8\u6210 paid\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order[<span class=\"code-snippet__string\">\"paid_at\"<\/span>]&nbsp;<span class=\"code-snippet__keyword\">is<\/span>&nbsp;<span class=\"code-snippet__keyword\">not<\/span>&nbsp;<span class=\"code-snippet__literal\">None<\/span>,&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u72b6\u6001\u53d8\u4e86\u4f46\u652f\u4ed8\u65f6\u95f4\u6ca1\u5199\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; pay = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT trade_no, amount FROM payments WHERE order_id=%s\"<\/span>, (order_id,)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;pay,&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u8ba2\u5355\u72b6\u6001\u662f paid\uff0c\u4f46\u652f\u4ed8\u6d41\u6c34\u8868\u91cc\u6ca1\u8bb0\u5f55\uff08\u5e7d\u7075\u652f\u4ed8\uff09\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># ===== \u73af\u82823\uff1a\u53d1\u8d27 =====<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; r3 = api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/shipments\"<\/span>, json={<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"order_id\"<\/span>: order_id,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"carrier\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"SF\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; })<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; d3 = assert_biz_code(r3)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; tracking_no = d3[<span class=\"code-snippet__string\">\"tracking_number\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;tracking_no,&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u53d1\u8d27\u6210\u529f\u4f46\u7269\u6d41\u5355\u53f7\u662f\u7a7a\u7684\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># ===== \u73af\u82824\uff1a\u53cd\u67e5\u8ba2\u5355\u8be6\u60c5\uff0c\u786e\u8ba4\u5168\u94fe\u8def\u6570\u636e\u95ed\u73af =====<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; r4 = api_session.get(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\/<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order_id}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; d4 = assert_biz_code(r4)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;d4[<span class=\"code-snippet__string\">\"order_id\"<\/span>] == order_id<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;d4[<span class=\"code-snippet__string\">\"status\"<\/span>] ==&nbsp;<span class=\"code-snippet__string\">\"shipped\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;d4[<span class=\"code-snippet__string\">\"tracking_number\"<\/span>] == tracking_no, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u8be6\u60c5\u63a5\u53e3\u8fd4\u56de\u7684\u7269\u6d41\u5355\u53f7\u4e0e\u53d1\u8d27\u63a5\u53e3\u4e0d\u4e00\u81f4\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;Decimal(<span class=\"code-snippet__built_in\">str<\/span>(d4[<span class=\"code-snippet__string\">\"total_amount\"<\/span>])) == amount, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u8d70\u5b8c\u5168\u94fe\u8def\u540e\uff0c\u8ba2\u5355\u91d1\u989d\u548c\u4e0b\u5355\u65f6\u5bf9\u4e0d\u4e0a\u4e86\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u8fd9\u6761\u7528\u4f8b\u91cc\u6211\u57cb\u4e86\u4e00\u4e2a\u65ad\u8a00\uff0c\u662f\u88ab\u8840\u6cea\u6559\u8bad\u903c\u51fa\u6765\u7684\uff1a<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">assert pay, \"\u8ba2\u5355\u72b6\u6001\u662f paid\uff0c\u4f46\u652f\u4ed8\u6d41\u6c34\u8868\u91cc\u6ca1\u8bb0\u5f55\uff08\u5e7d\u7075\u652f\u4ed8\uff09\"<\/span><\/code><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8ba2\u5355\u72b6\u6001\u548c\u652f\u4ed8\u6d41\u6c34\u662f\u4e24\u5f20\u8868\uff0c\u7406\u8bba\u4e0a\u5e94\u8be5\u5728\u540c\u4e00\u4e2a\u4e8b\u52a1\u91cc\u5199\u3002\u4f46\u5982\u679c\u540e\u7aef\u628a\u5b83\u4eec\u62c6\u6210\u4e86\u4e24\u6b65\uff0c\u4e2d\u95f4\u4efb\u4f55\u4e00\u6b65\u5931\u8d25\uff0c\u5c31\u4f1a\u51fa\u73b0&#8221;\u8ba2\u5355\u663e\u793a\u5df2\u652f\u4ed8\uff0c\u8d22\u52a1\u5bf9\u4e0d\u4e0a\u8d26&#8221;\u7684\u60c5\u51b5\u3002\u8fd9\u79cd\u95ee\u9898\u5728\u54cd\u5e94\u4f53\u91cc\u5b8c\u5168\u770b\u4e0d\u51fa\u6765\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">3.3 \u72b6\u6001\u6d41\u8f6c\u6821\u9a8c\uff1a\u628a\u72b6\u6001\u673a\u8d70\u4e00\u904d<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e1a\u52a1\u6d41\u7a0b\u672c\u8d28\u4e0a\u662f\u4e2a\u72b6\u6001\u673a\u3002\u94fe\u8def\u6d4b\u8bd5\u7684\u53e6\u4e00\u534a\u5de5\u4f5c\uff0c\u5c31\u662f<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u987a\u7740\u72b6\u6001\u673a\u628a\u6bcf\u4e2a\u8282\u70b9\u8d70\u4e00\u904d\uff0c\u6bcf\u8d70\u4e00\u6b65\u90fd\u786e\u8ba4\u72b6\u6001\u548c\u5173\u8054\u5b57\u6bb5\u540c\u6b65\u66f4\u65b0\u4e86<\/span><\/strong><span leaf=\"\">\u3002<\/span><\/p>\n<table style=\"width: 704px;border-collapse: collapse;font-size: 14px;background: rgb(255, 255, 255);\">\n<thead>\n<tr>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u6b65\u9aa4<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u89e6\u53d1\u63a5\u53e3<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u72b6\u6001\u53d8\u5316<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u5fc5\u987b\u540c\u6b65\u66f4\u65b0\u7684\u5b57\u6bb5<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u5bb9\u6613\u6f0f\u6d4b\u7684\u70b9<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">POST \/orders<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u2014 \u2192 pending<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">order_id\u3001\u5e93\u5b58\u9884\u5360<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u9884\u5360\u4e86\u4f46\u6ca1\u8bbe\u8fc7\u671f\u65f6\u95f4<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">2<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">POST \/payments\/callback<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">pending \u2192 paid<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">paid_at\u3001\u652f\u4ed8\u6d41\u6c34\u3001\u5e93\u5b58\u5b9e\u6263<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u72b6\u6001\u53d8\u4e86\u4f46\u6d41\u6c34\u6ca1\u5199<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">3<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">POST \/shipments<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">paid \u2192 shipped<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">tracking_number\u3001shipped_at<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u672a\u652f\u4ed8\u8ba2\u5355\u4e5f\u80fd\u53d1\u8d27<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">4<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">POST \/orders\/confirm<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">shipped \u2192 delivered<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">delivered_at<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u91cd\u590d\u7b7e\u6536\u65f6\u95f4\u88ab\u8986\u76d6<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">5<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5b9a\u65f6\u4efb\u52a1 \/ \u7528\u6237\u786e\u8ba4<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">delivered \u2192 completed<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u79ef\u5206\u5230\u8d26\u3001\u53ef\u8bc4\u4ef7\u6807\u8bb0<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u79ef\u5206\u7b97\u9519\u6216\u91cd\u590d\u53d1\u653e<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">6\uff08\u9006\u5411\uff09<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">POST \/refunds<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">paid \u2192 refunded<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e93\u5b58\u56de\u8865\u3001\u4f18\u60e0\u5238\u8fd4\u8fd8<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e93\u5b58\u56de\u8865\u4e86\u4e24\u6b21<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">7\uff08\u5f02\u5e38\uff09<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8d85\u65f6\u4efb\u52a1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">pending \u2192 closed<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u91ca\u653e\u9884\u5360\u5e93\u5b58<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5173\u5355\u4e86\u4f46\u5e93\u5b58\u6ca1\u653e\u51fa\u6765<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u5f20\u8868\u91cc\u7684<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">&#8220;\u5bb9\u6613\u6f0f\u6d4b\u7684\u70b9&#8221;\u90a3\u4e00\u5217\uff0c\u624d\u662f\u771f\u6b63\u503c\u94b1\u7684\u90e8\u5206<\/span><\/strong><span leaf=\"\">\u3002\u5b83\u4eec\u7684\u5171\u540c\u7279\u5f81\u662f\uff1a\u72b6\u6001\u5b57\u6bb5\u672c\u8eab\u662f\u5bf9\u7684\uff0c\u4f46\u4f34\u968f\u72b6\u6001\u53d8\u5316\u672c\u8be5\u53d1\u751f\u7684\u526f\u4f5c\u7528\u6ca1\u53d1\u751f\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd8\u6709\u4e2a\u5751\u5f97\u5355\u72ec\u63d0\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u72b6\u6001\u503c\u7684\u6620\u5c04<\/span><\/strong><span leaf=\"\">\u3002\u6570\u636e\u5e93\u91cc\u72b6\u6001\u53ef\u80fd\u5b58\u7684\u662f\u6574\u6570&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">1\/2\/3<\/span><\/code><span leaf=\"\">\uff0c\u63a5\u53e3\u8fd4\u56de\u7684\u662f\u5b57\u7b26\u4e32&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">\"pending\"\/\"paid\"\/\"shipped\"<\/span><\/code><span leaf=\"\">\u3002\u8fd9\u5c42\u6620\u5c04\u5199\u5728\u4ee3\u7801\u91cc\uff0c\u4e00\u65e6\u67d0\u4e2a\u5f00\u53d1\u624b\u6ed1\u5199\u9519\u4e00\u4e2a\uff0c\u72b6\u6001\u6d41\u8f6c\u5c31\u4e71\u5957\u3002\u6240\u4ee5\u505a\u6570\u636e\u5e93\u6821\u9a8c\u65f6\uff0c<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u63a5\u53e3\u8fd4\u56de\u7684\u72b6\u6001\u548c\u5e93\u91cc\u7684\u72b6\u6001\u503c\uff0c\u4e24\u8fb9\u90fd\u8981\u65ad\u8a00\uff0c\u5e76\u4e14\u8981\u80fd\u5bf9\u5f97\u4e0a<\/span><\/strong><span leaf=\"\">\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u53e6\u5916\uff0c\u72b6\u6001\u673a\u6d4b\u8bd5\u8981\u4e13\u95e8\u6d4b<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u975e\u6cd5\u6d41\u8f6c<\/span><\/strong><span leaf=\"\">\u3002\u6bd4\u5982\uff1a<\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u76f4\u63a5\u5bf9\u4e00\u4e2a&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">pending<\/span><\/code><span leaf=\"\">&nbsp;\u8ba2\u5355\u8c03\u53d1\u8d27\u63a5\u53e3\uff0c\u5e94\u8be5\u88ab\u62d2\u7edd\uff08\u6211\u4eec\u771f\u7684\u9047\u5230\u8fc7\u6ca1\u6821\u9a8c\u7684\u7248\u672c\uff09<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u5bf9\u4e00\u4e2a\u5df2&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">closed<\/span><\/code><span leaf=\"\">&nbsp;\u7684\u8ba2\u5355\u53d1\u652f\u4ed8\u56de\u8c03\uff0c\u5e94\u8be5\u5e42\u7b49\u5ffd\u7565\u800c\u4e0d\u662f\u628a\u5b83\u590d\u6d3b<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u5bf9\u4e00\u4e2a\u5df2&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">refunded<\/span><\/code><span leaf=\"\">&nbsp;\u7684\u8ba2\u5355\u518d\u53d1\u4e00\u6b21\u9000\u6b3e\uff0c\u5e94\u8be5\u8fd4\u56de\u660e\u786e\u7684\u9519\u8bef\u7801<\/span><\/section>\n<\/li>\n<\/ul>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">3.4 \u53cd\u5411\u94fe\u8def\uff1a\u7ebf\u4e0a\u95ee\u9898\u7684\u91cd\u707e\u533a<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6b63\u5411\u94fe\u8def\u6d4b\u5b8c\uff0c\u9006\u5411\u94fe\u8def\u624d\u662f\u771f\u6b63\u5bb9\u6613\u51fa\u4e8b\u7684\u5730\u65b9\u3002\u56e0\u4e3a\u9006\u5411\u6d41\u7a0b\u901a\u5e38\u5199\u5f97\u665a\u3001\u6539\u5f97\u6025\u3001\u6d4b\u5f97\u5c11\u3002<\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u9000\u6b3e\u540e\u5e93\u5b58\u56de\u8865<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u9000\u4e86\u6b3e\uff0c\u5e93\u5b58\u52a0\u56de\u6765\u6ca1\u6709\uff1f\u5982\u679c\u7528\u6237\u540c\u65f6\u53d1\u8d77\u4e24\u6b21\u9000\u6b3e\u8bf7\u6c42\uff0c\u5e93\u5b58\u4f1a\u4e0d\u4f1a\u52a0\u4e24\u6b21\uff1f<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u53d6\u6d88\u8ba2\u5355\u4f18\u60e0\u5238\u8fd4\u8fd8<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u4e0b\u5355\u7528\u6389\u7684\u5238\uff0c\u53d6\u6d88\u540e\u6709\u6ca1\u6709\u9000\u56de\u8d26\u6237\uff1f\u9000\u56de\u540e\u6709\u6548\u671f\u662f\u539f\u6765\u7684\u8fd8\u662f\u91cd\u65b0\u8ba1\u7b97\u7684\uff1f<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5220\u9664\u8bc4\u4ef7\u540e\u8bc4\u5206\u91cd\u7b97<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u7528\u6237\u5220\u4e86\u5dee\u8bc4\uff0c\u5546\u54c1\u7684\u5e73\u5747\u5206\u6709\u6ca1\u6709\u91cd\u65b0\u8ba1\u7b97\uff1f\u8bc4\u4ef7\u6570\u6709\u6ca1\u6709\u51cf 1\uff1f<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u8d85\u65f6\u5173\u5355\u79ef\u5206\u8fd4\u8fd8<\/span><\/strong><br \/>\n<section><span leaf=\"\">\u4e0b\u5355\u65f6\u9884\u6263\u7684\u79ef\u5206\uff0c\u5173\u5355\u540e\u6709\u6ca1\u6709\u8fd8\u56de\u53bb\uff1f<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u9006\u5411\u94fe\u8def\u91cc\u8fd8\u6709\u4e00\u7c7b\u7279\u522b\u96be\u6d4b\u7684\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u8d85\u65f6\u81ea\u52a8\u89e6\u53d1<\/span><\/strong><span leaf=\"\">\u3002\u8ba2\u5355 30 \u5206\u949f\u672a\u652f\u4ed8\u81ea\u52a8\u5173\u95ed\u3001\u7b7e\u6536 7 \u5929\u540e\u81ea\u52a8\u5b8c\u6210\u2014\u2014\u4f60\u603b\u4e0d\u80fd\u771f\u7684\u5728\u7528\u4f8b\u91cc\u7b49\u534a\u5c0f\u65f6\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u4e24\u4e2a\u53ef\u884c\u529e\u6cd5\uff1a<\/span><\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: bold;\">\u529e\u6cd5\u4e00\uff1a\u76f4\u63a5\u6539\u6570\u636e\u5e93\u65f6\u95f4\uff08\u63a8\u8350\uff0c\u7b80\u5355\u7c97\u66b4\u6709\u6548\uff09<\/span><\/span><\/p>\n<p style=\"margin: 7px 0px;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e0b\u5355\u540e\uff0c\u7528 SQL \u628a&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">created_at<\/span><\/code><span leaf=\"\">&nbsp;\u6539\u5230 31 \u5206\u949f\u524d\uff0c\u7136\u540e\u624b\u52a8\u89e6\u53d1\u4e00\u6b21\u5b9a\u65f6\u4efb\u52a1\u7684\u63a5\u53e3\uff08\u5f88\u591a\u56e2\u961f\u4f1a\u63d0\u4f9b&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">\/internal\/jobs\/trigger<\/span><\/code><span leaf=\"\">&nbsp;\u8fd9\u7c7b\u8c03\u8bd5\u63a5\u53e3\uff09\uff0c\u518d\u67e5\u72b6\u6001\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: bold;\">\u529e\u6cd5\u4e8c\uff1a\u7528 freezegun \u51bb\u7ed3\/\u63a8\u8fdb\u65f6\u95f4<\/span><\/span><\/p>\n<p style=\"margin: 7px 0px;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u9002\u5408\u5b9a\u65f6\u903b\u8f91\u5728\u88ab\u6d4b\u670d\u52a1\u5185\u90e8\u3001\u4e14\u6d4b\u8bd5\u548c\u670d\u52a1\u540c\u8fdb\u7a0b\u7684\u573a\u666f\u3002\u63a5\u53e3\u6d4b\u8bd5\u91cc\u7528\u5f97\u5c11\uff0c\u66f4\u591a\u662f\u5355\u5143\u6d4b\u8bd5\u5728\u7528\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(15, 52, 96);font-family: Consolas, Monaco, monospace;font-size: 13px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(238, 243, 250);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">test_timeout_close.py \u2014 \u8d85\u65f6\u5173\u5355\u7684\u9006\u5411\u94fe\u8def\u9a8c\u8bc1<\/span><\/span><\/span><\/span><\/section>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_order_auto_close_and_restore_stock<\/span>(<span class=\"code-snippet__params\">api_session, base_url, test_sku, db_write<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u7ef4\u5ea6\u4e09\u00b7\u9006\u5411\uff1a\u8d85\u65f6\u672a\u652f\u4ed8\u81ea\u52a8\u5173\u5355\uff0c\u9884\u5360\u5e93\u5b58\u5fc5\u987b\u91ca\u653e\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; before = query_one(<span class=\"code-snippet__string\">\"SELECT locked_qty FROM inventory WHERE sku_id=%s\"<\/span>, (test_sku,))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># 1) \u6b63\u5e38\u4e0b\u5355\uff0c\u6b64\u65f6\u5e93\u5b58\u88ab\u9884\u5360<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; d = assert_biz_code(api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span>, json={<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"U100000001\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: test_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">1<\/span>}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order_id = d[<span class=\"code-snippet__string\">\"order_id\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; mid = query_one(<span class=\"code-snippet__string\">\"SELECT locked_qty FROM inventory WHERE sku_id=%s\"<\/span>, (test_sku,))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;mid[<span class=\"code-snippet__string\">\"locked_qty\"<\/span>] == before[<span class=\"code-snippet__string\">\"locked_qty\"<\/span>] +&nbsp;<span class=\"code-snippet__number\">1<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\u4e0b\u5355\u6ca1\u6709\u9884\u5360\u5e93\u5b58\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># 2) \u628a\u521b\u5efa\u65f6\u95f4\u5f80\u524d\u62e8 31 \u5206\u949f\uff0c\u5236\u9020\"\u8d85\u65f6\"\u6761\u4ef6<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; db_write(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"UPDATE orders SET created_at = DATE_SUB(created_at, INTERVAL 31 MINUTE) \"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"WHERE order_id=%s\"<\/span>, (order_id,)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># 3) \u624b\u52a8\u89e6\u53d1\u5173\u5355\u4efb\u52a1\uff08\u6d4b\u8bd5\u73af\u5883\u63d0\u4f9b\u7684\u5185\u90e8\u63a5\u53e3\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/internal\/jobs\/close-expired-orders\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># 4) \u6821\u9a8c\uff1a\u72b6\u6001\u53d8 closed + \u9884\u5360\u5e93\u5b58\u56de\u5230\u539f\u70b9<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; row = wait_until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT status FROM orders WHERE order_id=%s AND status='closed'\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (order_id,), timeout=<span class=\"code-snippet__number\">10<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;row,&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e09\u00b7\u9006\u5411] \u8d85\u65f6\u8ba2\u5355\u6ca1\u6709\u88ab\u81ea\u52a8\u5173\u95ed\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; after = query_one(<span class=\"code-snippet__string\">\"SELECT locked_qty FROM inventory WHERE sku_id=%s\"<\/span>, (test_sku,))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;after[<span class=\"code-snippet__string\">\"locked_qty\"<\/span>] == before[<span class=\"code-snippet__string\">\"locked_qty\"<\/span>], (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e09\u00b7\u9006\u5411] \u5173\u5355\u4e86\u4f46\u9884\u5360\u5e93\u5b58\u6ca1\u91ca\u653e\uff1a\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u5173\u5355\u524d&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{mid[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'locked_qty'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u5173\u5355\u540e&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{after[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'locked_qty'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u671f\u671b\u56de\u5230&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{before[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'locked_qty'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><\/pre>\n<\/section>\n<section style=\"text-indent: 2em;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u8fd9\u6761\u7528\u4f8b\u5728\u6211\u4eec\u9879\u76ee\u91cc\u6293\u5230\u8fc7\u4e00\u4e2a\u633a\u4e25\u91cd\u7684\u95ee\u9898\uff1a\u5173\u5355\u903b\u8f91\u91ca\u653e\u4e86&nbsp;<\/span><\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">locked_qty<\/span><\/code><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\"><span leaf=\"\">\uff0c\u4f46\u5fd8\u4e86\u628a&nbsp;<\/span><\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">available_qty<\/span><\/code><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\"><span leaf=\"\">&nbsp;\u52a0\u56de\u53bb\u3002\u7ed3\u679c\u5c31\u662f\u6bcf\u5173\u4e00\u5355\uff0c\u53ef\u552e\u5e93\u5b58\u5c31\u5b9e\u6253\u5b9e\u5c11\u6389\u4e00\u4ef6\u3002\u8fd9\u4e2a bug \u5728\u6d4b\u8bd5\u73af\u5883\u8dd1\u4e86\u4e24\u5468\u624d\u88ab\u53d1\u73b0\u2014\u2014\u56e0\u4e3a\u5728\u6b64\u4e4b\u524d\uff0c\u5173\u5355\u7528\u4f8b\u53ea\u65ad\u8a00\u4e86&#8221;\u72b6\u6001\u53d8\u6210 closed&#8221;\u3002<\/span><\/span><\/span><\/section>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<h2 style=\"font-size: 21px;color: rgb(15, 52, 96);margin: 44px 0px 18px;padding-left: 14px;border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(255, 167, 38);font-weight: 700;margin-right: 8px;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">04<\/span><\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u7ef4\u5ea6\u56db\uff1a\u5e76\u53d1\u4e0e\u5e42\u7b49\u6821\u9a8c<\/span><\/span><\/h2>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">4.1 \u4e3a\u4ec0\u4e48\u5e76\u53d1\u95ee\u9898\u5728\u6d4b\u8bd5\u73af\u5883\u51e0\u4e4e\u6d4b\u4e0d\u51fa\u6765<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5355\u7ebf\u7a0b\u987a\u5e8f\u6267\u884c\u65f6\uff0c\u63a5\u53e3\u662f\u5bf9\u7684\u3002\u540c\u4e00\u65f6\u523b\u6765 20 \u4e2a\u8bf7\u6c42\uff0c\u7ed3\u679c\u53ef\u80fd\u5b8c\u5168\u53d8\u6837\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5e76\u53d1\u573a\u666f\u5728\u771f\u5b9e\u4e16\u754c\u91cc\u5230\u5904\u90fd\u662f\uff0c\u800c\u4e14\u5927\u591a\u6570\u4e0d\u662f&#8221;\u79d2\u6740&#8221;\u8fd9\u79cd\u9ad8\u5927\u4e0a\u7684\u573a\u666f\uff1a<\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u7528\u6237\u624b\u5feb\uff0c\u4e0b\u5355\u6309\u94ae\u8fde\u70b9\u4e86\u4e24\u4e0b\uff08\u8fd9\u4e2a\u5360\u6bd4\u9ad8\u5f97\u60ca\u4eba\uff09<\/span><\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u624b\u673a\u4fe1\u53f7\u4e0d\u597d\uff0cAPP \u89c9\u5f97\u8d85\u65f6\u4e86\u81ea\u52a8\u91cd\u53d1\u4e00\u6b21<\/span><\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u7f51\u5173\u914d\u7f6e\u4e86\u8d85\u65f6\u91cd\u8bd5\uff0c\u540e\u7aef\u5176\u5b9e\u5904\u7406\u6210\u529f\u4e86\uff0c\u7f51\u5173\u53c8\u6253\u4e86\u4e00\u904d<\/span><\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u7528\u6237\u5728\u4e24\u4e2a\u8bbe\u5907\u4e0a\u540c\u65f6\u64cd\u4f5c\u540c\u4e00\u4e2a\u8ba2\u5355<\/span><\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u8fd0\u8425\u5728\u540e\u53f0\u6279\u91cf\u64cd\u4f5c\uff0c\u811a\u672c\u6ca1\u505a\u9650\u6d41<\/span><\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u540e\u7aef\u6ca1\u505a\u597d\u5e42\u7b49\u63a7\u5236\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u540c\u4e00\u4e2a\u7528\u6237\u77ac\u95f4\u751f\u6210\u4e24\u7b14\u4e00\u6a21\u4e00\u6837\u7684\u8ba2\u5355\uff0c\u4f46\u4ed6\u53ea\u70b9\u4e86\u4e00\u6b21\uff08\u7136\u540e\u6765\u6295\u8bc9\uff09<\/span><\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u5e93\u5b58\u53ea\u6709 1 \u4ef6\uff0c\u4e24\u7b14\u8ba2\u5355\u90fd\u6210\u529f\uff0c\u5e93\u5b58\u53d8\u6210 -1\uff08\u8d85\u5356\uff0c\u8fd0\u8425\u5f97\u53bb\u9053\u6b49\uff09<\/span><\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u7528\u6237\u4ed8\u4e86\u4e00\u7b14\u94b1\uff0c\u79ef\u5206\u53d1\u4e86\u4e24\u6b21\uff08\u8fd9\u4e2a\u7528\u6237\u4e0d\u4f1a\u6765\u6295\u8bc9\uff0c\u8d22\u52a1\u4f1a\uff09<\/span><\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\"><span textstyle=\"\" style=\"text-decoration: underline;\">\u9650\u9886\u4e00\u5f20\u7684\u4f18\u60e0\u5238\uff0c\u88ab\u5e76\u53d1\u9886\u4e86\u4e09\u5f20<\/span><\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u95ee\u9898\u662f\uff0c<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5e38\u89c4\u7528\u4f8b\u662f\u5355\u7ebf\u7a0b\u987a\u5e8f\u8dd1\u7684\uff0c\u5929\u7136\u4e0d\u4f1a\u89e6\u53d1\u8fd9\u4e9b\u6761\u4ef6<\/span><\/strong><span leaf=\"\">\u3002\u4f60\u7684\u7528\u4f8b\u96c6\u54ea\u6015\u6709 500 \u6761\uff0c\u4e5f\u4e00\u6761\u90fd\u6d4b\u4e0d\u51fa\u8d85\u5356\u3002\u5fc5\u987b\u5199\u4e13\u95e8\u7684\u5e76\u53d1\u7528\u4f8b\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 0px;\"><span leaf=\"\">\u8fd8\u6709\u4e2a\u5bb9\u6613\u88ab\u5ffd\u7565\u7684\u56e0\u7d20\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6d4b\u8bd5\u73af\u5883\u7684\u67b6\u6784\u548c\u751f\u4ea7\u4e0d\u4e00\u6837<\/span><\/strong><span leaf=\"\">\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\">\u6d4b\u8bd5\u73af\u5883\u5f80\u5f80\u662f\u5355\u8282\u70b9\u6570\u636e\u5e93\u3001\u65e0\u4e3b\u4ece\u3001\u65e0\u5206\u5e93\u5206\u8868\u3001Redis \u4e5f\u662f\u5355\u5b9e\u4f8b\u3002\u800c\u751f\u4ea7\u73af\u5883\u6709\u4e3b\u4ece\u590d\u5236\u3001\u6709\u5206\u5e03\u5f0f\u9501\u3001\u6709 MQ \u89e3\u8026\u3002\u540c\u4e00\u6bb5\u4ee3\u7801\u5728\u4e24\u79cd\u73af\u5883\u4e0b\u7684\u5e76\u53d1\u884c\u4e3a\u53ef\u80fd\u5b8c\u5168\u4e0d\u540c\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\">\u6240\u4ee5\u5982\u679c\u6761\u4ef6\u5141\u8bb8\uff0c\u5e76\u53d1\u6d4b\u8bd5\u5c3d\u91cf\u5728\u9884\u53d1\u6216\u538b\u6d4b\u73af\u5883\u505a\uff0c\u90a3\u91cc\u7684\u67b6\u6784\u548c\u751f\u4ea7\u66f4\u63a5\u8fd1\uff0c\u6d4b\u51fa\u6765\u7684\u95ee\u9898\u624d\u6709\u8bf4\u670d\u529b\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">4.2 \u7528 ThreadPoolExecutor \u5199\u5e76\u53d1\u6d4b\u8bd5<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">Python \u91cc\u505a\u5e76\u53d1\u6d4b\u8bd5\uff0c<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">concurrent.futures.ThreadPoolExecutor<\/span><\/code><span leaf=\"\">&nbsp;\u5c31\u591f\u7528\u4e86\uff0c\u4e0d\u9700\u8981\u4e0a Locust \u8fd9\u79cd\u91cd\u578b\u5de5\u5177\uff08\u5f53\u7136\u5982\u679c\u4f60\u8981\u540c\u65f6\u770b\u6027\u80fd\u6307\u6807\uff0c\u90a3\u53e6\u8bf4\uff09\u3002<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">test_concurrency.py \u2014 \u5e76\u53d1\u4e0b\u5355\u4e0e\u5e42\u7b49\u9a8c\u8bc1<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;uuid<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;requests<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;collections&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;Counter<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;concurrent.futures&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;ThreadPoolExecutor, as_completed<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;utils.db_helper&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;query_one, query_all<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.mark.concurrency<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_no_oversell_under_concurrency<\/span>(<span class=\"code-snippet__params\">base_url, token, db_write, test_sku<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7ef4\u5ea6\u56db \u00b7 \u8d85\u5356\u9a8c\u8bc1<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u573a\u666f\uff1a\u5e93\u5b58\u7cbe\u786e\u8bbe\u4e3a 5\uff0c20 \u4e2a\u7ebf\u7a0b\u540c\u65f6\u5404\u4e0b 1 \u4ef6\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u671f\u671b\uff1a\u6210\u529f 5 \u5355\uff0c\u5931\u8d25 15 \u5355\uff0c\u5e93\u5b58\u5f52\u96f6\uff0c\u4e00\u4ef6\u90fd\u4e0d\u80fd\u591a\u5356\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u5173\u952e\u524d\u7f6e\uff1a\u628a\u5e93\u5b58\u91cd\u7f6e\u4e3a\u5df2\u77e5\u503c\uff0c\u522b\u6307\u671b\u73af\u5883\u662f\u5e72\u51c0\u7684 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; STOCK =&nbsp;<span class=\"code-snippet__number\">5<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; CONCURRENCY =&nbsp;<span class=\"code-snippet__number\">20<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; db_write(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"UPDATE inventory SET available_qty=%s, locked_qty=0 WHERE sku_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (STOCK, test_sku),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; url =&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; headers = {<span class=\"code-snippet__string\">\"Authorization\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"Bearer&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{token}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">place_order<\/span>(<span class=\"code-snippet__params\">idx:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">int<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u5355\u4e2a\u4e0b\u5355\u8bf7\u6c42\u3002\u6bcf\u4e2a\u7ebf\u7a0b\u7528\u72ec\u7acb session\uff0c\u907f\u514d\u8fde\u63a5\u6c60\u7ade\u4e89\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; payload = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6bcf\u4e2a\u7ebf\u7a0b\u7528\u4e0d\u540c\u7528\u6237\uff0c\u6392\u9664\"\u540c\u7528\u6237\u9650\u8d2d\"\u903b\u8f91\u7684\u5e72\u6270<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"U1000000<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{idx:02d}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: test_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">1<\/span>}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r = requests.post(url, json=payload, headers=headers, timeout=<span class=\"code-snippet__number\">10<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body = r.json()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"idx\"<\/span>: idx,&nbsp;<span class=\"code-snippet__string\">\"http\"<\/span>: r.status_code,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"code\"<\/span>: body.get(<span class=\"code-snippet__string\">\"code\"<\/span>),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"order_id\"<\/span>: (body.get(<span class=\"code-snippet__string\">\"data\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">or<\/span>&nbsp;{}).get(<span class=\"code-snippet__string\">\"order_id\"<\/span>)}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;{<span class=\"code-snippet__string\">\"idx\"<\/span>: idx,&nbsp;<span class=\"code-snippet__string\">\"http\"<\/span>: -<span class=\"code-snippet__number\">1<\/span>,&nbsp;<span class=\"code-snippet__string\">\"code\"<\/span>:&nbsp;<span class=\"code-snippet__literal\">None<\/span>,&nbsp;<span class=\"code-snippet__string\">\"error\"<\/span>:&nbsp;<span class=\"code-snippet__built_in\">str<\/span>(e)}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u5e76\u53d1\u53d1\u5c04 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; results = []<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;ThreadPoolExecutor(max_workers=CONCURRENCY)&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;pool:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; futures = [pool.submit(place_order, i)&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;i&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">range<\/span>(CONCURRENCY)]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;f&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;as_completed(futures):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; results.append(f.result())<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u6821\u9a8c\u70b91\uff1a\u6210\u529f\u6570\u91cf\u5fc5\u987b\u7b49\u4e8e\u5e93\u5b58\u6570\u91cf ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; success = [r&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;results&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;r[<span class=\"code-snippet__string\">\"code\"<\/span>] ==&nbsp;<span class=\"code-snippet__number\">0<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(success) == STOCK, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e76\u53d1] \u5e93\u5b58&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{STOCK}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u4ef6\uff0c\u5374\u6210\u529f\u4e86&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">len<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(success)}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5355\u3002\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u4e1a\u52a1\u7801\u5206\u5e03:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{Counter(r[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'code'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">for<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;r&nbsp;<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">in<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">&nbsp;results)}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u6821\u9a8c\u70b92\uff1a\u5e93\u5b58\u4e0d\u80fd\u53d8\u6210\u8d1f\u6570\uff08\u8d85\u5356\u7684\u76f4\u63a5\u8bc1\u636e\uff09 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; inv = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT available_qty, locked_qty FROM inventory WHERE sku_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (test_sku,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;inv[<span class=\"code-snippet__string\">\"available_qty\"<\/span>] &gt;=&nbsp;<span class=\"code-snippet__number\">0<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e76\u53d1] \u5e93\u5b58\u88ab\u6263\u6210\u8d1f\u6570\uff1a<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{inv[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'available_qty'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u786e\u8ba4\u8d85\u5356\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;inv[<span class=\"code-snippet__string\">\"available_qty\"<\/span>] ==&nbsp;<span class=\"code-snippet__number\">0<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e76\u53d1] \u5e93\u5b58\u5e94\u6070\u597d\u6263\u5b8c\uff0c\u5b9e\u9645\u5269&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{inv[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'available_qty'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u53ef\u80fd\u6709\u8bf7\u6c42\u6263\u4e86\u5e93\u5b58\u5374\u6ca1\u5efa\u5355\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># --- \u6821\u9a8c\u70b93\uff1a\u8ba2\u5355\u6570\u91cf\u4e0e\u6210\u529f\u6570\u4e00\u81f4\uff0c\u4e0d\u80fd\u6709\u591a\u51fa\u6765\u7684\u810f\u5355 ---<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order_ids = [r[<span class=\"code-snippet__string\">\"order_id\"<\/span>]&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;r&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;success]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(<span class=\"code-snippet__built_in\">set<\/span>(order_ids)) == STOCK,&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u56db\u00b7\u5e76\u53d1] \u51fa\u73b0\u4e86\u91cd\u590d\u7684\u8ba2\u5355\u53f7\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.mark.concurrency<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_idempotency_with_same_key<\/span>(<span class=\"code-snippet__params\">base_url, token, test_sku<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u7ef4\u5ea6\u56db \u00b7 \u5e42\u7b49\u9a8c\u8bc1<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u573a\u666f\uff1a\u62ff\u540c\u4e00\u4e2a\u5e42\u7b49\u952e\uff0c\u5e76\u53d1\u6253 10 \u6b21\u4e0b\u5355\u8bf7\u6c42\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u671f\u671b\uff1a\u53ea\u4ea7\u751f 1 \u7b14\u8ba2\u5355\uff0c10 \u6b21\u54cd\u5e94\u5185\u5bb9\u5b8c\u5168\u4e00\u81f4\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; idem_key =&nbsp;<span class=\"code-snippet__string\">f\"IDEM-<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{uuid.uuid4().<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">hex<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; url =&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; payload = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"U100000099\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: test_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">1<\/span>}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; headers = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"Authorization\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"Bearer&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{token}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"Idempotency-Key\"<\/span>: idem_key, &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u5173\u952e\uff1a10 \u6b21\u8bf7\u6c42\u5171\u7528\u540c\u4e00\u4e2a\u952e<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">fire<\/span>(<span class=\"code-snippet__params\">_<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; r = requests.post(url, json=payload, headers=headers, timeout=<span class=\"code-snippet__number\">10<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;r.json()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;ThreadPoolExecutor(max_workers=<span class=\"code-snippet__number\">10<\/span>)&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;pool:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; bodies =&nbsp;<span class=\"code-snippet__built_in\">list<\/span>(pool.<span class=\"code-snippet__built_in\">map<\/span>(fire,&nbsp;<span class=\"code-snippet__built_in\">range<\/span>(<span class=\"code-snippet__number\">10<\/span>)))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6821\u9a8c\u70b91\uff1a\u6240\u6709\u54cd\u5e94\u7684\u8ba2\u5355\u53f7\u5fc5\u987b\u76f8\u540c\uff08\u8fd4\u56de\u540c\u4e00\u7b14\u5355\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ids = {b.get(<span class=\"code-snippet__string\">\"data\"<\/span>, {}).get(<span class=\"code-snippet__string\">\"order_id\"<\/span>)&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;b&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;bodies}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(ids) ==&nbsp;<span class=\"code-snippet__number\">1<\/span>,&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e42\u7b49] \u540c\u4e00\u5e42\u7b49\u952e\u4ea7\u751f\u4e86\u591a\u4e2a\u8ba2\u5355\u53f7\uff1a<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ids}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6821\u9a8c\u70b92\uff1a\u5e93\u91cc\u786e\u5b9e\u53ea\u6709\u4e00\u6761\u8bb0\u5f55<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; rows = query_all(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT order_id FROM orders WHERE idempotency_key=%s\"<\/span>, (idem_key,)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(rows) ==&nbsp;<span class=\"code-snippet__number\">1<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e42\u7b49] \u5e42\u7b49\u952e&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{idem_key}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5728\u5e93\u91cc\u5bf9\u5e94\u4e86&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">len<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(rows)}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6761\u8ba2\u5355\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6821\u9a8c\u70b93\uff1a\u771f\u6b63\u7684\u5e42\u7b49\uff0c\u662f\u6bcf\u6b21\u54cd\u5e94\u4f53\u90fd\u5b8c\u5168\u4e00\u81f4<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5f88\u591a\u63a5\u53e3\u505a\u5230\u4e86\"\u4e0d\u91cd\u590d\u521b\u5efa\"\uff0c\u4f46\u91cd\u590d\u8bf7\u6c42\u8fd4\u56de\u7684\u662f\u9519\u8bef\u7801\u800c\u4e0d\u662f\u9996\u6b21\u7ed3\u679c\uff0c<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8fd9\u4f1a\u8ba9\u5ba2\u6237\u7aef\u7684\u91cd\u8bd5\u903b\u8f91\u5f88\u96be\u5199<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; first = bodies[<span class=\"code-snippet__number\">0<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;i, b&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">enumerate<\/span>(bodies[<span class=\"code-snippet__number\">1<\/span>:], start=<span class=\"code-snippet__number\">2<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;b == first, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e42\u7b49] \u7b2c&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{i}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6b21\u54cd\u5e94\u4e0e\u9996\u6b21\u4e0d\u4e00\u81f4\\n\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u9996\u6b21:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{first}<\/span><\/span><span class=\"code-snippet__string\">\\n\u7b2c<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{i}<\/span><\/span><span class=\"code-snippet__string\">\u6b21:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{b}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; )<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u5173\u4e8e\u5e76\u53d1\u6d4b\u8bd5\u7684\u53c2\u6570\uff0c\u8bf4\u51e0\u4e2a\u6211\u8e29\u51fa\u6765\u7684\u7ecf\u9a8c\u503c\uff1a<\/span><\/span><\/p>\n<table style=\"width: 704px;border-collapse: collapse;font-size: 14px;background: rgb(255, 255, 255);\">\n<thead>\n<tr>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u573a\u666f<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u5efa\u8bae\u5e76\u53d1\u6570<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u8bf4\u660e<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u666e\u901a\u4e1a\u52a1\u63a5\u53e3\uff08\u4e0b\u5355\u3001\u63d0\u4ea4\u8868\u5355\uff09<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">10 &#8211; 20<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u591f\u89e6\u53d1\u5927\u90e8\u5206\u7ade\u6001\uff0c\u7528\u4f8b\u6267\u884c\u4e5f\u5feb<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u79d2\u6740 \/ \u62a2\u5238 \/ \u9650\u91cf\u6d3b\u52a8<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">50 &#8211; 100<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4f4e\u4e8e 50 \u57fa\u672c\u6d4b\u4e0d\u51fa\u771f\u5b9e\u7684\u7ade\u4e89\u5f3a\u5ea6<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e42\u7b49\u6027\u9a8c\u8bc1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">10<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u91cd\u70b9\u4e0d\u662f\u538b\u529b\uff0c\u662f\u540c\u4e00\u4e2a\u952e\u7684\u91cd\u590d\u6295\u9012<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u53ea\u505a\u5192\u70df<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">5<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u80fd\u8dd1\u901a\u5c31\u884c\uff0c\u522b\u6307\u671b\u5b83\u53d1\u73b0\u95ee\u9898<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">max_workers<\/span><\/code><span leaf=\"\">&nbsp;\u4e0d\u662f\u8d8a\u5927\u8d8a\u597d\u3002\u7ebf\u7a0b\u5f00\u592a\u591a\uff0c\u5ba2\u6237\u7aef\u81ea\u5df1\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u5f00\u9500\u5c31\u6210\u4e86\u74f6\u9888\uff0c\u8bf7\u6c42\u53d1\u4e0d\u51fa\u53bb\uff0c\u53cd\u800c\u6d4b\u4e0d\u51c6\u3002<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5224\u65ad\u6807\u51c6\u662f\u770b\u8bf7\u6c42\u7684\u5b9e\u9645\u53d1\u51fa\u65f6\u95f4\u662f\u5426\u96c6\u4e2d<\/span><\/strong><span leaf=\"\">\u2014\u2014\u53ef\u4ee5\u5728\u6bcf\u4e2a\u7ebf\u7a0b\u91cc\u8bb0\u5f55\u53d1\u8d77\u65f6\u95f4\u6233\uff0c\u8dd1\u5b8c\u770b\u770b\u65f6\u95f4\u5206\u5e03\uff0c\u5982\u679c 20 \u4e2a\u8bf7\u6c42\u5206\u6563\u5728 3 \u79d2\u5185\u53d1\u51fa\uff0c\u90a3\u8fd9\u6839\u672c\u4e0d\u53eb\u5e76\u53d1\u3002<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: bold;\">\ud83d\udca1 \u5e76\u53d1\u6d4b\u8bd5\u524d\uff0c\u52a1\u5fc5\u91cd\u7f6e\u6570\u636e<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e0d\u8981\u5047\u8bbe\u6d4b\u8bd5\u73af\u5883\u7684\u5e93\u5b58\u662f\u5e72\u51c0\u7684\u3002\u6bcf\u6b21\u5e76\u53d1\u6d4b\u8bd5\u524d\uff0c\u7528 SQL \u628a\u5e93\u5b58\u7cbe\u786e\u8bbe\u6210\u5df2\u77e5\u503c\uff08\u6bd4\u5982 5\uff09\uff0c\u8fd9\u6837&#8221;\u5e94\u8be5\u6210\u529f\u51e0\u5355&#8221;\u624d\u662f\u786e\u5b9a\u7684\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6211\u89c1\u8fc7\u6709\u4eba\u7684\u5e76\u53d1\u7528\u4f8b\u5199\u6210&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">assert \u6210\u529f\u6570 &lt;= \u5e93\u5b58\u6570<\/span><\/code><span leaf=\"\">\u2014\u2014\u8fd9\u4e2a\u65ad\u8a00\u6c38\u8fdc\u4e0d\u4f1a\u5931\u8d25\uff0c\u56e0\u4e3a\u5b83\u8fde\u5e93\u5b58\u539f\u6765\u662f\u591a\u5c11\u90fd\u4e0d\u77e5\u9053\u3002\u8fd9\u79cd\u7528\u4f8b\u8fd8\u4e0d\u5982\u4e0d\u5199\uff0c\u7eaf\u7cb9\u7ed9\u4eba\u865a\u5047\u7684\u5b89\u5168\u611f\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 19px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 700;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 19px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 700;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u5e76\u53d1\u7ade\u6001\uff1a\u5e93\u5b58 1 \u4ef6\uff0c\u4e3a\u4ec0\u4e48\u80fd\u5356\u51fa 2 \u5355<\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(136, 136, 136);font-weight: bold;font-style: italic;\">\u5355\u7ebf\u7a0b\u987a\u5e8f\u6267\u884c vs \u5e76\u53d1\u4ea4\u9519\u6267\u884c\u7684\u65f6\u5e8f\u5bf9\u6bd4<\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.5222222222222223\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" type=\"block\" data-imgfileid=\"100000657\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_png\/BWmfcibGhS1L5h4QStFbSDf4yr5SiaFQMV7fickZ8W9majydiaoia6Q1rMnSzU1cS7LcMYc02QgyaxvNghicPfU6LvPzvuibA26C3UD4xAMPo7FDCc\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">4.3 \u5e76\u53d1 bug \u7684\u56db\u79cd\u5178\u578b\u957f\u76f8<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8dd1\u5e76\u53d1\u7528\u4f8b\u7684\u65f6\u5019\uff0c\u5931\u8d25\u4fe1\u606f\u5f80\u5f80\u4e00\u56e2\u4e71\u3002\u8fd9\u91cc\u7ed9\u4f60\u4e00\u4efd&#8221;\u75c7\u72b6\u5bf9\u7167\u8868&#8221;\uff0c\u80fd\u5e2e\u4f60\u5feb\u901f\u5224\u65ad\u662f\u54ea\u7c7b\u95ee\u9898\uff1a<\/span><\/p>\n<table style=\"width: 704px;border-collapse: collapse;font-size: 14px;background: rgb(255, 255, 255);\">\n<thead>\n<tr>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u75c7\u72b6<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u6839\u56e0<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u5e38\u89c1\u4fee\u590d\u65b9\u6848<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u540c\u4e00\u7528\u6237\u77ac\u95f4\u751f\u6210\u591a\u7b14\u76f8\u540c\u8ba2\u5355<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u7f3a\u5c11\u5e42\u7b49\u952e\u6216\u5e42\u7b49\u952e\u6ca1\u751f\u6548<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e42\u7b49\u952e + \u552f\u4e00\u7d22\u5f15<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e93\u5b58\u88ab\u6263\u6210\u8d1f\u6570<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">check-then-act \u7ade\u6001<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\"><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">UPDATE ... WHERE qty &gt;= n<\/span><\/code><\/p>\n<section><span leaf=\"\">&nbsp;\u539f\u5b50\u6263\u51cf<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u79ef\u5206\/\u4f18\u60e0\u5238\u91cd\u590d\u53d1\u653e<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u56de\u8c03\u91cd\u590d\u6d88\u8d39\uff0c\u65e0\u53bb\u91cd<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6d88\u8d39\u7aef\u53bb\u91cd\u8868 + \u552f\u4e00\u7ea6\u675f<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6210\u529f\u6570\u5c11\u4e8e\u5e93\u5b58\u6570<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u9501\u7ade\u4e89\u8fc7\u5ea6\uff0c\u8bf7\u6c42\u88ab\u8bef\u62d2<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8c03\u6574\u9501\u7c92\u5ea6\uff0c\u6539\u7528\u5206\u6bb5\u5e93\u5b58<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u54cd\u5e94\u5185\u5bb9\u4e0d\u4e00\u81f4<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e42\u7b49\u53ea\u505a\u4e86&#8221;\u4e0d\u91cd\u590d\u521b\u5efa&#8221;<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u7f13\u5b58\u9996\u6b21\u54cd\u5e94\u7ed3\u679c\u5e76\u539f\u6837\u8fd4\u56de<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u518d\u8865\u4e24\u4e2a\u6392\u67e5\u6280\u5de7\uff1a<\/span><\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6280\u5de7\u4e00\uff1a\u770b binlog<\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: normal;\">\u5e76\u53d1\u95ee\u9898\u7684\u73b0\u573a\uff0c\u5728 MySQL \u7684 binlog \u91cc\u770b\u5f97\u4e00\u6e05\u4e8c\u695a\u3002\u5982\u679c\u4f60\u770b\u5230\u4e24\u6761 UPDATE \u8bed\u53e5\u7684\u65f6\u95f4\u6233\u51e0\u4e4e\u76f8\u540c\u3001\u4e14\u90fd\u57fa\u4e8e\u540c\u4e00\u4e2a\u65e7\u503c\uff0c\u90a3\u5c31\u662f\u6807\u51c6\u7684\u7ade\u6001\u73b0\u573a\uff0c\u53ef\u4ee5\u76f4\u63a5\u628a\u622a\u56fe\u7529\u7ed9\u5f00\u53d1\u3002<\/span><\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6280\u5de7\u4e8c\uff1a\u5728\u4ee3\u7801\u91cc\u57cb\u65e5\u5fd7<\/span><\/strong><span leaf=\"\"><br  \/><\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">&nbsp;\u8ba9\u5f00\u53d1\u5728\u5e93\u5b58\u6263\u51cf\u524d\u540e\u5404\u6253\u4e00\u884c\u65e5\u5fd7\uff08\u5e26\u7ebf\u7a0b ID \u548c\u5e93\u5b58\u503c\uff09\uff0c\u5e76\u53d1\u8dd1\u4e00\u6b21\uff0c\u628a\u65e5\u5fd7\u6309\u65f6\u95f4\u6392\u5e8f\uff0c\u4ea4\u9519\u6267\u884c\u7684\u65f6\u5e8f\u5c31\u51fa\u6765\u4e86\u3002\u8fd9\u6bd4\u53e3\u5934\u63cf\u8ff0&#8221;\u6211\u89c9\u5f97\u8fd9\u91cc\u6709\u5e76\u53d1\u95ee\u9898&#8221;\u6709\u8bf4\u670d\u529b\u5f97\u591a\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd8\u6709\u4e00\u70b9\u503c\u5f97\u8bf4\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5e76\u53d1\u6570\u548c\u95ee\u9898\u51fa\u73b0\u6982\u7387\u662f\u975e\u7ebf\u6027\u7684<\/span><\/strong><span leaf=\"\">\u3002\u6211\u4eec\u9047\u5230\u8fc7\u5e76\u53d1 20 \u4e00\u5207\u6b63\u5e38\u3001\u5e76\u53d1 50 \u624d\u5f00\u59cb\u8d85\u5356\u7684\u60c5\u51b5\u3002\u539f\u56e0\u662f\u6570\u636e\u5e93\u8fde\u63a5\u6c60\u5927\u5c0f\u662f 30\uff0c\u8d85\u8fc7\u4e4b\u540e\u8bf7\u6c42\u5f00\u59cb\u6392\u961f\uff0c\u65f6\u5e8f\u53d8\u4e86\uff0c\u7ade\u6001\u7a97\u53e3\u624d\u88ab\u6253\u5f00\u3002\u6240\u4ee5\u5982\u679c\u6838\u5fc3\u63a5\u53e3\u7684\u5e76\u53d1\u7528\u4f8b\u8dd1\u901a\u4e86\uff0c\u4e0d\u59a8\u628a\u5e76\u53d1\u6570\u7ffb\u4e00\u500d\u518d\u8dd1\u4e00\u6b21\u3002<\/span><\/p>\n<hr style=\"height: 1px;background: rgb(232, 235, 240);margin: 36px 0px;border: 0px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"  \/>\n<h2 style=\"font-size: 21px;color: rgb(15, 52, 96);margin: 44px 0px 18px;padding-left: 14px;border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span style=\"color: rgb(255, 167, 38);font-weight: 700;margin-right: 8px;\"><span leaf=\"\">05<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u5b9e\u6218\uff1a\u7535\u5546\u8ba2\u5355\u63a5\u53e3\u56db\u7ef4\u9a8c\u8bc1\u5b8c\u6574\u6848\u4f8b<\/span><\/span><\/h2>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u524d\u9762\u56db\u4e2a\u7ef4\u5ea6\u8bb2\u5b8c\u4e86\uff0c\u4f46\u6211\u77e5\u9053\uff0c\u8bb2\u539f\u7406\u548c\u771f\u6b63\u843d\u5730\u4e4b\u95f4\u9694\u7740\u4e00\u6761\u6cb3\u3002\u6240\u4ee5\u8fd9\u4e00\u7ae0\u6211\u628a\u4e00\u4e2a\u5b8c\u6574\u7684\u771f\u5b9e\u6848\u4f8b\u4ece\u5934\u5230\u5c3e\u8d70\u4e00\u904d\u2014\u2014\u8131\u654f\u4e4b\u540e\u7684\uff0c\u4f46\u6d41\u7a0b\u3001\u95ee\u9898\u3001\u4fee\u590d\u65b9\u5f0f\u90fd\u662f\u539f\u6837\u7684\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">5.1 \u80cc\u666f\uff1a\u4e00\u4e2a&#8221;\u770b\u8d77\u6765\u5f88\u7b80\u5355&#8221;\u7684\u4e0b\u5355\u63a5\u53e3<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u9879\u76ee\u662f\u4e00\u4e2a\u4e2d\u578b\u7535\u5546\u5e73\u53f0\u7684\u8ba2\u5355\u57df\u6539\u9020\u3002\u8fd9\u6b21\u8fed\u4ee3\u7684\u9700\u6c42\u542c\u8d77\u6765\u5f88\u7b80\u5355\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u4e0b\u5355\u65f6\u652f\u6301\u4f7f\u7528\u4f18\u60e0\u5238\uff0c\u5e76\u4e14\u8981\u9884\u5360\u5e93\u5b58<\/span><\/strong><span leaf=\"\">\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5f00\u53d1\u6392\u671f 5 \u5929\uff0c\u6d4b\u8bd5\u6392\u671f 2 \u5929\u3002\u9700\u6c42\u8bc4\u5ba1\u7684\u65f6\u5019\u5927\u5bb6\u90fd\u89c9\u5f97\u6ca1\u5565\u96be\u5ea6\uff0c\u5c31\u662f\u5728\u539f\u6709\u4e0b\u5355\u63a5\u53e3\u4e0a\u52a0\u4e2a&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">coupon_id<\/span><\/code><span leaf=\"\">&nbsp;\u53c2\u6570\u561b\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u7ed3\u679c\u8fd9\u6761\u94fe\u8def\u6211\u4eec\u7528\u56db\u7ef4\u6846\u67b6\u8dd1\u4e0b\u6765\uff0c\u627e\u51fa 4 \u4e2a\u95ee\u9898\uff0c\u5176\u4e2d 2 \u4e2a\u662f\u4f1a\u9020\u6210\u8d44\u635f\u7684\u3002\u5982\u679c\u6309\u8001\u529e\u6cd5\u53ea\u6d4b\u72b6\u6001\u7801\uff0c\u6211\u53ef\u4ee5\u5f88\u786e\u5b9a\u5730\u8bf4\uff1a\u8fd9 4 \u4e2a\u95ee\u9898\uff0c\u4e00\u4e2a\u90fd\u53d1\u73b0\u4e0d\u4e86\u3002<\/span><\/p>\n<section style=\"text-align: left;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 19px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 700;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u5b9e\u6218\u6848\u4f8b\uff1a\u8ba2\u5355\u57df\u63a5\u53e3\u4e0e\u56db\u7ef4\u9a8c\u8bc1\u843d\u70b9<\/span><\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(136, 136, 136);font-weight: bold;font-style: italic;\">3 \u4e2a\u63a5\u53e3 \u00b7 5 \u5f20\u6570\u636e\u8868 \u00b7 \u56db\u4e2a\u7ef4\u5ea6\u5206\u522b\u9a8c\u5728\u54ea\u91cc<\/span><\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.5277777777777778\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" type=\"block\" data-imgfileid=\"100000658\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BWmfcibGhS1JEtdb9v8ibYxgB342CJlZ3YkNepE9iaNbpHJqIbju7jS6icSAoRceqzSAQpmCiaCTHx4K8ePk4ZjH5PmyFgvLtL0KCNuVO81jK6aY\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">5.2 \u63a5\u53e3\u6587\u6863\uff08\u4e09\u4e2a\u6838\u5fc3\u63a5\u53e3\uff09<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5148\u628a\u6d4b\u8bd5\u5bf9\u8c61\u8bf4\u6e05\u695a\u3002\u8fd9\u6b21\u6d89\u53ca\u4e09\u4e2a\u63a5\u53e3\uff1a<\/span><\/p>\n<h4 style=\"font-size: 15.5px;color: rgb(15, 52, 96);margin: 22px 0px 10px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u63a5\u53e3\u4e00\uff1a\u521b\u5efa\u8ba2\u5355<\/span><\/h4>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">POST \/api\/v1\/orders<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span leaf=\"\"><span class=\"code-snippet__comment\">\/\/ ========== \u8bf7\u6c42 ==========<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__title\">Headers<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__title\">Authorization<\/span>:&nbsp;<span class=\"code-snippet__title\">Bearer<\/span>&nbsp;&lt;token&gt;<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__title\">Idempotency<\/span>-<span class=\"code-snippet__title\">Key<\/span>: &lt;\u5ba2\u6237\u7aef\u751f\u6210\u7684\u552f\u4e00\u952e\uff0c\u53ef\u9009\u4f46\u5f3a\u70c8\u5efa\u8bae&gt;<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__title\">Content<\/span>-<span class=\"code-snippet__title\">Type<\/span>: application\/json<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__title\">Body<\/span>:<\/span><\/code><code><span leaf=\"\">{<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>: &nbsp; &nbsp;<span class=\"code-snippet__string\">\"U100000001\"<\/span>, &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\">\/\/ \u5fc5\u586b\uff0c\u7528\u6237ID<\/span><\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\">\/\/ \u5fc5\u586b\uff0c\u6536\u8d27\u5730\u5740ID<\/span><\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"coupon_id\"<\/span>: &nbsp;<span class=\"code-snippet__string\">\"CP20240801001\"<\/span>, &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\">\/\/ \u9009\u586b\uff0c\u672c\u6b21\u8fed\u4ee3\u65b0\u589e<\/span><\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; {<span class=\"code-snippet__string\">\"sku_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"SKU0000001\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">2<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; ]<\/span><\/code><code><span leaf=\"\">}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">\/\/ ========== \u6210\u529f\u54cd\u5e94 ==========<\/span><\/span><\/code><code><span leaf=\"\">{<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"code\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"message\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"data\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"order_id\"<\/span>: &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__string\">\"OD20240801XK92MT3B01\"<\/span>, &nbsp;&nbsp;<span class=\"code-snippet__comment\">\/\/ 20\u4f4d<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"status\"<\/span>: &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__string\">\"pending\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"original_amount\"<\/span>:&nbsp;<span class=\"code-snippet__number\">199.80<\/span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\">\/\/ \u4f18\u60e0\u524d\u91d1\u989d<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"discount_amount\"<\/span>:&nbsp;<span class=\"code-snippet__number\">20.00<\/span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\">\/\/ \u4f18\u60e0\u5238\u62b5\u6263<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"total_amount\"<\/span>: &nbsp; &nbsp;<span class=\"code-snippet__number\">179.80<\/span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\">\/\/ \u5b9e\u4ed8\u91d1\u989d<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"created_at\"<\/span>: &nbsp;&nbsp;<span class=\"code-snippet__string\">\"2024-08-01T14:23:05+08:00\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; {<span class=\"code-snippet__string\">\"sku_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"SKU0000001\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">2<\/span>,&nbsp;<span class=\"code-snippet__string\">\"price\"<\/span>:&nbsp;<span class=\"code-snippet__number\">99.90<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ]<\/span><\/code><code><span leaf=\"\">&nbsp; }<\/span><\/code><code><span leaf=\"\">}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">\/\/ ========== \u4e1a\u52a1\u9519\u8bef\u7801 ==========<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">\/\/ 4004 \u5e93\u5b58\u4e0d\u8db3\u3000\u30004005 \u4f18\u60e0\u5238\u4e0d\u53ef\u7528\u3000\u30004006 \u5730\u5740\u65e0\u6548<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">\/\/ 4009 \u5e42\u7b49\u952e\u51b2\u7a81\uff08\u5df2\u6709\u5904\u7406\u4e2d\u7684\u540c\u952e\u8bf7\u6c42\uff09<\/span><\/span><\/code><\/pre>\n<\/section>\n<h4 style=\"font-size: 15.5px;color: rgb(15, 52, 96);margin: 22px 0px 10px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u63a5\u53e3\u4e8c\uff1a\u652f\u4ed8\u56de\u8c03<\/span><\/h4>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">POST \/api\/v1\/payments\/callback<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span leaf=\"\"><span class=\"code-snippet__title\">Body<\/span>:<\/span><\/code><code><span leaf=\"\">{<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"order_id\"<\/span>: &nbsp;<span class=\"code-snippet__string\">\"OD20240801XK92MT3B01\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"trade_no\"<\/span>: &nbsp;<span class=\"code-snippet__string\">\"TRADE202408011423001\"<\/span>, &nbsp;&nbsp;<span class=\"code-snippet__comment\">\/\/ \u652f\u4ed8\u6e20\u9053\u6d41\u6c34\u53f7<\/span><\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"pay_amount\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"179.80\"<\/span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\">\/\/ \u5b57\u7b26\u4e32\u4f20\uff0c\u9632\u7cbe\u5ea6\u4e22\u5931<\/span><\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"channel\"<\/span>: &nbsp;&nbsp;<span class=\"code-snippet__string\">\"alipay\"<\/span><\/span><\/code><code><span leaf=\"\">}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__title\">Response<\/span>:<\/span><\/code><code><span leaf=\"\">{<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"code\"<\/span>:&nbsp;<span class=\"code-snippet__number\">0<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"data\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"order_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"OD20240801XK92MT3B01\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"status\"<\/span>: &nbsp;&nbsp;<span class=\"code-snippet__string\">\"paid\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"paid_at\"<\/span>: &nbsp;<span class=\"code-snippet__string\">\"2024-08-01T14:25:11+08:00\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; }<\/span><\/code><code><span leaf=\"\">}<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">\/\/ \u6ce8\u610f\uff1a\u652f\u4ed8\u6e20\u9053\u4f1a\u91cd\u590d\u63a8\u9001\u56de\u8c03\uff08\u8fd9\u662f\u884c\u4e1a\u60ef\u4f8b\uff0c\u4e0d\u662f bug\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\">\/\/ \u6240\u4ee5\u8fd9\u4e2a\u63a5\u53e3\u5929\u7136\u8981\u6c42\u5e42\u7b49 \u2014\u2014 \u8fd9\u662f\u7ef4\u5ea6\u56db\u7684\u91cd\u70b9\u9776\u5b50<\/span><\/span><\/code><\/pre>\n<\/section>\n<h4 style=\"font-size: 15.5px;color: rgb(15, 52, 96);margin: 22px 0px 10px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u63a5\u53e3\u4e09\uff1a\u8ba2\u5355\u8be6\u60c5<\/span><\/h4>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">GET \/api\/v1\/orders\/{order_id}<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span leaf=\"\">Response:<\/span><\/code><code><span leaf=\"\">{<\/span><\/code><code><span leaf=\"\">&nbsp; \"<span class=\"code-snippet__selector-tag\">code<\/span>\":&nbsp;<span class=\"code-snippet__number\">0<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp;&nbsp;<span class=\"code-snippet__string\">\"data\"<\/span>: {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"order_id\": &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__string\">\"OD20240801XK92MT3B01\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"status\"<\/span>: &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__string\">\"paid\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"total_amount\"<\/span>: &nbsp;<span class=\"code-snippet__number\">179.80<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"coupon_id\"<\/span>: &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"CP20240801001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"paid_at\"<\/span>: &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"2024-08-01T14:25:11+08:00\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [ ... ]<\/span><\/code><code><span leaf=\"\">&nbsp; }<\/span><\/code><code><span leaf=\"\">}<\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">5.3 \u7528\u4f8b\u8bbe\u8ba1\uff1a\u628a\u56db\u4e2a\u7ef4\u5ea6\u62c6\u6210\u6821\u9a8c\u70b9<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u62ff\u5230\u6587\u6863\uff0c\u6211\u505a\u7684\u5934\u4e00\u4ef6\u4e8b\u4e0d\u662f\u5199\u4ee3\u7801\uff0c\u662f<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u753b\u4e00\u5f20\u6821\u9a8c\u70b9\u77e9\u9635<\/span><\/strong><span leaf=\"\">\u3002\u628a\u6bcf\u4e2a\u63a5\u53e3\u5728\u56db\u4e2a\u7ef4\u5ea6\u4e0a\u5206\u522b\u8981\u9a8c\u4ec0\u4e48\uff0c\u5217\u6e05\u695a\u3002\u8fd9\u5f20\u8868\u753b\u5b8c\uff0c\u7528\u4f8b\u600e\u4e48\u5199\u5c31\u4e00\u76ee\u4e86\u7136\u4e86\u3002<\/span><\/p>\n<table style=\"width: 704px;border-collapse: collapse;font-size: 14px;background: rgb(255, 255, 255);color: rgb(44, 44, 58);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\">\n<thead>\n<tr>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u7ef4\u5ea6<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u6821\u9a8c\u70b9<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u5177\u4f53\u65ad\u8a00<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u4f18\u5148\u7ea7<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td rowspan=\"4\" style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4e00 \u00b7 \u7ed3\u6784<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5b57\u6bb5\u5b8c\u6574\u6027<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">order_id \/ status \/ total_amount \/ items \u5fc5\u987b\u5b58\u5728<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u7c7b\u578b\u4e0e\u683c\u5f0f<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">order_id \u5339\u914d 20 \u4f4d\u6b63\u5219\uff1b\u91d1\u989d\u4e3a number \u975e string<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u91d1\u989d\u52fe\u7a3d<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">original_amount \u2212 discount_amount = total_amount<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5b57\u6bb5\u6cc4\u9732<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">additionalProperties=false\uff0c\u4e0d\u5f97\u8fd4\u56de cost_price<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P1<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"4\" style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4e8c \u00b7 \u6570\u636e<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8ba2\u5355\u4e3b\u8868<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">orders \u6709\u8bb0\u5f55\uff0cstatus=pending\uff0c\u91d1\u989d\u4e0e\u54cd\u5e94\u4e00\u81f4<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u660e\u7ec6\u5b50\u8868<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">order_items \u884c\u6570\u6b63\u786e\uff0c\u660e\u7ec6\u91d1\u989d\u6c42\u548c = \u4e3b\u8868\u91d1\u989d<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e93\u5b58\u8868<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">available_qty \u51cf\u5c11\uff0clocked_qty \u589e\u52a0<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4f18\u60e0\u5238\u8868<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">user_coupons.status \u53d8\u4e3a used\uff0cused_order_id \u56de\u586b<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\" style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4e09 \u00b7 \u94fe\u8def<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6570\u636e\u4f20\u9012<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">order_id \/ \u91d1\u989d\u4ece\u4e0b\u5355\u5230\u652f\u4ed8\u5230\u8be6\u60c5\u4e00\u8def\u4e0d\u53d8<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u72b6\u6001\u6d41\u8f6c<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">pending \u2192 paid\uff0cpaid_at \u5199\u5165\uff0cpayments \u6709\u6d41\u6c34<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u9006\u5411\u94fe\u8def<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8d85\u65f6\u5173\u5355\u540e\uff0c\u5e93\u5b58\u9884\u5360\u91ca\u653e\u3001\u4f18\u60e0\u5238\u9000\u56de<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P1<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td rowspan=\"3\" style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u56db \u00b7 \u5e76\u53d1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e93\u5b58\u4e0d\u8d85\u5356<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e93\u5b58 5 \u4ef6\uff0c20 \u5e76\u53d1\uff0c\u6210\u529f\u6570\u6070\u4e3a 5<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4e0b\u5355\u5e42\u7b49<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u540c\u4e00 Idempotency-Key \u6253 10 \u6b21\uff0c\u53ea\u4ea7\u751f 1 \u5355<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u56de\u8c03\u5e42\u7b49<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u540c\u4e00 trade_no \u56de\u8c03 5 \u6b21\uff0c\u6d41\u6c34\u53ea 1 \u6761\uff0c\u4e0d\u91cd\u590d\u53d1\u79ef\u5206<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section style=\"text-align: center;\"><span leaf=\"\">&#8212;<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4f18\u60e0\u5238\u5e76\u53d1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u540c\u4e00\u5f20\u5238\u5e76\u53d1\u4e0b 5 \u5355\uff0c\u53ea\u5141\u8bb8 1 \u5355\u4f7f\u7528\u6210\u529f<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">P0<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section style=\"text-align: left;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u4e00\u5171 15 \u4e2a\u6821\u9a8c\u70b9\u3002\u770b\u7740\u591a\uff0c\u4f46\u5b9e\u9645\u5199\u6210\u4ee3\u7801\u53ea\u6709 6 \u6761\u7528\u4f8b\u2014\u2014\u56e0\u4e3a\u4e00\u6761\u7528\u4f8b\u53ef\u4ee5\u8986\u76d6\u591a\u4e2a\u6821\u9a8c\u70b9\uff0c\u8fd9\u6b63\u662f\u56db\u7ef4\u6846\u67b6\u7684\u6548\u7387\u6240\u5728\u3002<\/span><\/span><\/span><\/span><\/section>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: bold;\">\ud83d\udca1 \u4e3a\u4ec0\u4e48\u8981\u753b\u8fd9\u5f20\u77e9\u9635<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6211\u5f3a\u5236\u8981\u6c42\u56e2\u961f\u5728\u52a8\u624b\u5199\u4ee3\u7801\u524d\u5148\u753b\u8fd9\u5f20\u8868\uff0c\u6709\u4e24\u4e2a\u539f\u56e0\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e00\u662f<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5b83\u80fd\u66b4\u9732\u9700\u6c42\u76f2\u533a<\/span><\/strong><span leaf=\"\">\u3002\u753b\u5230&#8221;\u4f18\u60e0\u5238\u5e76\u53d1&#8221;\u90a3\u4e00\u884c\u65f6\uff0c\u6211\u4eec\u624d\u610f\u8bc6\u5230\u9700\u6c42\u6587\u6863\u91cc\u538b\u6839\u6ca1\u8bf4&#8221;\u540c\u4e00\u5f20\u5238\u88ab\u5e76\u53d1\u4f7f\u7528\u8981\u600e\u4e48\u5904\u7406&#8221;\u3002\u8fd9\u4e2a\u95ee\u9898\u5728\u8bc4\u5ba1\u9636\u6bb5\u5c31\u629b\u7ed9\u4e86\u4ea7\u54c1\u548c\u5f00\u53d1\uff0c\u6bd4\u6d4b\u51fa\u6765\u518d\u6539\u6210\u672c\u4f4e\u5f97\u591a\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e8c\u662f<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5b83\u80fd\u4f5c\u4e3a\u63d0\u6d4b\u95e8\u7981<\/span><\/strong><span leaf=\"\">\u3002P0 \u6821\u9a8c\u70b9\u5168\u7eff\u624d\u7b97\u901a\u8fc7\uff0c\u8c01\u4e5f\u522b\u60f3\u62ff&#8221;\u63a5\u53e3\u8fd4\u56de 200 \u4e86&#8221;\u6765\u7cca\u5f04\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">5.4 \u4ee3\u7801\u5b9e\u73b0<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4e0b\u9762\u662f\u8fd9\u4e2a\u6848\u4f8b\u7684\u6838\u5fc3\u6d4b\u8bd5\u4ee3\u7801\u3002\u4e3a\u4e86\u770b\u8d77\u6765\u6e05\u723d\uff0c\u6211\u628a Schema \u548c\u5de5\u5177\u51fd\u6570\u7684 import \u90fd\u7701\u7565\u4e86\uff08\u5c31\u662f\u524d\u9762\u51e0\u7ae0\u90a3\u4e9b\uff09\u3002<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">test_order_e2e.py \u2014 \u7535\u5546\u8ba2\u5355\u63a5\u53e3\u56db\u7ef4\u9a8c\u8bc1<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__string\">\"\"\"\u7535\u5546\u8ba2\u5355\u63a5\u53e3 \u00b7 \u56db\u7ef4\u9a8c\u8bc1\u5b8c\u6574\u7528\u4f8b\u96c6\"\"\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;uuid<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;requests<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;decimal&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;Decimal<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;concurrent.futures&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;ThreadPoolExecutor<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;utils.assertions&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;assert_schema, assert_biz_code<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;utils.db_helper&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;query_one, query_all, wait_until<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;schemas.order_schema&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;ORDER_CREATE_SCHEMA<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u7528\u4f8b1\uff1a\u4e0b\u5355\u4e3b\u6d41\u7a0b \u2014\u2014 \u4e00\u6b21\u8986\u76d6\u7ef4\u5ea6\u4e00 + \u7ef4\u5ea6\u4e8c\uff088 \u4e2a\u6821\u9a8c\u70b9\uff09<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_create_order_with_coupon<\/span>(<span class=\"code-snippet__params\">api_session, base_url, ready_sku, ready_coupon<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; user_id =&nbsp;<span class=\"code-snippet__string\">\"U100000001\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; inv_before = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT available_qty, locked_qty FROM inventory WHERE sku_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (ready_sku,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; resp = api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span>, json={<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>: user_id,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"coupon_id\"<\/span>: ready_coupon,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: ready_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">2<\/span>}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; })<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># ---------- \u7ef4\u5ea6\u4e00\uff1a\u7ed3\u6784 ----------<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; body = assert_schema(resp, ORDER_CREATE_SCHEMA)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; d = body[<span class=\"code-snippet__string\">\"data\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order_id = d[<span class=\"code-snippet__string\">\"order_id\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u91d1\u989d\u52fe\u7a3d\uff1a\u4f18\u60e0\u524d - \u4f18\u60e0 = \u5b9e\u4ed8\u3002\u8fd9\u4e00\u6761\u6293\u5230\u8fc7 Bug#1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;(Decimal(<span class=\"code-snippet__built_in\">str<\/span>(d[<span class=\"code-snippet__string\">\"original_amount\"<\/span>])) - Decimal(<span class=\"code-snippet__built_in\">str<\/span>(d[<span class=\"code-snippet__string\">\"discount_amount\"<\/span>]))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; == Decimal(<span class=\"code-snippet__built_in\">str<\/span>(d[<span class=\"code-snippet__string\">\"total_amount\"<\/span>]))), (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e00\u00b7\u7ed3\u6784] \u91d1\u989d\u52fe\u7a3d\u4e0d\u4e0a\uff1a\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{d[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'original_amount'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;-&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{d[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'discount_amount'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;!=&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{d[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'total_amount'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># ---------- \u7ef4\u5ea6\u4e8c\uff1a\u6570\u636e ----------<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order = wait_until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT order_id, status, original_amount, discount_amount, \"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\" &nbsp; &nbsp; &nbsp; total_amount, coupon_id, is_deleted \"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"FROM orders WHERE order_id=%s\"<\/span>, (order_id,), timeout=<span class=\"code-snippet__number\">5<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order,&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u63a5\u53e3\u6210\u529f\u4f46 orders \u8868\u65e0\u8bb0\u5f55\uff1a<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order_id}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order[<span class=\"code-snippet__string\">\"status\"<\/span>] ==&nbsp;<span class=\"code-snippet__string\">\"pending\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;Decimal(<span class=\"code-snippet__built_in\">str<\/span>(order[<span class=\"code-snippet__string\">\"total_amount\"<\/span>])) == Decimal(<span class=\"code-snippet__built_in\">str<\/span>(d[<span class=\"code-snippet__string\">\"total_amount\"<\/span>])), (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u5e93\u4e2d\u5b9e\u4ed8\u91d1\u989d\u4e0e\u63a5\u53e3\u8fd4\u56de\u4e0d\u4e00\u81f4\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order[<span class=\"code-snippet__string\">\"coupon_id\"<\/span>] == ready_coupon,&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u8ba2\u5355\u6ca1\u6709\u8bb0\u5f55\u6240\u7528\u4f18\u60e0\u5238\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u660e\u7ec6\u884c\u91d1\u989d\u6c42\u548c\uff0c\u5fc5\u987b\u7b49\u4e8e\u4f18\u60e0\u524d\u91d1\u989d\uff08\u8fd9\u4e00\u6761\u6293\u5230\u8fc7 Bug#2\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; items = query_all(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT sku_id, quantity, price FROM order_items WHERE order_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (order_id,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(items) ==&nbsp;<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; items_sum =&nbsp;<span class=\"code-snippet__built_in\">sum<\/span>(Decimal(<span class=\"code-snippet__built_in\">str<\/span>(i[<span class=\"code-snippet__string\">\"price\"<\/span>])) * i[<span class=\"code-snippet__string\">\"quantity\"<\/span>]&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;i&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;items)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;items_sum == Decimal(<span class=\"code-snippet__built_in\">str<\/span>(order[<span class=\"code-snippet__string\">\"original_amount\"<\/span>])), (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u660e\u7ec6\u91d1\u989d\u6c42\u548c&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{items_sum}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;!= \u4e3b\u8868\u4f18\u60e0\u524d\u91d1\u989d&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'original_amount'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5e93\u5b58\uff1a\u53ef\u552e\u51cf\u5c11\u3001\u9884\u5360\u589e\u52a0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; inv_after = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT available_qty, locked_qty FROM inventory WHERE sku_id=%s\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (ready_sku,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;inv_after[<span class=\"code-snippet__string\">\"available_qty\"<\/span>] == inv_before[<span class=\"code-snippet__string\">\"available_qty\"<\/span>] -&nbsp;<span class=\"code-snippet__number\">2<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;inv_after[<span class=\"code-snippet__string\">\"locked_qty\"<\/span>] == inv_before[<span class=\"code-snippet__string\">\"locked_qty\"<\/span>] +&nbsp;<span class=\"code-snippet__number\">2<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u4f18\u60e0\u5238\uff1a\u72b6\u6001\u7f6e\u4e3a\u5df2\u4f7f\u7528\uff0c\u5e76\u56de\u586b\u8ba2\u5355\u53f7\uff08\u8fd9\u4e00\u6761\u6293\u5230\u8fc7 Bug#3\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; cp = query_one(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT status, used_order_id FROM user_coupons \"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"WHERE coupon_id=%s AND user_id=%s\"<\/span>, (ready_coupon, user_id),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;cp[<span class=\"code-snippet__string\">\"status\"<\/span>] ==&nbsp;<span class=\"code-snippet__string\">\"used\"<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u4f18\u60e0\u5238\u72b6\u6001\u5e94\u4e3a used\uff0c\u5b9e\u9645&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{cp[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'status'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\u2014\u2014\u5238\u53ef\u80fd\u88ab\u91cd\u590d\u4f7f\u7528\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;cp[<span class=\"code-snippet__string\">\"used_order_id\"<\/span>] == order_id,&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e] \u5238\u6ca1\u6709\u7ed1\u5b9a\u5230\u672c\u6b21\u8ba2\u5355\"<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u7528\u4f8b2\uff1a\u652f\u4ed8\u56de\u8c03\u5e42\u7b49 \u2014\u2014 \u7ef4\u5ea6\u4e09 + \u7ef4\u5ea6\u56db<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_payment_callback_idempotent<\/span>(<span class=\"code-snippet__params\">api_session, base_url, pending_order<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u652f\u4ed8\u6e20\u9053\u4f1a\u91cd\u590d\u63a8\u56de\u8c03\uff0c\u8fd9\u662f\u884c\u4e1a\u5e38\u6001\uff0c\u5fc5\u987b\u5e42\u7b49\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order_id, amount = pending_order<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; trade_no =&nbsp;<span class=\"code-snippet__string\">f\"TRADE<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{uuid.uuid4().<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">hex<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">14<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">].upper()}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; payload = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"order_id\"<\/span>: order_id,&nbsp;<span class=\"code-snippet__string\">\"trade_no\"<\/span>: trade_no,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"pay_amount\"<\/span>:&nbsp;<span class=\"code-snippet__built_in\">str<\/span>(amount),&nbsp;<span class=\"code-snippet__string\">\"channel\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"alipay\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u8fde\u7eed\u63a8 5 \u6b21\uff0c\u6a21\u62df\u6e20\u9053\u91cd\u590d\u56de\u8c03<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; bodies = [api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/payments\/callback\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json=payload).json()&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;_&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">range<\/span>(<span class=\"code-snippet__number\">5<\/span>)]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7ef4\u5ea6\u56db\uff1a5 \u6b21\u54cd\u5e94\u5fc5\u987b\u5b8c\u5168\u4e00\u81f4<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;i, b&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__built_in\">enumerate<\/span>(bodies[<span class=\"code-snippet__number\">1<\/span>:], start=<span class=\"code-snippet__number\">2<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;b == bodies[<span class=\"code-snippet__number\">0<\/span>],&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e42\u7b49] \u7b2c&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{i}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6b21\u56de\u8c03\u54cd\u5e94\u4e0e\u9996\u6b21\u4e0d\u540c\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7ef4\u5ea6\u4e8c\uff1a\u652f\u4ed8\u6d41\u6c34\u53ea\u80fd\u6709 1 \u6761\uff08\u8fd9\u4e00\u6761\u6293\u5230\u8fc7 Bug#4\uff09<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; pays = query_all(<span class=\"code-snippet__string\">\"SELECT id, amount FROM payments WHERE order_id=%s\"<\/span>, (order_id,))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(pays) ==&nbsp;<span class=\"code-snippet__number\">1<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e42\u7b49] 5 \u6b21\u56de\u8c03\u4ea7\u751f\u4e86&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">len<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(pays)}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u6761\u652f\u4ed8\u6d41\u6c34\uff0c\u8d22\u52a1\u5bf9\u8d26\u8981\u70b8\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7ef4\u5ea6\u4e09\uff1a\u72b6\u6001\u6b63\u786e\u6d41\u8f6c\uff0c\u4e14\u4f34\u968f\u5b57\u6bb5\u9f50\u5168<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; order = wait_until(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT status, paid_at FROM orders WHERE order_id=%s AND status='paid'\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (order_id,), timeout=<span class=\"code-snippet__number\">8<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;order&nbsp;<span class=\"code-snippet__keyword\">and<\/span>&nbsp;order[<span class=\"code-snippet__string\">\"paid_at\"<\/span>],&nbsp;<span class=\"code-snippet__string\">\"[\u7ef4\u5ea6\u4e09\u00b7\u94fe\u8def] \u652f\u4ed8\u540e\u72b6\u6001\u6216\u652f\u4ed8\u65f6\u95f4\u7f3a\u5931\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7ef4\u5ea6\u4e09\uff1a\u8be6\u60c5\u63a5\u53e3\u53cd\u67e5\uff0c\u91d1\u989d\u4e00\u8def\u4e0d\u53d8<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; d = assert_biz_code(api_session.get(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\/<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{order_id}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;Decimal(<span class=\"code-snippet__built_in\">str<\/span>(d[<span class=\"code-snippet__string\">\"total_amount\"<\/span>])) == amount<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u7528\u4f8b3\uff1a\u540c\u4e00\u5f20\u4f18\u60e0\u5238\u5e76\u53d1\u4e0b\u5355 \u2014\u2014 \u7ef4\u5ea6\u56db<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ============================================================<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_coupon_no_double_use<\/span>(<span class=\"code-snippet__params\">base_url, token, ready_sku, ready_coupon<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u4e00\u5f20\u5238\u5e76\u53d1\u4e0b 5 \u5355\uff0c\u53ea\u5141\u8bb8 1 \u5355\u7528\u5238\u6210\u529f\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; url =&nbsp;<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; headers = {<span class=\"code-snippet__string\">\"Authorization\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"Bearer&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{token}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>}<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">fire<\/span>(<span class=\"code-snippet__params\">i<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; r = requests.post(url, headers=headers, timeout=<span class=\"code-snippet__number\">10<\/span>, json={<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"U100000001\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"coupon_id\"<\/span>: ready_coupon,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: ready_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__number\">1<\/span>}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; })<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;r.json()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;ThreadPoolExecutor(max_workers=<span class=\"code-snippet__number\">5<\/span>)&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;pool:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; bodies =&nbsp;<span class=\"code-snippet__built_in\">list<\/span>(pool.<span class=\"code-snippet__built_in\">map<\/span>(fire,&nbsp;<span class=\"code-snippet__built_in\">range<\/span>(<span class=\"code-snippet__number\">5<\/span>)))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; ok = [b&nbsp;<span class=\"code-snippet__keyword\">for<\/span>&nbsp;b&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;bodies&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;b.get(<span class=\"code-snippet__string\">\"code\"<\/span>) ==&nbsp;<span class=\"code-snippet__number\">0<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(ok) ==&nbsp;<span class=\"code-snippet__number\">1<\/span>, (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e76\u53d1] \u4e00\u5f20\u5238\u88ab&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">len<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(ok)}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u7b14\u8ba2\u5355\u540c\u65f6\u7528\u6389\u4e86\uff0c\u76f4\u63a5\u8d44\u635f\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5e93\u91cc\u4e5f\u786e\u8ba4\u4e00\u904d\uff1a\u8fd9\u5f20\u5238\u53ea\u88ab\u4e00\u4e2a\u8ba2\u5355\u7ed1\u5b9a<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; rows = query_all(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"SELECT order_id FROM orders WHERE coupon_id=%s AND is_deleted=0\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; (ready_coupon,),<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__built_in\">len<\/span>(rows) ==&nbsp;<span class=\"code-snippet__number\">1<\/span>,&nbsp;<span class=\"code-snippet__string\">f\"[\u7ef4\u5ea6\u56db\u00b7\u5e76\u53d1] \u5238&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{ready_coupon}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5173\u8054\u4e86&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">len<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">(rows)}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u7b14\u8ba2\u5355\"<\/span><\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">5.5 \u8dd1\u51fa\u6765\u7684 4 \u4e2a\u95ee\u9898<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u5957\u7528\u4f8b\u5934\u4e00\u6b21\u8dd1\uff0c\u7eff\u4e86 2 \u6761\uff0c\u7ea2\u4e86 4 \u6761\u3002\u9010\u4e2a\u8bf4\u8bf4\u3002<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">Bug&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"msifisxp-b5mojg\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">#1<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">&nbsp;\u00b7 \u91d1\u989d\u52fe\u7a3d\u5bf9\u4e0d\u4e0a\uff08\u8d44\u635f\u7ea7\uff09<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u73b0\u8c61\uff1a<\/span><\/strong><span leaf=\"\">\u91d1\u989d\u52fe\u7a3d\u65ad\u8a00\u5931\u8d25\u3002\u63a5\u53e3\u8fd4\u56de&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">original_amount=199.80<\/span><\/code><span leaf=\"\">\u3001<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">discount_amount=20.00<\/span><\/code><span leaf=\"\">\u3001<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">total_amount=189.80<\/span><\/code><span leaf=\"\">\u3002199.80 \u2212 20.00 \u5e94\u8be5\u662f 179.80\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6392\u67e5\uff1a<\/span><\/strong><span leaf=\"\">\u5f00\u53d1\u4e00\u5f00\u59cb\u8bf4&#8221;\u4e0d\u53ef\u80fd\uff0c\u6211\u7b97\u8fc7\u7684&#8221;\u3002\u6211\u4eec\u628a\u8bf7\u6c42\u54cd\u5e94\u539f\u6837\u53d1\u8fc7\u53bb\uff0c\u4ed6\u81ea\u5df1\u8dd1\u4e86\u4e00\u904d\u624d\u53d1\u73b0\u2014\u2014\u4f18\u60e0\u5238\u662f&#8221;\u6ee1199\u51cf20&#8243;\uff0c\u4f46\u4ee3\u7801\u91cc\u7b97\u6298\u6263\u65f6\u7528\u4e86&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">min(discount, original * 0.05)<\/span><\/code><span leaf=\"\">&nbsp;\u8fd9\u4e48\u4e00\u884c\u5c01\u9876\u903b\u8f91\uff0c\u90a3\u662f\u4e0a\u4e2a\u5b63\u5ea6\u67d0\u4e2a\u6d3b\u52a8\u7559\u4e0b\u7684\u5386\u53f2\u4ee3\u7801\uff0c\u8fd9\u6b21\u590d\u7528\u65f6\u5fd8\u4e86\u6458\u6389\u3002199.80 \u00d7 5% = 9.99\uff0c\u5411\u4e0a\u53d6\u6574\u6210 10\uff0c\u4e8e\u662f\u5b9e\u4ed8\u53d8\u6210 189.80\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5f71\u54cd\uff1a<\/span><\/strong><span leaf=\"\">\u7528\u6237\u5c11\u4f18\u60e0 10 \u5757\uff0c\u5e73\u53f0\u770b\u7740\u5360\u4fbf\u5b9c\uff0c\u5b9e\u9645\u662f\u5ba2\u8bc9\u548c\u6295\u8bc9\u3002\u800c\u4e14\u5982\u679c\u5c01\u9876\u903b\u8f91\u53cd\u8fc7\u6765\u7b97\u9519\uff0c\u5c31\u662f\u5e73\u53f0\u4e8f\u94b1\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u8fd9\u4e2a bug \u53ea\u6709\u7ef4\u5ea6\u4e00\u80fd\u6293\u5230<\/span><\/strong><span leaf=\"\">\u2014\u2014\u56e0\u4e3a\u63a5\u53e3\u8fd4\u56de\u7684\u662f 200\uff0ccode \u662f 0\uff0c\u4e09\u4e2a\u91d1\u989d\u5b57\u6bb5\u90fd\u5728\uff0c\u7c7b\u578b\u90fd\u5bf9\u3002\u53ea\u6709\u52a0\u4e0a&#8221;\u4e09\u4e2a\u6570\u4e4b\u95f4\u5fc5\u987b\u52fe\u7a3d&#8221;\u8fd9\u6761\u65ad\u8a00\uff0c\u5b83\u624d\u4f1a\u73b0\u5f62\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: rgb(255, 41, 65);font-weight: bold;\">Bug&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"msifjowh-2fg0gm\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 16px;color: rgb(255, 41, 65);font-weight: bold;\">#2<\/span><\/a><span textstyle=\"\" style=\"font-size: 16px;color: rgb(255, 41, 65);font-weight: bold;\">&nbsp;\u00b7 \u660e\u7ec6\u5355\u4ef7\u7528\u4e86\u4f18\u60e0\u540e\u4ef7\u683c<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u73b0\u8c61\uff1a<\/span><\/strong><span leaf=\"\">\u660e\u7ec6\u91d1\u989d\u6c42\u548c 179.80 \u2260 \u4e3b\u8868\u4f18\u60e0\u524d\u91d1\u989d 199.80\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6392\u67e5\uff1a<\/span><\/strong><span leaf=\"\">\u5f00\u53d1\u628a\u4f18\u60e0\u91d1\u989d\u5e73\u644a\u5230\u4e86\u6bcf\u4e2a\u660e\u7ec6\u7684&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">price<\/span><\/code><span leaf=\"\">&nbsp;\u5b57\u6bb5\u91cc\uff0c\u5bfc\u81f4&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">order_items.price<\/span><\/code><span leaf=\"\">&nbsp;\u5b58\u7684\u662f&#8221;\u4f18\u60e0\u540e\u5355\u4ef7&#8221;\u3002\u4f46\u4e3b\u8868\u7684&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">original_amount<\/span><\/code><span leaf=\"\">&nbsp;\u5b58\u7684\u662f\u4f18\u60e0\u524d\u7684\u3002\u4e24\u8fb9\u53e3\u5f84\u4e0d\u4e00\u81f4\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5f71\u54cd\uff1a<\/span><\/strong><span leaf=\"\">\u8fd9\u4e2a\u95ee\u9898\u5728\u4e0b\u5355\u65f6\u4e0d\u660e\u663e\uff0c\u4f46\u9000\u6b3e\u65f6\u4f1a\u70b8\u3002\u90e8\u5206\u9000\u6b3e\u6309\u660e\u7ec6\u5355\u4ef7\u9000\uff0c\u7528\u6237\u9000\u4e00\u4ef6\u5546\u54c1\uff0c\u9000\u5230\u7684\u94b1\u6bd4\u4ed6\u5b9e\u9645\u4ed8\u7684\u5c11\u3002\u4e0b\u6e38\u7684\u5546\u54c1\u9500\u552e\u62a5\u8868\u4e5f\u4f1a\u7b97\u9519\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6293\u5230\u5b83\u7684\u662f\u7ef4\u5ea6\u4e8c<\/span><\/strong><span leaf=\"\">\u7684&#8221;\u660e\u7ec6\u6c42\u548c = \u4e3b\u8868\u91d1\u989d&#8221;\u8fd9\u6761\u52fe\u7a3d\u65ad\u8a00\u3002\u5982\u679c\u53ea\u67e5 orders \u8868\u4e0d\u67e5 order_items\uff0c\u8fd9\u4e2a\u95ee\u9898\u4f1a\u4e00\u76f4\u8eba\u5230\u6709\u4eba\u7533\u8bf7\u90e8\u5206\u9000\u6b3e\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">Bug&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"msifkb9d-8tyn02\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">#3<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">&nbsp;\u00b7 \u4f18\u60e0\u5238\u88ab\u5e76\u53d1\u7528\u4e86 3 \u6b21\uff08\u8d44\u635f\u7ea7\uff09<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u73b0\u8c61\uff1a<\/span><\/strong><span leaf=\"\">\u5e76\u53d1\u7528\u4f8b\u91cc\uff0c\u540c\u4e00\u5f20\u5238 5 \u4e2a\u5e76\u53d1\u8bf7\u6c42\uff0c\u6210\u529f\u4e86 3 \u5355\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6392\u67e5\uff1a<\/span><\/strong><span leaf=\"\">\u4ee3\u7801\u903b\u8f91\u662f\u6807\u51c6\u7684 check-then-act\uff1a\u5148&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">SELECT status FROM user_coupons WHERE coupon_id=?<\/span><\/code><span leaf=\"\">&nbsp;\u5224\u65ad\u662f\u4e0d\u662f unused\uff0c\u518d&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">UPDATE ... SET status='used'<\/span><\/code><span leaf=\"\">\u3002\u5e76\u53d1\u65f6\u4e09\u4e2a\u7ebf\u7a0b\u90fd\u8bfb\u5230\u4e86 unused\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5f71\u54cd\uff1a<\/span><\/strong><span leaf=\"\">\u4e00\u5f20 20 \u5143\u7684\u5238\u88ab\u7528 3 \u6b21\uff0c\u76f4\u63a5\u4e8f 40 \u5757\u3002\u542c\u8d77\u6765\u4e0d\u591a\uff0c\u4f46\u8fd9\u662f\u53ef\u4ee5\u88ab\u811a\u672c\u6279\u91cf\u5237\u7684\u2014\u2014\u8585\u7f8a\u6bdb\u56e2\u4f19\u5c31\u9760\u8fd9\u4e2a\u5403\u996d\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u503c\u5f97\u8bf4\u7684\u662f<\/span><\/strong><span leaf=\"\">\uff0c\u8fd9\u4e2a bug \u5728\u529f\u80fd\u6d4b\u8bd5\u9636\u6bb5\u5b8c\u5168\u6d4b\u4e0d\u51fa\u6765\u3002\u624b\u5de5\u70b9\u3001Postman \u70b9\u3001\u5355\u7ebf\u7a0b\u7528\u4f8b\u8dd1\uff0c\u90fd\u662f\u6b63\u5e38\u7684\u3002\u53ea\u6709\u5e76\u53d1\u7528\u4f8b\u80fd\u628a\u5b83\u903c\u51fa\u6765\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">Bug&nbsp;<\/span><a class=\"wx_topic_link\" topic-id=\"msifkszq-pggrkh\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">#4<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">&nbsp;\u00b7 \u91cd\u590d\u56de\u8c03\u4ea7\u751f\u591a\u6761\u652f\u4ed8\u6d41\u6c34<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u73b0\u8c61\uff1a<\/span><\/strong><span leaf=\"\">\u540c\u4e00\u4e2a&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">trade_no<\/span><\/code><span leaf=\"\">&nbsp;\u63a8 5 \u6b21\u56de\u8c03\uff0c5 \u6b21\u90fd\u8fd4\u56de\u6210\u529f\uff0c\u4f46 payments \u8868\u91cc\u51fa\u73b0\u4e86 5 \u6761\u6d41\u6c34\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6392\u67e5\uff1a<\/span><\/strong><span leaf=\"\">\u63a5\u53e3\u5bf9\u8ba2\u5355\u72b6\u6001\u505a\u4e86\u5224\u65ad\uff08\u5df2 paid \u5c31\u4e0d\u518d\u6539\u72b6\u6001\uff09\uff0c\u6240\u4ee5\u8ba2\u5355\u8868\u770b\u7740\u662f\u5bf9\u7684\uff0c\u72b6\u6001\u6ca1\u88ab\u6539\u4e71\u3002\u4f46\u5199\u6d41\u6c34\u90a3\u4e00\u6b65\u6ca1\u6709\u505a\u53bb\u91cd\uff0c\u6bcf\u6b21\u56de\u8c03\u90fd INSERT \u4e00\u6761\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5f71\u54cd\uff1a<\/span><\/strong><span leaf=\"\">\u8d22\u52a1\u5bf9\u8d26\u65f6\uff0c\u4e00\u7b14\u8ba2\u5355\u5bf9\u5e94 5 \u6761\u6d41\u6c34\uff0c\u91d1\u989d\u52a0\u8d77\u6765\u662f\u5b9e\u4ed8\u7684 5 \u500d\u3002\u5bf9\u8d26\u7cfb\u7edf\u4f1a\u76f4\u63a5\u544a\u8b66\uff0c\u7136\u540e\u8d22\u52a1\u540c\u4e8b\u6765\u627e\u6d4b\u8bd5\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(93, 64, 55);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u8fd9\u4e2a bug \u7279\u522b\u6709\u4ee3\u8868\u6027<\/span><\/strong><span leaf=\"\">\uff1a\u5b83\u7684&#8221;\u4e3b\u6d41\u7a0b&#8221;\u662f\u5bf9\u7684\uff08\u8ba2\u5355\u72b6\u6001\u6b63\u786e\uff09\uff0c\u9519\u7684\u662f\u526f\u4f5c\u7528\u3002\u5982\u679c\u7528\u4f8b\u53ea\u65ad\u8a00&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">order.status == 'paid'<\/span><\/code><span leaf=\"\">\uff0c\u5b83\u5c31\u662f\u7eff\u7684\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u6211\u628a\u8fd9 4 \u4e2a bug \u6446\u5728\u4e00\u8d77\uff0c\u4f60\u4f1a\u53d1\u73b0\u4e00\u4e2a\u89c4\u5f8b\uff1a<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;text-decoration: underline;\">\u5b83\u4eec 4 \u4e2a\u7684 HTTP \u72b6\u6001\u7801\u5168\u90fd\u662f 200\uff0c\u4e1a\u52a1\u7801\u5168\u90fd\u662f 0\u3002<\/span><\/span><\/strong><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">Bug<\/span><a class=\"wx_topic_link\" topic-id=\"msifldll-j6svom\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">#1<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">&nbsp;\u9760\u5b57\u6bb5\u95f4\u7684\u52fe\u7a3d\u5173\u7cfb\u6293\u5230\uff0cBug<\/span><a class=\"wx_topic_link\" topic-id=\"msifldll-wp073y\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">#2<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">&nbsp;\u9760\u8de8\u8868\u6570\u636e\u6bd4\u5bf9\u6293\u5230\uff0cBug<\/span><a class=\"wx_topic_link\" topic-id=\"msifldll-pvku3l\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">#3<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">&nbsp;\u9760\u5e76\u53d1\u6293\u5230\uff0cBug<\/span><a class=\"wx_topic_link\" topic-id=\"msifldll-2nkwr7\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">#4<\/span><\/a><span textstyle=\"\" style=\"font-size: 15px;font-style: italic;\">&nbsp;\u9760&#8221;\u526f\u4f5c\u7528\u6570\u636e&#8221;\u7684\u6570\u91cf\u65ad\u8a00\u6293\u5230\u3002<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: bold;font-style: italic;\">\u6ca1\u6709\u4e00\u4e2a\u662f\u9760&#8221;\u68c0\u67e5\u8fd4\u56de\u503c\u662f\u4e0d\u662f 200&#8243;\u53d1\u73b0\u7684\u3002<\/span><\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">5.6 \u4fee\u590d\u9a8c\u8bc1\uff1a\u4e0d\u53ea\u662f&#8221;\u6539\u5b8c\u518d\u8dd1\u4e00\u904d&#8221;<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5f00\u53d1\u4fee\u5b8c\u4e86\uff0c\u600e\u4e48\u9a8c\uff1f\u8fd9\u4e00\u6b65\u5f88\u591a\u4eba\u505a\u5f97\u592a\u7c97\u2014\u2014\u91cd\u65b0\u8dd1\u4e00\u904d\u539f\u7528\u4f8b\uff0c\u7eff\u4e86\u5c31\u5173\u5355\u3002\u6211\u7684\u505a\u6cd5\u591a\u4e24\u6b65\u3002<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: bold;\">\u7b2c 1 \u6b65\uff1a\u786e\u8ba4\u4fee\u590d\u65b9\u5f0f\uff0c\u800c\u4e0d\u53ea\u662f\u786e\u8ba4\u73b0\u8c61\u6d88\u5931<\/span><\/span><\/p>\n<p style=\"margin: 7px 0px;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">Bug<a class=\"wx_topic_link\" topic-id=\"msifmv20-o5x2zr\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#3<\/a>&nbsp;\u5f00\u53d1\u7684\u5934\u4e00\u7248\u4fee\u590d\u662f&#8221;\u52a0\u4e86\u4e2a Redis \u5206\u5e03\u5f0f\u9501&#8221;\u3002\u6211\u8ffd\u95ee\u4e86\u4e00\u53e5\uff1a\u9501\u7684 key \u662f\u4ec0\u4e48\uff1f\u7b54\uff1a<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">coupon:{coupon_id}<\/span><\/code><span leaf=\"\">\u3002\u518d\u95ee\uff1a\u9501\u8d85\u65f6\u65f6\u95f4\u591a\u4e45\uff1f\u7b54\uff1a\u5fd8\u4e86\u8bbe\u3002<\/span><\/p>\n<p style=\"margin: 7px 0px;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6ca1\u8bbe\u8d85\u65f6\u7684\u5206\u5e03\u5f0f\u9501\uff0c\u4e00\u65e6\u6301\u9501\u7684\u8fdb\u7a0b\u5d29\u4e86\uff0c\u8fd9\u5f20\u5238\u5c31\u6c38\u8fdc\u9501\u6b7b\u4e86\u3002\u6240\u4ee5\u4fee\u590d\u65b9\u6848\u672c\u8eab\u4e5f\u5f97\u8bc4\u5ba1\u3002\u540e\u6765\u6539\u6210\u4e86\u6570\u636e\u5e93\u4e50\u89c2\u9501\uff1a<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">UPDATE user_coupons SET status='used', used_order_id=? WHERE coupon_id=? AND status='unused'<\/span><\/code><span leaf=\"\">\uff0c\u7136\u540e\u5224\u65ad&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">affected_rows<\/span><\/code><span leaf=\"\">\u3002\u8fd9\u4e2a\u65b9\u6848\u4e0d\u4f9d\u8d56\u5916\u90e8\u7ec4\u4ef6\uff0c\u66f4\u7a33\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: bold;\">\u7b2c 2 \u6b65\uff1a\u52a0\u56fa\u7528\u4f8b\uff0c\u628a\u4fee\u590d\u70b9\u6c89\u6dc0\u6210\u957f\u671f\u9632\u7ebf<\/span><\/span><\/p>\n<p style=\"margin: 7px 0px;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5149\u8dd1\u539f\u7528\u4f8b\u4e0d\u591f\uff0c\u6211\u9488\u5bf9\u6bcf\u4e2a bug \u8865\u4e86\u66f4\u4e25\u7684\u65ad\u8a00\u3002\u6bd4\u5982 Bug<a class=\"wx_topic_link\" topic-id=\"msifnh5k-jcmy6z\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#3<\/a>&nbsp;\u4fee\u590d\u540e\uff0c\u5e76\u53d1\u6570\u4ece 5 \u63d0\u5230 20\uff0c\u5e76\u4e14\u52a0\u4e86\u4e00\u6761&#8221;\u5931\u8d25\u7684 19 \u4e2a\u8bf7\u6c42\uff0c\u4e1a\u52a1\u7801\u5fc5\u987b\u90fd\u662f 4005\uff08\u4f18\u60e0\u5238\u4e0d\u53ef\u7528\uff09\uff0c\u4e0d\u80fd\u662f 500&#8243;\u3002<\/span><\/p>\n<p style=\"margin: 7px 0px;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u6761\u65ad\u8a00\u5f53\u573a\u53c8\u6293\u5230\u4e00\u4e2a\u5c0f\u95ee\u9898\uff1a\u4e50\u89c2\u9501\u7ade\u4e89\u5931\u8d25\u65f6\uff0c\u540e\u7aef\u629b\u7684\u662f\u672a\u6355\u83b7\u5f02\u5e38\uff0c\u8fd4\u56de\u4e86 500 \u800c\u4e0d\u662f 4005\u3002\u7528\u6237\u770b\u5230\u7684\u662f&#8221;\u7cfb\u7edf\u7e41\u5fd9&#8221;\uff0c\u800c\u4e0d\u662f&#8221;\u5238\u5df2\u88ab\u4f7f\u7528&#8221;\u3002\u4f53\u9a8c\u5dee\u522b\u5f88\u5927\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;font-weight: bold;\">\u7b2c 3 \u6b65\uff1a\u56de\u5f52\u5f71\u54cd\u9762\uff0c\u800c\u4e0d\u53ea\u662f\u56de\u5f52 bug \u672c\u8eab<\/span><\/span><\/p>\n<p style=\"margin: 7px 0px;color: rgb(51, 51, 51);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">Bug<a class=\"wx_topic_link\" topic-id=\"msifo0ei-a2gmyq\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#2<\/a>&nbsp;\u6539\u7684\u662f\u660e\u7ec6\u91d1\u989d\u53e3\u5f84\u3002\u8fd9\u4e2a\u6539\u52a8\u4f1a\u5f71\u54cd\u9000\u6b3e\u3001\u62a5\u8868\u3001\u5bf9\u8d26\u4e09\u6761\u4e0b\u6e38\u94fe\u8def\u3002\u6240\u4ee5\u56de\u5f52\u65f6\u6211\u4eec\u989d\u5916\u8dd1\u4e86\u9000\u6b3e\u94fe\u8def\u7684\u7528\u4f8b\uff0c\u679c\u7136\u53d1\u73b0\u9000\u6b3e\u91d1\u989d\u7684\u8ba1\u7b97\u903b\u8f91\u4e5f\u8981\u8ddf\u7740\u6539\u2014\u2014\u4e0d\u7136\u6539\u5b8c\u4e0b\u5355\uff0c\u9000\u6b3e\u53c8\u9519\u4e86\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u6574\u4f53\u7684\u56de\u5f52\u7ed3\u679c\u5982\u4e0b\uff1a<\/span><\/span><\/span><\/span><\/span><\/section>\n<table style=\"width: 704px;border-collapse: collapse;font-size: 14px;background: rgb(255, 255, 255);\">\n<thead>\n<tr>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">Bug<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u4fee\u590d\u65b9\u5f0f<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u52a0\u56fa\u540e\u7684\u9a8c\u8bc1<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u7ed3\u679c<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\"><a class=\"wx_topic_link\" topic-id=\"msifp0o0-857k6u\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#1<\/a>&nbsp;\u91d1\u989d\u52fe\u7a3d<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u79fb\u9664\u5386\u53f2\u5c01\u9876\u903b\u8f91<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8865 6 \u7ec4\u5238\u9762\u989d\u53c2\u6570\u5316\u7528\u4f8b\uff08\u6ee1\u51cf\/\u6298\u6263\/\u65e0\u95e8\u69db\uff09<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u901a\u8fc7<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\"><a class=\"wx_topic_link\" topic-id=\"msifp0o0-21p2xs\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#2<\/a>&nbsp;\u660e\u7ec6\u53e3\u5f84<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">price \u5b58\u539f\u4ef7\uff0c\u53e6\u52a0 discount_share \u5b57\u6bb5<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4e0b\u5355 + \u90e8\u5206\u9000\u6b3e + \u62a5\u8868\u4e09\u6761\u94fe\u8def\u56de\u5f52<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u901a\u8fc7<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\"><a class=\"wx_topic_link\" topic-id=\"msifp0o1-uhnclo\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#3<\/a>&nbsp;\u5238\u5e76\u53d1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6570\u636e\u5e93\u4e50\u89c2\u9501 + affected_rows \u5224\u65ad<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e76\u53d1\u6570\u63d0\u5230 20\uff0c\u5931\u8d25\u8bf7\u6c42\u4e1a\u52a1\u7801\u65ad\u8a00<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u901a\u8fc7<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\"><a class=\"wx_topic_link\" topic-id=\"msifp0o1-zf9bn9\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#4<\/a>&nbsp;\u6d41\u6c34\u91cd\u590d<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">trade_no \u52a0\u552f\u4e00\u7d22\u5f15 + \u6355\u83b7\u91cd\u590d\u952e<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u56de\u8c03 20 \u6b21 + \u5e76\u53d1 10 \u6b21\u53cc\u91cd\u9a8c\u8bc1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u901a\u8fc7<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u6b21\u8fed\u4ee3\u6574\u4f53\u5ef6\u671f\u4e86 1.5 \u5929\u3002\u542c\u8d77\u6765\u662f\u574f\u4e8b\uff0c\u4f46\u4f60\u6362\u4e2a\u7b97\u6cd5\uff1a4 \u4e2a bug \u5982\u679c\u6f0f\u5230\u7ebf\u4e0a\uff0cBug<a class=\"wx_topic_link\" topic-id=\"msifp0o1-g0wheg\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#1<\/a>&nbsp;\u548c Bug<a class=\"wx_topic_link\" topic-id=\"msifp0o1-90qff9\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#3<\/a>&nbsp;\u90fd\u662f\u8d44\u635f\uff0c\u52a0\u4e0a\u7d27\u6025\u53d1\u7248\u3001\u5ba2\u670d\u89e3\u91ca\u3001\u8d22\u52a1\u5bf9\u8d26\u3001\u6570\u636e\u4fee\u590d\u7684\u6210\u672c\uff0c\u7edd\u5bf9\u4e0d\u6b62 1.5 \u5929\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u800c\u4e14\u8fd9\u5957\u7528\u4f8b\u662f\u53ef\u4ee5\u590d\u7528\u7684\u3002\u4e0b\u4e2a\u8fed\u4ee3\u6539\u8ba2\u5355\u903b\u8f91\uff0c\u76f4\u63a5\u8dd1\u4e00\u904d\uff0c10 \u5206\u949f\u51fa\u7ed3\u679c\u3002<\/span><\/p>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<h2 style=\"font-size: 21px;color: rgb(15, 52, 96);margin: 44px 0px 18px;padding-left: 14px;border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(255, 167, 38);font-weight: 700;margin-right: 8px;\"><span leaf=\"\">06<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u628a\u56db\u7ef4\u6821\u9a8c\u5c01\u88c5\u6210\u56e2\u961f\u7684\u57fa\u7840\u8bbe\u65bd<\/span><\/span><\/h2>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">6.1 conftest.py\uff1a\u8ba9\u65b0\u4eba\u6284\u4e00\u884c\u5c31\u80fd\u7528<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u56db\u7ef4\u6821\u9a8c\u5982\u679c\u6563\u843d\u5728\u6bcf\u4e2a\u4eba\u7684\u7528\u4f8b\u6587\u4ef6\u91cc\uff0c\u4e00\u4e2a\u6708\u4e4b\u540e\u5c31\u4f1a\u53d8\u6210\u56db\u4e2a\u7248\u672c\u3002\u7edf\u4e00\u653e\u8fdb&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">conftest.py<\/span><\/code><span leaf=\"\">\uff0c\u624d\u80fd\u771f\u6b63\u53d8\u6210\u56e2\u961f\u8d44\u4ea7\u3002<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">conftest.py \u2014 \u56db\u7ef4\u6821\u9a8c\u6846\u67b6\u7684\u7edf\u4e00\u4f9b\u7ed9<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># -*- coding: utf-8 -*-<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;os<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;time<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;uuid<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;requests<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pymysql<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;utils.db_helper&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;DB_CONF, query_one<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ---------- \u57fa\u7840\u914d\u7f6e ----------<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture(<\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">scope=<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"session\"<\/span><\/span><\/span><span class=\"code-snippet__meta\">)<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">base_url<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u73af\u5883\u5730\u5740\u4ece\u73af\u5883\u53d8\u91cf\u8bfb\uff0c\u65b9\u4fbf\u5728 CI \u91cc\u5207 dev\/test\/staging<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;os.getenv(<span class=\"code-snippet__string\">\"API_BASE_URL\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"http:\/\/api-test.internal\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ---------- Token \u81ea\u52a8\u7eed\u671f\uff08\u89e3\u51b3\"\u8dd1\u7740\u8dd1\u7740\u5168\u6302\"\uff09 ----------<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">class<\/span>&nbsp;<span class=\"code-snippet__title\">TokenManager<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; Token \u4e0d\u786c\u7f16\u7801\uff0c\u4e14\u5728\u5feb\u8fc7\u671f\u65f6\u81ea\u52a8\u7eed\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u5f88\u591a\u56e2\u961f\u7684\u7528\u4f8b\u96c6\u8dd1\u5230\u4e00\u534a\u7a81\u7136\u5168\u7ea2\uff0c\u5341\u6709\u516b\u4e5d\u662f Token \u5230\u671f\u4e86\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">__init__<\/span>(<span class=\"code-snippet__params\">self, base_url<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__variable\">self<\/span>.base_url = base_url<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__variable\">self<\/span>._token =&nbsp;<span class=\"code-snippet__literal\">None<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__variable\">self<\/span>._expire_at =&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">get<\/span>(<span class=\"code-snippet__params\">self<\/span>) -&gt;&nbsp;<span class=\"code-snippet__built_in\">str<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u5269\u4f59\u6709\u6548\u671f\u4e0d\u8db3 5 \u5206\u949f\u5c31\u63d0\u524d\u6362\u65b0\u7684<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__variable\">self<\/span>._token&nbsp;<span class=\"code-snippet__keyword\">and<\/span>&nbsp;time.time() &lt;&nbsp;<span class=\"code-snippet__variable\">self<\/span>._expire_at -&nbsp;<span class=\"code-snippet__number\">300<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__variable\">self<\/span>._token<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; r = requests.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{self.base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/auth\/login\"<\/span>, json={<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"username\"<\/span>: os.environ[<span class=\"code-snippet__string\">\"QA_USER\"<\/span>],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"password\"<\/span>: os.environ[<span class=\"code-snippet__string\">\"QA_PASS\"<\/span>],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; }, timeout=<span class=\"code-snippet__number\">10<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; r.raise_for_status()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; data = r.json()[<span class=\"code-snippet__string\">\"data\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__variable\">self<\/span>._token = data[<span class=\"code-snippet__string\">\"access_token\"<\/span>]<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__variable\">self<\/span>._expire_at = time.time() + data.get(<span class=\"code-snippet__string\">\"expires_in\"<\/span>,&nbsp;<span class=\"code-snippet__number\">7200<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;<span class=\"code-snippet__variable\">self<\/span>._token<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture(<\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">scope=<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"session\"<\/span><\/span><\/span><span class=\"code-snippet__meta\">)<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">token_mgr<\/span>(<span class=\"code-snippet__params\">base_url<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;TokenManager(base_url)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">token<\/span>(<span class=\"code-snippet__params\">token_mgr<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;token_mgr.get()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">api_session<\/span>(<span class=\"code-snippet__params\">token<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u5e26\u8ba4\u8bc1\u5934\u7684 session\uff0c\u8fde\u63a5\u590d\u7528\uff0c\u6bd4\u6bcf\u6b21\u65b0\u5efa requests \u5feb\u5f88\u591a\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; s = requests.Session()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; s.headers.update({<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"Authorization\"<\/span>:&nbsp;<span class=\"code-snippet__string\">f\"Bearer&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{token}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"Content-Type\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"application\/json\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6253\u6807\u8bb0\uff0c\u65b9\u4fbf\u540e\u7aef\u5728\u65e5\u5fd7\u91cc\u533a\u5206\u81ea\u52a8\u5316\u6d41\u91cf<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"X-Request-Source\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"qa-automation\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; })<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; s.request = _with_timeout(s.request, default=<span class=\"code-snippet__number\">15<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;s<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; s.close()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">_with_timeout<\/span>(<span class=\"code-snippet__params\">func, default=<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__number\">15<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u7ed9\u6240\u6709\u8bf7\u6c42\u515c\u4e00\u4e2a\u9ed8\u8ba4\u8d85\u65f6\uff0c\u9632\u6b62\u67d0\u4e2a\u63a5\u53e3\u5361\u6b7b\u62d6\u57ae\u6574\u6279\u7528\u4f8b\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">wrapper<\/span>(<span class=\"code-snippet__params\">method, url, **kw<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; kw.setdefault(<span class=\"code-snippet__string\">\"timeout\"<\/span>, default)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;func(method, url, **kw)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">return<\/span>&nbsp;wrapper<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ---------- \u6570\u636e\u5e93\u5199\u64cd\u4f5c\uff08\u9020\u6570\u636e \/ \u6e05\u7406\u7528\uff09 ----------<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">db_write<\/span>():<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u63d0\u4f9b\u4e00\u4e2a\u53ef\u6267\u884c\u5199 SQL \u7684\u51fd\u6570\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6ce8\u610f\uff1a\u8fd9\u4e2a fixture \u7528\u7684\u662f\u6709\u5199\u6743\u9650\u7684\u8d26\u53f7\uff0c\u548c\u67e5\u8be2\u7528\u7684\u53ea\u8bfb\u8d26\u53f7\u5206\u5f00\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u9020\u6570\u636e\u3001\u6539\u72b6\u6001\u3001\u91cd\u7f6e\u5e93\u5b58\u8d70\u8fd9\u91cc\uff0c\u666e\u901a\u65ad\u8a00\u67e5\u8be2\u8d70 query_one\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; conn = pymysql.connect(**{**DB_CONF,&nbsp;<span class=\"code-snippet__string\">\"user\"<\/span>: os.environ[<span class=\"code-snippet__string\">\"DB_RW_USER\"<\/span>],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"password\"<\/span>: os.environ[<span class=\"code-snippet__string\">\"DB_RW_PASS\"<\/span>]})<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">_exec<\/span>(<span class=\"code-snippet__params\">sql:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">str<\/span><\/span><span class=\"code-snippet__params\">, args:&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__built_in\">tuple<\/span><\/span><span class=\"code-snippet__params\">&nbsp;= ()<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">with<\/span>&nbsp;conn.cursor()&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;cur:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cur.execute(sql, args)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; conn.commit()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;_<span class=\"code-snippet__built_in\">exec<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; conn.close()<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ---------- \u6d4b\u8bd5\u6570\u636e fixture\uff1a\u5929\u7136\u9694\u79bb\uff0c\u4e0d\u9760\u6e05\u7406\u903b\u8f91 ----------<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">ready_sku<\/span>(<span class=\"code-snippet__params\">db_write<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u6bcf\u4e2a\u7528\u4f8b\u9020\u4e00\u4e2a\u72ec\u7acb SKU\uff0c\u907f\u514d\u5e76\u884c\u6267\u884c\u65f6\u4e92\u76f8\u62a2\u5e93\u5b58\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u8fd9\u91cc\u7528 yield \u800c\u4e0d\u662f return\uff0c\u662f\u4e3a\u4e86\u4fdd\u8bc1 teardown \u4e00\u5b9a\u4f1a\u6267\u884c\u2014\u2014<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \u5373\u4f7f\u7528\u4f8b\u4e2d\u9014\u65ad\u8a00\u5931\u8d25\uff0cyield \u4e4b\u540e\u7684\u6e05\u7406\u4ee3\u7801\u7167\u6837\u8dd1\u3002<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; \"\"\"<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; sku_id =&nbsp;<span class=\"code-snippet__string\">f\"SKU<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{uuid.uuid4().<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">hex<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">7<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">].upper()}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; db_write(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"INSERT INTO inventory (sku_id, available_qty, locked_qty, price) \"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"VALUES (%s, 100, 0, 99.90)\"<\/span>, (sku_id,)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;sku_id<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6e05\u7406\u7528\u8f6f\u5220\u9664\uff0c\u4e0d\u505a\u7269\u7406 DELETE \u2014\u2014 WHERE \u5199\u9519\u4e00\u6b21\u5c31\u56de\u4e0d\u6765\u4e86<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; db_write(<span class=\"code-snippet__string\">\"UPDATE inventory SET is_deleted=1 WHERE sku_id=%s\"<\/span>, (sku_id,))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u6e05\u7406\u5931\u8d25\u4e0d\u80fd\u5f71\u54cd\u7528\u4f8b\u672c\u8eab\u7684\u7ed3\u8bba\uff0c\u6253\u65e5\u5fd7\u5c31\u597d<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[teardown] \u6e05\u7406 SKU&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{sku_id}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5931\u8d25:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">ready_coupon<\/span>(<span class=\"code-snippet__params\">db_write<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u9020\u4e00\u5f20\u6ee1199\u51cf20\u7684\u672a\u4f7f\u7528\u4f18\u60e0\u5238\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; cid =&nbsp;<span class=\"code-snippet__string\">f\"CP<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{uuid.uuid4().<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__built_in\">hex<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">[:<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__number\">11<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">].upper()}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; db_write(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"INSERT INTO user_coupons (coupon_id, user_id, threshold, discount, status) \"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"VALUES (%s, 'U100000001', 199.00, 20.00, 'unused')\"<\/span>, (cid,)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;cid<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; db_write(<span class=\"code-snippet__string\">\"UPDATE user_coupons SET is_deleted=1 WHERE coupon_id=%s\"<\/span>, (cid,))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[teardown] \u6e05\u7406\u5238&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{cid}<\/span><\/span><span class=\"code-snippet__string\">&nbsp;\u5931\u8d25:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># ---------- \u81ea\u5b9a\u4e49 marker\uff0c\u65b9\u4fbf\u6309\u7ef4\u5ea6\u7b5b\u9009\u6267\u884c ----------<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">pytest_configure<\/span>(<span class=\"code-snippet__params\">config<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; config.addinivalue_line(<span class=\"code-snippet__string\">\"markers\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"schema: \u7ef4\u5ea6\u4e00 \u7ed3\u6784\u6821\u9a8c\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; config.addinivalue_line(<span class=\"code-snippet__string\">\"markers\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"db: \u7ef4\u5ea6\u4e8c \u6570\u636e\u4e00\u81f4\u6027\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; config.addinivalue_line(<span class=\"code-snippet__string\">\"markers\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"chain: \u7ef4\u5ea6\u4e09 \u4e1a\u52a1\u94fe\u8def\"<\/span>)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; config.addinivalue_line(<span class=\"code-snippet__string\">\"markers\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"concurrency: \u7ef4\u5ea6\u56db \u5e76\u53d1\u5e42\u7b49\"<\/span>)<\/span><\/code><\/pre>\n<\/section>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u6709\u4e86\u8fd9\u5957\u4e1c\u897f\uff0cCI \u91cc\u5c31\u80fd\u6309\u7ef4\u5ea6\u5206\u5f00\u8dd1\uff1a<\/span><\/p>\n<p style=\"text-align: center;\"><span leaf=\"\">CI \u91cc\u7684\u5206\u5c42\u6267\u884c\u7b56\u7565<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"apache\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u6bcf\u6b21\u63d0\u4ea4\uff1a\u53ea\u8dd1\u5feb\u7684\uff08\u7ed3\u6784 + \u6570\u636e\uff09\uff0c2 \u5206\u949f\u51fa\u7ed3\u679c<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">pytest<\/span>&nbsp;-m&nbsp;<span class=\"code-snippet__string\">\"schema or db\"<\/span>&nbsp;-n&nbsp;<span class=\"code-snippet__number\">4<\/span>&nbsp;--tb=short<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u6bcf\u65e5\u6784\u5efa\uff1a\u52a0\u4e0a\u94fe\u8def\uff0c10 \u5206\u949f<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">pytest<\/span>&nbsp;-m&nbsp;<span class=\"code-snippet__string\">\"schema or db or chain\"<\/span>&nbsp;-n&nbsp;<span class=\"code-snippet__number\">4<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u53d1\u7248\u524d \/ \u6bcf\u5468\uff1a\u5168\u91cf\uff0c\u5e76\u53d1\u7528\u4f8b\u5355\u72ec\u4e32\u884c\u8dd1\uff0c\u907f\u514d\u4e92\u76f8\u5e72\u6270<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">pytest<\/span>&nbsp;-m&nbsp;<span class=\"code-snippet__string\">\"not concurrency\"<\/span>&nbsp;-n&nbsp;<span class=\"code-snippet__number\">4<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__attribute\">pytest<\/span>&nbsp;-m concurrency &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# \u5e76\u53d1\u7528\u4f8b\u4e0d\u8981\u52a0 -n\uff0c\u4f1a\u81ea\u5df1\u6253\u81ea\u5df1<\/span><\/code><\/pre>\n<\/section>\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"576\">\n<p data-pm-slice=\"0 0 []\" style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 15px;color: rgb(255, 41, 65);font-weight: bold;\">\ud83d\udca1 \u5e76\u53d1\u7528\u4f8b\u522b\u7528 pytest-xdist \u5e76\u884c<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u662f\u6211\u8e29\u8fc7\u7684\u4e00\u4e2a\u8822\u5751\uff1a\u5e76\u53d1\u7528\u4f8b\u672c\u8eab\u5c31\u5728\u5f00 20 \u4e2a\u7ebf\u7a0b\uff0c\u4f60\u518d\u7528&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">-n 4<\/span><\/code><span leaf=\"\">&nbsp;\u8d77 4 \u4e2a\u8fdb\u7a0b\uff0c\u7b49\u4e8e 80 \u4e2a\u5e76\u53d1\u540c\u65f6\u6253\u540c\u4e00\u4e2a SKU\uff0c\u7ed3\u679c\u8c01\u4e5f\u8bf4\u4e0d\u6e05\u662f\u54ea\u4e2a\u7528\u4f8b\u9020\u6210\u7684\u5931\u8d25\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(51, 81, 63);font-size: 15px;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5e76\u53d1\u7528\u4f8b\u4e00\u5b9a\u8981\u5355\u72ec\u4e32\u884c\u6267\u884c\uff0c\u800c\u4e14\u5c3d\u91cf\u5b89\u6392\u5728\u6ca1\u4eba\u7528\u73af\u5883\u7684\u65f6\u6bb5\u3002<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">6.2 \u7528\u4f8b\u7f16\u5199\u6a21\u677f\uff1a\u4e03\u6b65\u8d70<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(122, 79, 214);font-weight: normal;\">\u6846\u67b6\u6709\u4e86\uff0c\u8fd8\u5f97\u6709\u89c4\u8303\uff0c\u4e0d\u7136\u6bcf\u4e2a\u4eba\u5199\u51fa\u6765\u7684\u7528\u4f8b\u7ed3\u6784\u4e94\u82b1\u516b\u95e8\u3002\u6211\u4eec\u7ec4\u7684\u89c4\u8303\u662f&#8221;<\/span><span textstyle=\"\" style=\"color: rgb(122, 79, 214);font-weight: bold;\">\u4e03\u6b65\u8d70<\/span><span textstyle=\"\" style=\"color: rgb(122, 79, 214);font-weight: normal;\">&#8220;\uff1a<\/span><\/span><\/p>\n<table style=\"width: 704px;border-collapse: collapse;font-size: 14px;background: rgb(255, 255, 255);\">\n<thead>\n<tr>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u6b65\u9aa4<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u505a\u4ec0\u4e48<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u5bf9\u5e94\u7ef4\u5ea6<\/span><\/span><\/section>\n<\/th>\n<th style=\"background: rgb(22, 33, 62);color: rgb(255, 255, 255);padding: 11px 12px;text-align: left;font-weight: 600;\">\n<section style=\"text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(214, 168, 65);\">\u80fd\u7701\u7565\u5417<\/span><\/span><\/section>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u9020\u6570\u636e \/ \u8bb0\u5f55\u57fa\u51c6\u503c<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u524d\u7f6e<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4e0d\u80fd\uff0c\u6ca1\u6709\u57fa\u51c6\u5c31\u65e0\u6cd5\u5224\u65ad\u53d8\u5316<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">2<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u8c03\u7528\u76ee\u6807\u63a5\u53e3<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6838\u5fc3<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4e0d\u80fd<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">3<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">Schema \u7ed3\u6784\u6821\u9a8c<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u7ef4\u5ea6\u4e00<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6838\u5fc3\u63a5\u53e3\u4e0d\u80fd\u7701<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">4<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u67e5\u5e93\u9a8c\u8bc1\u6570\u636e\u843d\u5730<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u7ef4\u5ea6\u4e8c<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5199\u64cd\u4f5c\u63a5\u53e3\u4e0d\u80fd\u7701<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">5<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u94fe\u8def\u4f20\u9012\u4e0e\u72b6\u6001\u6d41\u8f6c<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u7ef4\u5ea6\u4e09<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5355\u63a5\u53e3\u7528\u4f8b\u53ef\u7701<\/span><\/section>\n<\/td>\n<\/tr>\n<tr style=\"background: rgb(246, 248, 251);\">\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">6<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u5e76\u53d1 \/ \u5e42\u7b49\u9a8c\u8bc1<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u7ef4\u5ea6\u56db<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u53ea\u8bfb\u63a5\u53e3\u53ef\u7701<\/span><\/section>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">7<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6e05\u7406\uff08\u653e fixture teardown\uff09<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u6536\u5c3e<\/span><\/section>\n<\/td>\n<td style=\"padding: 10px 12px;border-bottom: 1px solid rgb(232, 235, 240);color: rgb(53, 64, 79);\">\n<section><span leaf=\"\">\u4e0d\u80fd\uff0c\u4f46\u8981\u5bb9\u9519<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd8\u6709\u4e2a\u5c0f\u89c4\u8303\u4f46\u5f88\u6709\u7528\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6bcf\u6761\u65ad\u8a00\u7684\u5931\u8d25\u4fe1\u606f\uff0c\u524d\u9762\u52a0\u7ef4\u5ea6\u6807\u7b7e<\/span><\/strong><span leaf=\"\">\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5c31\u662f\u524d\u9762\u4ee3\u7801\u91cc\u90a3\u4e9b&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">[\u7ef4\u5ea6\u4e00\u00b7\u7ed3\u6784]<\/span><\/code><span leaf=\"\">\u3001<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">[\u7ef4\u5ea6\u4e8c\u00b7\u6570\u636e]<\/span><\/code><span leaf=\"\">\u3002CI \u62a5\u544a\u51fa\u6765\uff0c\u626b\u4e00\u773c\u6807\u7b7e\u5c31\u77e5\u9053\u95ee\u9898\u51fa\u5728\u54ea\u4e00\u5c42\uff0c\u4e0d\u7528\u70b9\u8fdb\u53bb\u770b\u5806\u6808\u3002\u5f00\u53d1\u770b\u5230&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">[\u7ef4\u5ea6\u56db\u00b7\u5e76\u53d1]<\/span><\/code><span leaf=\"\">&nbsp;\u4e5f\u4f1a\u7acb\u523b\u610f\u8bc6\u5230\u8fd9\u662f\u7ade\u6001\u95ee\u9898\uff0c\u800c\u4e0d\u662f&#8221;\u4f60\u73af\u5883\u6709\u95ee\u9898\u5427&#8221;\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">6.3 \u6d4b\u8bd5\u6570\u636e\u7528 YAML \u7ba1\u7406<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u6d4b\u8bd5\u6570\u636e\u786c\u7f16\u7801\u5728 Python \u91cc\uff0c\u6539\u4e00\u4e2a\u91d1\u989d\u8981\u52a8\u4ee3\u7801\u3001\u8981\u8d70 code review\u3001\u8981\u91cd\u65b0\u63d0\u4ea4\u3002\u7528 YAML \u5206\u79bb\u51fa\u6765\uff0c\u4e1a\u52a1\u6d4b\u8bd5\u540c\u5b66\u81ea\u5df1\u5c31\u80fd\u7ef4\u62a4\u3002<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">test_data\/order_cases.yaml \u2014 \u4e0b\u5355\u573a\u666f\u6570\u636e<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"cs\"><code><span leaf=\"\"><span class=\"code-snippet__meta\"># \u4e0b\u5355\u63a5\u53e3\u53c2\u6570\u5316\u6570\u636e<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\"># \u5b57\u6bb5\u8bf4\u660e\uff1a<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\"># &nbsp; name &nbsp; &nbsp; \u7528\u4f8b\u540d\uff0c\u4f1a\u663e\u793a\u5728 pytest \u62a5\u544a\u91cc<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\"># &nbsp; payload &nbsp;\u8bf7\u6c42\u4f53<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\"># &nbsp; expect &nbsp; \u671f\u671b\u7684\u4e1a\u52a1\u7801\u548c\u5173\u952e\u5b57\u6bb5<\/span><\/span><\/code><code><span leaf=\"\">- name:&nbsp;<span class=\"code-snippet__string\">\"\u6b63\u5e38\u4e0b\u5355_\u5355\u4ef6\u5546\u54c1_\u65e0\u4f18\u60e0\u5238\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; payload:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; quantity:&nbsp;<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; coupon:&nbsp;<span class=\"code-snippet__literal\">null<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; expect:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; code:&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; status:&nbsp;<span class=\"code-snippet__string\">\"pending\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; discount:&nbsp;<span class=\"code-snippet__string\">\"0.00\"<\/span><\/span><\/code><code><span leaf=\"\">- name:&nbsp;<span class=\"code-snippet__string\">\"\u6b63\u5e38\u4e0b\u5355_\u6ee1\u51cf\u5238_\u521a\u597d\u8fbe\u5230\u95e8\u69db\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; payload:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; quantity:&nbsp;<span class=\"code-snippet__number\">2<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__meta\"># 2 \u00d7 99.90 = 199.80 \u2265 199 \u95e8\u69db<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; coupon:&nbsp;<span class=\"code-snippet__string\">\"THRESHOLD_199_MINUS_20\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; expect:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; code:&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; discount:&nbsp;<span class=\"code-snippet__string\">\"20.00\"<\/span><\/span><\/code><code><span leaf=\"\">- name:&nbsp;<span class=\"code-snippet__string\">\"\u5f02\u5e38_\u6ee1\u51cf\u5238_\u5dee\u4e00\u5206\u94b1\u4e0d\u5230\u95e8\u69db\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; payload:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; quantity:&nbsp;<span class=\"code-snippet__number\">1<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__meta\"># 99.90 &lt; 199\uff0c\u5238\u7528\u4e0d\u4e86<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; coupon:&nbsp;<span class=\"code-snippet__string\">\"THRESHOLD_199_MINUS_20\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; expect:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; code:&nbsp;<span class=\"code-snippet__number\">4005<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; message_contains:&nbsp;<span class=\"code-snippet__string\">\"\u672a\u8fbe\u5230\u4f7f\u7528\u95e8\u69db\"<\/span><\/span><\/code><code><span leaf=\"\">- name:&nbsp;<span class=\"code-snippet__string\">\"\u8fb9\u754c_\u6570\u91cf\u4e0a\u965099\u4ef6\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; payload:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; quantity:&nbsp;<span class=\"code-snippet__number\">99<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; coupon:&nbsp;<span class=\"code-snippet__literal\">null<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; expect:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; code:&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">- name:&nbsp;<span class=\"code-snippet__string\">\"\u5f02\u5e38_\u6570\u91cf\u8d85\u4e0a\u9650100\u4ef6\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; payload:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; quantity:&nbsp;<span class=\"code-snippet__number\">100<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; coupon:&nbsp;<span class=\"code-snippet__literal\">null<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; expect:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; code:&nbsp;<span class=\"code-snippet__number\">4002<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; message_contains:&nbsp;<span class=\"code-snippet__string\">\"\u5355\u6b21\u8d2d\u4e70\u6570\u91cf\"<\/span><\/span><\/code><code><span leaf=\"\">- name:&nbsp;<span class=\"code-snippet__string\">\"\u5f02\u5e38_\u6570\u91cf\u4e3a0\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; payload:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; quantity:&nbsp;<span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; coupon:&nbsp;<span class=\"code-snippet__literal\">null<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; expect:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; code:&nbsp;<span class=\"code-snippet__number\">4002<\/span><\/span><\/code><\/pre>\n<\/section>\n<section><span data-pm-slice=\"0 0 []\"><span data-pm-slice=\"0 0 []\"><span data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"color:rgba(0, 0, 0, 0.9);font-size:17px;font-family:&quot;mp-quote&quot;, &quot;PingFang SC&quot;, system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;line-height:1.6;letter-spacing:0.034em;font-style:normal;font-weight:normal;\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">test_order_param.py \u2014 \u8bfb YAML \u505a\u53c2\u6570\u5316<\/span><\/span><\/span><\/span><\/span><\/section>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;yaml<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">import<\/span>&nbsp;pytest<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">from<\/span>&nbsp;pathlib&nbsp;<span class=\"code-snippet__keyword\">import<\/span>&nbsp;Path<\/span><\/code><code><span leaf=\"\">DATA = yaml.safe_load(<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; (Path(__file__).parent \/&nbsp;<span class=\"code-snippet__string\">\"test_data\/order_cases.yaml\"<\/span>).read_text(<span class=\"code-snippet__string\">\"utf-8\"<\/span>)<\/span><\/code><code><span leaf=\"\">)<\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.mark.parametrize(<\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"case\"<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">, DATA, ids=[c[<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__string\">\"name\"<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">]&nbsp;<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__keyword\">for<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">&nbsp;c&nbsp;<\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\"><span class=\"code-snippet__keyword\">in<\/span><\/span><\/span><span class=\"code-snippet__meta\"><span class=\"code-snippet__params\">&nbsp;DATA]<\/span><\/span><span class=\"code-snippet__meta\">)<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_order_scenarios<\/span>(<span class=\"code-snippet__params\">api_session, base_url, ready_sku,&nbsp;<\/span><span class=\"code-snippet__params\"><span class=\"code-snippet__keyword\">case<\/span><\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"\"\"\u4e00\u4efd YAML \u9a71\u52a8 6 \u4e2a\u573a\u666f\uff0c\u52a0\u573a\u666f\u4e0d\u7528\u6539\u4ee3\u7801\u3002\"\"\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; payload = {<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"user_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"U100000001\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"address_id\"<\/span>:&nbsp;<span class=\"code-snippet__string\">\"A20001\"<\/span>,<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">\"items\"<\/span>: [{<span class=\"code-snippet__string\">\"sku_id\"<\/span>: ready_sku,&nbsp;<span class=\"code-snippet__string\">\"quantity\"<\/span>:&nbsp;<span class=\"code-snippet__keyword\">case<\/span>[<span class=\"code-snippet__string\">\"payload\"<\/span>][<span class=\"code-snippet__string\">\"quantity\"<\/span>]}],<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; }<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__keyword\">case<\/span>[<span class=\"code-snippet__string\">\"payload\"<\/span>].get(<span class=\"code-snippet__string\">\"coupon\"<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; payload[<span class=\"code-snippet__string\">\"coupon_id\"<\/span>] = resolve_coupon(<span class=\"code-snippet__keyword\">case<\/span>[<span class=\"code-snippet__string\">\"payload\"<\/span>][<span class=\"code-snippet__string\">\"coupon\"<\/span>])<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; resp = api_session.post(<span class=\"code-snippet__string\">f\"<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{base_url}<\/span><\/span><span class=\"code-snippet__string\">\/api\/v1\/orders\"<\/span>, json=payload)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; body = resp.json()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;body[<span class=\"code-snippet__string\">\"code\"<\/span>] ==&nbsp;<span class=\"code-snippet__keyword\">case<\/span>[<span class=\"code-snippet__string\">\"expect\"<\/span>][<span class=\"code-snippet__string\">\"code\"<\/span>], (<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u573a\u666f\u3010<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">case<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'name'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\u3011\u4e1a\u52a1\u7801\u4e0d\u7b26\uff1a\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u671f\u671b&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__keyword\">case<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'expect'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">][<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'code'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\u5b9e\u9645&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{body[<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'code'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">]}<\/span><\/span><span class=\"code-snippet__string\">\uff0c\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__string\">f\"\u63d0\u793a\uff1a<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{body.get(<\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\"><span class=\"code-snippet__string\">'message'<\/span><\/span><\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">)}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; )<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">if<\/span>&nbsp;<span class=\"code-snippet__string\">\"message_contains\"<\/span>&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;<span class=\"code-snippet__keyword\">case<\/span>[<span class=\"code-snippet__string\">\"expect\"<\/span>]:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;<span class=\"code-snippet__keyword\">case<\/span>[<span class=\"code-snippet__string\">\"expect\"<\/span>][<span class=\"code-snippet__string\">\"message_contains\"<\/span>]&nbsp;<span class=\"code-snippet__keyword\">in<\/span>&nbsp;body.get(<span class=\"code-snippet__string\">\"message\"<\/span>,&nbsp;<span class=\"code-snippet__string\">\"\"<\/span>)<\/span><\/code><\/pre>\n<\/section>\n<section style=\"text-align: left;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 12px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\">\u8fd9\u4e48\u505a\u4e4b\u540e\uff0c\u6211\u4eec\u7ec4\u65b0\u589e\u4e00\u4e2a\u4e0b\u5355\u573a\u666f\u7684\u6210\u672c\u4ece&#8221;\u6539\u4ee3\u7801 + \u63d0 PR + \u7b49 review&#8221;\u53d8\u6210\u4e86&#8221;\u5728 YAML \u91cc\u52a0 6 \u884c&#8221;\u3002\u4e1a\u52a1\u6d4b\u8bd5\u540c\u5b66\u81ea\u5df1\u5c31\u80fd\u52a0\uff0c\u4e0d\u7528\u6392\u961f\u7b49\u5f00\u53d1\u8d44\u6e90\u3002<\/span><\/span><\/span><\/span><\/section>\n<section><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 19px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 700;letter-spacing: normal;orphans: 2;text-align: center;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><br  \/><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"color: rgb(44, 44, 58);font-family: sans-serif;font-size: 19px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 700;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;float: none;display: inline !important;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(123, 12, 0);\">\u56db\u7ef4\u6821\u9a8c\u7684\u56db\u5468\u843d\u5730\u8def\u7ebf<\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\"><span data-pm-slice=\"0 0 []\"><span leaf=\"\" style=\"color: rgba(0, 0, 0, 0.9);font-size: 17px;font-family: mp-quote, &quot;PingFang SC&quot;, system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;line-height: 1.6;letter-spacing: 0.034em;font-style: normal;font-weight: normal;\"><span textstyle=\"\" style=\"font-size: 12px;color: rgb(136, 136, 136);font-weight: bold;font-style: italic;\">\u522b\u60f3\u4e00\u6b65\u5230\u4f4d\uff0c\u6309\u5468\u63a8\u8fdb\u624d\u843d\u5f97\u4e0b\u53bb<\/span><\/span><\/span><\/section>\n<section style=\"text-align: center;\" nodeleaf=\"\">\n<figure class=\"wx-qr-wrap\"><img decoding=\"async\" class=\"rich_pages wxw-img\" data-ratio=\"0.32592592592592595\" data-s=\"300,640\" data-type=\"png\" data-w=\"1080\" type=\"block\" data-imgfileid=\"100000659\" data-aistatus=\"1\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BWmfcibGhS1JKOnsiabL5C8h2Lwk8FhcLdWXEKHdqzNxR0W9bicvPwjGmUvHxaOmeCuYA9NbIAIV9AibeuREUdIVBsKq5Cua6F15ctHN71LOOq0\/640?wx_fmt=png&#038;from=appmsg\" \/><figcaption class=\"wx-qr-tip\"><img decoding=\"async\" src=\"https:\/\/www.deartester.com\/wp-content\/uploads\/2026\/09\/wechat-qr.jpg\" alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\u4e8c\u7ef4\u7801\" loading=\"lazy\"><span>\u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587<\/span><\/figcaption><\/figure>\n<\/section>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<h2 style=\"font-size: 21px;color: rgb(15, 52, 96);margin: 44px 0px 18px;padding-left: 14px;border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(255, 167, 38);font-weight: 700;margin-right: 8px;\"><span leaf=\"\">07<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u907f\u5751\u6307\u5357\uff1a6 \u4e2a\u6211\u4eb2\u81ea\u8e29\u8fc7\u7684\u5751<\/span><\/span><\/h2>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">\u5751 1\uff1a\u6e05\u7406\u4ee3\u7801\u6ca1\u8dd1\uff0c\u810f\u6570\u636e\u6c61\u67d3\u4e0b\u4e00\u6761\u7528\u4f8b<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u7528\u4f8b\u4e2d\u9014\u65ad\u8a00\u5931\u8d25\uff0c\u540e\u9762\u7684\u6e05\u7406\u4ee3\u7801\u76f4\u63a5\u88ab\u8df3\u8fc7\uff0c\u810f\u6570\u636e\u7559\u5728\u5e93\u91cc\u3002\u4e0b\u4e00\u6761\u7528\u4f8b\u8dd1\u8d77\u6765\u53d1\u73b0\u5e93\u5b58\u4e0d\u5bf9\u3001\u8ba2\u5355\u72b6\u6001\u4e0d\u5bf9\uff0c\u4e00\u7247\u98d8\u7ea2\uff0c\u4f46\u6839\u56e0\u5728\u4e0a\u4e00\u6761\u7528\u4f8b\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u89e3\u6cd5\u6709\u4e24\u6761\uff1a<\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u5176\u4e00<\/span>\uff0c\u6e05\u7406\u903b\u8f91\u5fc5\u987b\u5199\u5728 fixture \u7684&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">yield<\/span><\/code><span leaf=\"\">&nbsp;\u4e4b\u540e\uff0c\u800c\u4e0d\u662f\u7528\u4f8b\u51fd\u6570\u7684\u672b\u5c3e\u3002pytest \u4fdd\u8bc1 yield \u540e\u7684\u4ee3\u7801\u5728\u7528\u4f8b\u5931\u8d25\u65f6\u7167\u6837\u6267\u884c\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u5176\u4e8c<\/span>\uff0c\u6e05\u7406\u4ee3\u7801\u672c\u8eab\u8981\u7528 try-except \u5305\u4f4f\u3002\u6e05\u7406\u5931\u8d25\u662f\u8fd0\u7ef4\u95ee\u9898\uff0c\u4e0d\u8be5\u628a\u7528\u4f8b\u7ed3\u8bba\u5e26\u504f\u2014\u2014\u4f60\u603b\u4e0d\u5e0c\u671b\u770b\u5230&#8221;\u529f\u80fd\u662f\u5bf9\u7684\uff0c\u4f46\u56e0\u4e3a\u6e05\u7406\u5931\u8d25\u6240\u4ee5\u62a5\u7ea2&#8221;\u3002<\/span><\/p>\n<p><span leaf=\"\"><span textstyle=\"\" style=\"font-size: 16px;background-color: rgb(0, 213, 255);\">\u5bf9\u6bd4\uff1a\u9519\u8bef\u5199\u6cd5 vs \u6b63\u786e\u5199\u6cd5<\/span><\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u274c \u9519\u8bef\uff1a\u65ad\u8a00\u5931\u8d25\u540e\uff0c\u6e05\u7406\u4ee3\u7801\u6c38\u8fdc\u6267\u884c\u4e0d\u5230<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">test_bad<\/span>(<span class=\"code-snippet__params\">api_session<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; sku = create_sku()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; resp = api_session.post(url, json=payload)<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">assert<\/span>&nbsp;resp.json()[<span class=\"code-snippet__string\">\"code\"<\/span>] ==&nbsp;<span class=\"code-snippet__number\">0<\/span>&nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u2190 \u8fd9\u91cc\u6302\u4e86<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; cleanup(sku) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"code-snippet__comment\"># \u2190 \u6c38\u8fdc\u8dd1\u4e0d\u5230<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__comment\"># \u2705 \u6b63\u786e\uff1a\u6e05\u7406\u653e fixture teardown\uff0c\u4e14\u505a\u5bb9\u9519<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__meta\">@pytest.fixture<\/span><\/span><\/code><code><span leaf=\"\"><span class=\"code-snippet__keyword\">def<\/span>&nbsp;<span class=\"code-snippet__title\">sku<\/span>(<span class=\"code-snippet__params\">db_write<\/span>):<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; s = create_sku()<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">yield<\/span>&nbsp;s<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">try<\/span>:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__comment\"># \u7528\u8f6f\u5220\u9664\u800c\u4e0d\u662f\u7269\u7406 DELETE\uff0cWHERE \u5199\u9519\u8fd8\u6709\u6551<\/span><\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp; db_write(<span class=\"code-snippet__string\">\"UPDATE inventory SET is_deleted=1 WHERE sku_id=%s\"<\/span>, (s,))<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp;&nbsp;<span class=\"code-snippet__keyword\">except<\/span>&nbsp;Exception&nbsp;<span class=\"code-snippet__keyword\">as<\/span>&nbsp;e:<\/span><\/code><code><span leaf=\"\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class=\"code-snippet__built_in\">print<\/span>(<span class=\"code-snippet__string\">f\"[teardown] \u6e05\u7406\u5931\u8d25\u4f46\u4e0d\u5f71\u54cd\u7528\u4f8b\u7ed3\u8bba:&nbsp;<\/span><span class=\"code-snippet__string\"><span class=\"code-snippet__subst\">{e}<\/span><\/span><span class=\"code-snippet__string\">\"<\/span>)<\/span><\/code><\/pre>\n<\/section>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">\u5751 2\uff1a\u5e76\u53d1\u6570\u592a\u5c0f\uff0c\u7b49\u4e8e\u6ca1\u6d4b<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5f00 2-3 \u4e2a\u7ebf\u7a0b\u5c31\u53eb\u5e76\u53d1\u6d4b\u8bd5\uff1f\u6211\u89c1\u8fc7\u6709\u4eba\u7684&#8221;\u5e76\u53d1\u7528\u4f8b&#8221;\u7528&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">for<\/span><\/code><span leaf=\"\">&nbsp;\u5faa\u73af\u53d1 3 \u6b21\u8bf7\u6c42\u2014\u2014\u90a3\u662f\u5faa\u73af\uff0c\u4e0d\u662f\u5e76\u53d1\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5e76\u53d1\u5ea6\u4e0d\u591f\uff0c\u7ade\u6001\u7a97\u53e3\u6253\u4e0d\u5f00\uff0c\u7528\u4f8b\u6c38\u8fdc\u662f\u7eff\u7684\uff0c\u7ed9\u4eba\u4e00\u79cd\u865a\u5047\u7684\u5b89\u5168\u611f\u3002\u666e\u901a\u63a5\u53e3\u81f3\u5c11 10-20\uff0c\u79d2\u6740\u573a\u666f 50 \u8d77\u6b65\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd8\u6709\u4e2a\u7ec6\u8282\u5bb9\u6613\u5ffd\u7565\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5e76\u53d1\u5ea6\u4e0d\u53ea\u770b\u7ebf\u7a0b\u6570\uff0c\u8fd8\u8981\u770b\u8bf7\u6c42\u7684\u5b9e\u9645\u53d1\u51fa\u65f6\u95f4\u662f\u5426\u96c6\u4e2d<\/span><\/strong><span leaf=\"\">\u3002\u5982\u679c\u63a5\u53e3\u54cd\u5e94\u8981 1 \u79d2\uff0c\u4f60\u5f00 10 \u4e2a\u7ebf\u7a0b\uff0c\u5b9e\u9645\u4e0a\u5c31\u662f\u6bcf\u79d2 10 \u4e2a\u8bf7\u6c42\u6253\u8fdb\u53bb\uff0c\u7ade\u4e89\u7a97\u53e3\u5f88\u5bbd\u677e\u3002\u53ef\u4ee5\u5728\u6bcf\u4e2a\u7ebf\u7a0b\u91cc\u8bb0\u5f55&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">time.time()<\/span><\/code><span leaf=\"\">\uff0c\u8dd1\u5b8c\u6253\u5370\u4e00\u4e0b\u53d1\u51fa\u65f6\u95f4\u7684\u65b9\u5dee\uff0c\u5982\u679c\u5206\u6563\u5728\u51e0\u79d2\u5185\uff0c\u90a3\u5e76\u53d1\u662f\u5047\u7684\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">\u5751 3\uff1aToken \u786c\u7f16\u7801\uff0c\u8dd1\u5230\u4e00\u534a\u5168\u6302<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u4e2a\u5751\u51e0\u4e4e\u6bcf\u4e2a\u56e2\u961f\u90fd\u683d\u8fc7\u3002Token \u76f4\u63a5\u5199\u5728\u914d\u7f6e\u6587\u4ef6\u91cc\uff0c\u4e24\u5c0f\u65f6\u540e\u8fc7\u671f\uff0c\u6574\u6279\u7528\u4f8b 401\u3002\u66f4\u7cdf\u7684\u662f\u6709\u4eba\u770b\u5230\u5168\u7ea2\uff0c\u5934\u4e00\u4e2a\u53cd\u5e94\u662f&#8221;\u73af\u5883\u6302\u4e86&#8221;\uff0c\u8dd1\u53bb\u627e\u8fd0\u7ef4\uff0c\u6298\u817e\u534a\u5c0f\u65f6\u624d\u53d1\u73b0\u662f Token \u7684\u4e8b\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u89e3\u6cd5\u5c31\u662f\u524d\u9762 conftest \u91cc\u90a3\u4e2a&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">TokenManager<\/span><\/code><span leaf=\"\">\uff1a\u4ece\u73af\u5883\u53d8\u91cf\u8bfb\u8d26\u53f7\u5bc6\u7801\uff0c\u81ea\u52a8\u767b\u5f55\uff0c\u5269\u4f59\u6709\u6548\u671f\u4e0d\u8db3 5 \u5206\u949f\u5c31\u63d0\u524d\u7eed\u3002\u7528\u4f8b\u4ee3\u7801\u5b8c\u5168\u611f\u77e5\u4e0d\u5230\u8fd9\u4e00\u5c42\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5982\u679c\u63a5\u53e3\u652f\u6301 OAuth2 \u7684&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">refresh_token<\/span><\/code><span leaf=\"\">\uff0c\u90a3\u5c31\u66f4\u7701\u4e8b\uff0c\u76f4\u63a5\u7528 refresh \u6362\u65b0\u7684\uff0c\u8fde\u91cd\u65b0\u767b\u5f55\u90fd\u4e0d\u7528\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">\u5751 4\uff1a\u6240\u6709\u7528\u4f8b\u5171\u7528\u4e00\u4e2a\u6d4b\u8bd5\u8d26\u53f7<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5168\u7ec4\u5171\u7528&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">test001<\/span><\/code><span leaf=\"\">&nbsp;\u8fd9\u4e2a\u8d26\u53f7\uff0c\u5355\u7ebf\u7a0b\u8dd1\u6ca1\u95ee\u9898\uff0c\u4e00\u5f00\u5e76\u884c\u5c31\u51fa\u4e8b\uff1a\u7528\u4f8b A \u628a\u8fd9\u4e2a\u8d26\u53f7\u7684\u8ba2\u5355\u5168\u53d6\u6d88\u4e86\uff0c\u7528\u4f8b B \u6b63\u5728\u67e5\u90a3\u7b14\u8ba2\u5355\uff0c\u76f4\u63a5\u67e5\u4e0d\u5230\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u89e3\u6cd5\u662f\u8ba9\u6570\u636e\u5929\u7136\u9694\u79bb<\/span><\/strong><span leaf=\"\">\uff0c\u522b\u6307\u671b\u6e05\u7406\u903b\u8f91\uff1a<\/span><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">SKU\u3001\u4f18\u60e0\u5238\u3001\u8ba2\u5355\u8fd9\u7c7b\u53ef\u9020\u7684\u6570\u636e\uff0c\u6bcf\u4e2a\u7528\u4f8b\u7528 UUID \u9020\u72ec\u7acb\u7684\u4e00\u4efd<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u7528\u6237\u8d26\u53f7\u5982\u679c\u4e0d\u80fd\u52a8\u6001\u9020\uff0c\u5c31\u6309\u7528\u4f8b\u6587\u4ef6\u5206\u914d\u56fa\u5b9a\u8d26\u53f7\u6c60\uff0c\u907f\u514d\u8de8\u6587\u4ef6\u62a2<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u7528\u4f8b\u547d\u540d\u548c\u6570\u636e\u524d\u7f00\u5bf9\u9f50\uff0c\u51fa\u95ee\u9898\u65f6\u4e00\u773c\u80fd\u770b\u51fa\u662f\u54ea\u6761\u7528\u4f8b\u7559\u4e0b\u7684\u810f\u6570\u636e<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u53e6\u5916\u5fc5\u987b\u5f3a\u8c03\u4e00\u53e5\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6d4b\u8bd5\u73af\u5883\u548c\u751f\u4ea7\u73af\u5883\u7684\u6570\u636e\u5e93\u8981\u5f7b\u5e95\u9694\u79bb<\/span><\/strong><span leaf=\"\">\u3002\u6211\u77e5\u9053\u6709\u56e2\u961f\u4e3a\u4e86\u7701\u4e8b\u5728\u751f\u4ea7\u5e93\u8dd1\u53ea\u8bfb\u67e5\u8be2\uff0c\u751a\u81f3\u8dd1\u8fc7\u5199\u64cd\u4f5c\u3002\u8fd9\u4e8b\u4e00\u65e6\u51fa\u95ee\u9898\uff0c\u89e6\u53d1\u7684\u53ef\u80fd\u662f\u771f\u5b9e\u7684\u77ed\u4fe1\u901a\u77e5\u3001\u771f\u5b9e\u7684\u652f\u4ed8\u56de\u8c03\u3001\u771f\u5b9e\u7684\u8d44\u91d1\u6d41\u52a8\u3002\u522b\u5192\u8fd9\u4e2a\u9669\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">\u5751 5\uff1a\u65ad\u8a00\u592a\u5bbd\uff0c\u8ddf\u6ca1\u65ad\u8a00\u4e00\u6837<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">assert resp.json()[\"code\"] == 0<\/span><\/code><span leaf=\"\">&nbsp;\u8fd9\u4e00\u884c\uff0c\u662f\u6211\u89c1\u8fc7\u88ab\u6ee5\u7528\u5f97\u8f83\u591a\u7684\u65ad\u8a00\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u63a5\u53e3\u8fd4\u56de&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">code=0<\/span><\/code><span leaf=\"\">\uff0c\u4f46&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">message<\/span><\/code><span leaf=\"\">&nbsp;\u91cc\u5199\u7740&#8221;\u90e8\u5206\u5546\u54c1\u5df2\u4e0b\u67b6&#8221;\uff0c<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">data<\/span><\/code><span leaf=\"\">&nbsp;\u662f\u4e2a\u7a7a\u5bf9\u8c61\u2014\u2014\u8fd9\u4e2a\u65ad\u8a00\u7167\u6837\u7eff\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u65ad\u8a00\u8981\u5206\u5c42\uff1a<\/span><\/strong><\/p>\n<ul style=\"padding-left: 22px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" class=\"list-paddingleft-1\">\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u6210\u529f\u573a\u666f\uff1a\u4e1a\u52a1\u7801 + Schema \u7ed3\u6784 + \u5173\u952e\u5b57\u6bb5\u6709\u503c + \u5b57\u6bb5\u95f4\u52fe\u7a3d\u5173\u7cfb<\/span><\/section>\n<\/li>\n<li style=\"margin: 8px 0px;\">\n<section><span leaf=\"\">\u5931\u8d25\u573a\u666f\uff1a\u4e1a\u52a1\u7801\u8981\u7cbe\u786e\uff084004 \u5c31\u662f 4004\uff0c\u4e0d\u80fd\u63a5\u53d7 500\uff09+ message \u5185\u5bb9\u8981\u5408\u7406 + \u4e0d\u80fd\u6709\u526f\u4f5c\u7528\u6570\u636e\u4ea7\u751f<\/span><\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u4f46\u4e5f\u522b\u8d70\u53e6\u4e00\u4e2a\u6781\u7aef\u3002\u6211\u89c1\u8fc7\u6709\u4eba\u7ed9\u6bcf\u4e2a\u5b57\u6bb5\u5199\u4e00\u6761 assert\uff0c\u4e00\u4e2a\u7528\u4f8b 40 \u884c\u65ad\u8a00\uff0c\u5931\u8d25\u65f6\u62a5\u544a\u91cc\u5168\u662f\u566a\u97f3\u3002<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6838\u5fc3\u4e1a\u52a1\u5b57\u6bb5\uff08\u8ba2\u5355\u53f7\u3001\u91d1\u989d\u3001\u72b6\u6001\uff09\u7cbe\u786e\u65ad\u8a00\uff0c\u8f85\u52a9\u5b57\u6bb5\u4ea4\u7ed9 Schema \u6574\u4f53\u515c\u4f4f<\/span><\/strong><span leaf=\"\">\uff0c\u8fd9\u4e2a\u6bd4\u4f8b\u6bd4\u8f83\u8212\u670d\u3002<\/span><\/p>\n<h3 style=\"font-size: 17px;color: rgb(22, 33, 62);margin: 28px 0px 12px;padding-left: 10px;border-left: 3px solid rgb(255, 167, 38);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\"><span textstyle=\"\" style=\"color: rgb(64, 118, 0);\">\u5751 6\uff1a\u628a&#8221;\u63a5\u53e3\u6d4b\u8bd5&#8221;\u548c&#8221;\u6d4b\u63a5\u53e3&#8221;\u641e\u6df7\u4e86<\/span><\/span><\/h3>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u4e2a\u5751\u6bd4\u8f83\u9690\u853d\uff0c\u4f46\u6211\u89c9\u5f97\u662f\u5371\u5bb3\u8f83\u5927\u7684\u4e00\u4e2a\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u5f88\u591a\u540c\u5b66\u5199\u63a5\u53e3\u6d4b\u8bd5\uff0c\u5199\u7740\u5199\u7740\u5c31\u53d8\u6210\u4e86&#8221;\u628a\u63a5\u53e3\u6587\u6863\u7ffb\u8bd1\u6210\u4ee3\u7801&#8221;\u2014\u2014\u6587\u6863\u8bf4\u8fd4\u56de order_id\uff0c\u6211\u5c31\u65ad\u8a00\u6709 order_id\uff1b\u6587\u6863\u8bf4 code \u4e3a 0\uff0c\u6211\u5c31\u65ad\u8a00 code \u4e3a 0\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd9\u4e0d\u53eb\u6d4b\u8bd5\uff0c\u8fd9\u53eb\u590d\u8ff0\u3002<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u63a5\u53e3\u6587\u6863\u672c\u8eab\u53ef\u80fd\u5c31\u662f\u9519\u7684<\/span><\/strong><span leaf=\"\">\uff0c\u4f60\u7167\u7740\u5b83\u5199\u7528\u4f8b\uff0c\u53ea\u662f\u5728\u9a8c\u8bc1&#8221;\u5b9e\u73b0\u548c\u6587\u6863\u4e00\u81f4&#8221;\uff0c\u800c\u4e0d\u662f\u5728\u9a8c\u8bc1&#8221;\u7cfb\u7edf\u884c\u4e3a\u6b63\u786e&#8221;\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u56db\u7ef4\u6846\u67b6\u91cc\uff0c\u7ef4\u5ea6\u4e8c\uff08\u67e5\u5e93\uff09\u3001\u7ef4\u5ea6\u4e09\uff08\u94fe\u8def\uff09\u3001\u7ef4\u5ea6\u56db\uff08\u5e76\u53d1\uff09\u4e4b\u6240\u4ee5\u6709\u4ef7\u503c\uff0c\u6b63\u662f\u56e0\u4e3a\u5b83\u4eec\u8df3\u51fa\u4e86\u63a5\u53e3\u6587\u6863\u7684\u6846\u2014\u2014\u5b83\u4eec\u9a8c\u8bc1\u7684\u662f<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u4e1a\u52a1\u4e8b\u5b9e<\/span><\/strong><span leaf=\"\">\uff0c\u800c\u4e0d\u662f<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6587\u6863\u63cf\u8ff0<\/span><\/strong><span leaf=\"\">\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u524d\u9762\u5b9e\u6218\u6848\u4f8b\u91cc\u7684 Bug<a class=\"wx_topic_link\" topic-id=\"msifz1hj-f3xw2s\" style=\"color: #576B95 !important;\" data-topic=\"1\" data-recommend=\"\">#1<\/a>\uff08\u91d1\u989d\u52fe\u7a3d\uff09\uff0c\u63a5\u53e3\u6587\u6863\u91cc\u538b\u6839\u6ca1\u5199&#8221;\u4e09\u4e2a\u91d1\u989d\u5b57\u6bb5\u4e4b\u95f4\u8981\u6ee1\u8db3\u4ec0\u4e48\u5173\u7cfb&#8221;\u3002\u662f\u6211\u4eec\u81ea\u5df1\u4ece\u4e1a\u52a1\u5e38\u8bc6\u63a8\u51fa\u6765\u7684\u3002\u8fd9\u79cd\u65ad\u8a00\uff0c\u624d\u662f\u6d4b\u8bd5\u7684\u4ef7\u503c\u6240\u5728\u3002<\/span><\/p>\n<hr style=\"border-style: solid;border-width: 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);\"  \/>\n<h2 style=\"font-size: 21px;color: rgb(15, 52, 96);margin: 44px 0px 18px;padding-left: 14px;border-left: 5px solid rgb(79, 195, 247);line-height: 1.4;font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\" data-pm-slice=\"0 0 []\"><span style=\"color: rgb(255, 167, 38);font-weight: 700;margin-right: 8px;\"><span leaf=\"\">08<\/span><\/span><span leaf=\"\"><span textstyle=\"\" style=\"font-weight: bold;\">\u884c\u52a8\u6e05\u5355\uff1a\u4eca\u5929\u4e0b\u5348\u5c31\u80fd\u52a8\u624b\u7684 5 \u4ef6\u4e8b<\/span><\/span><\/h2>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8bb2\u8fd9\u4e48\u591a\uff0c\u4e0d\u5982\u4f60\u73b0\u5728\u6253\u5f00 IDE \u6539\u4e00\u884c\u4ee3\u7801\u3002\u4e0b\u9762 5 \u6761\u6309\u96be\u5ea6\u6392\u8fc7\u5e8f\uff0c\u4ece\u6295\u5165\u5c0f\u89c1\u6548\u5feb\u7684\u5f00\u59cb\u3002<\/span><\/p>\n<ol style=\"padding-left: 22px;color: rgb(51, 51, 51);\" class=\"list-paddingleft-1\">\n<li style=\"margin: 10px 0px;color: rgb(74, 58, 37);\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u7ed9\u4e00\u4e2a\u6838\u5fc3\u63a5\u53e3\u5199 Schema\uff08\u534a\u5c0f\u65f6\uff09<\/span><\/strong><br \/>\n<section><span leaf=\"\"><br  \/><\/span><\/p>\n<section><span leaf=\"\">\u4ece\u4f60\u4eec\u56e2\u961f\u63a5\u53e3\u6587\u6863\u91cc\u6311\u4e00\u4e2a\u6d89\u53ca\u94b1\u6216\u5e93\u5b58\u7684\u63a5\u53e3\uff0c\u7528&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">jsonschema<\/span><\/code><span leaf=\"\">&nbsp;\u5199\u4e00\u4efd\u54cd\u5e94\u7ed3\u6784\u5b9a\u4e49\uff0c\u585e\u8fdb\u73b0\u6709\u7528\u4f8b\u3002\u5199\u4e00\u6b21\uff0c\u540e\u9762\u6240\u6709\u76f8\u5173\u7528\u4f8b\u90fd\u80fd\u590d\u7528\u3002\u505a\u5b8c\u4f60\u5927\u6982\u7387\u4f1a\u53d1\u73b0\uff1a\u67d0\u4e2a\u5b57\u6bb5\u7684\u7c7b\u578b\u548c\u6587\u6863\u5199\u7684\u4e0d\u4e00\u6837\u3002<\/span><\/section>\n<\/section>\n<\/li>\n<li style=\"margin: 10px 0px;color: rgb(74, 58, 37);\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u7ed9\u4e00\u6761\u5199\u5165\u7c7b\u7528\u4f8b\u52a0\u4e0a\u67e5\u5e93\u65ad\u8a00\uff0820 \u5206\u949f\uff09<\/span><\/strong><br \/>\n<section><span leaf=\"\"><br  \/><\/span><\/p>\n<section><span leaf=\"\">\u627e\u4e00\u6761\u73b0\u6709\u7684\u4e0b\u5355\/\u63d0\u4ea4\/\u4fdd\u5b58\u7c7b\u7528\u4f8b\uff0c\u5728\u8bf7\u6c42\u540e\u9762\u52a0\u4e00\u884c&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">query_one<\/span><\/code><span leaf=\"\">\uff0c\u9a8c\u8bc1\u6570\u636e\u771f\u7684\u843d\u5e93\u4e86\u3002\u987a\u624b\u628a\u5173\u8054\u8868\u4e5f\u67e5\u4e00\u4e0b\u3002\u8fd9\u4e00\u6b65\u7684\u6295\u5165\u4ea7\u51fa\u6bd4\u5728\u6211\u770b\u6765\u662f\u5168\u7bc7\u91cc\u8f83\u9ad8\u7684\u3002<\/span><\/section>\n<\/section>\n<\/li>\n<li style=\"margin: 10px 0px;color: rgb(74, 58, 37);\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u4e32\u4e00\u6761\u5b8c\u6574\u94fe\u8def\u7528\u4f8b\uff08\u534a\u5929\uff09<\/span><\/strong><br \/>\n<section><span leaf=\"\"><br  \/><\/span><\/p>\n<section><span leaf=\"\">\u4e0b\u5355 \u2192 \u652f\u4ed8 \u2192 \u67e5\u8be2\u8be6\u60c5\uff0c\u4e09\u4e2a\u63a5\u53e3\u4e32\u8d77\u6765\uff0c\u9a8c\u8bc1\u8ba2\u5355\u53f7\u548c\u91d1\u989d\u5168\u7a0b\u4e00\u81f4\u3002\u8fd9\u6761\u7528\u4f8b\u80fd\u53d1\u73b0\u5355\u63a5\u53e3\u6d4b\u8bd5\u6c38\u8fdc\u53d1\u73b0\u4e0d\u4e86\u7684\u95ee\u9898\uff0c\u8dd1\u4e00\u6b21\u4f60\u5c31\u77e5\u9053\u503c\u4e0d\u503c\u3002<\/span><\/section>\n<\/section>\n<\/li>\n<li style=\"margin: 10px 0px;color: rgb(74, 58, 37);\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u8dd1\u4e00\u6b21 20 \u5e76\u53d1\u7684\u4e0b\u5355\u6d4b\u8bd5\uff081 \u5c0f\u65f6\uff09<\/span><\/strong><br \/>\n<section><span leaf=\"\"><br  \/><\/span><\/p>\n<section><span leaf=\"\">\u5148\u7528 SQL \u628a\u5e93\u5b58\u7cbe\u786e\u8bbe\u6210 5\uff0c\u518d\u7528&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">ThreadPoolExecutor<\/span><\/code><span leaf=\"\">&nbsp;\u5f00 20 \u4e2a\u7ebf\u7a0b\u540c\u65f6\u4e0b\u5355\uff0c\u65ad\u8a00\u6210\u529f\u6570\u6070\u597d\u662f 5\u3002\u5982\u679c\u6d4b\u51fa\u8d85\u5356\uff0c\u606d\u559c\uff0c\u4f60\u521a\u521a\u62e6\u4e0b\u4e86\u4e00\u4e2a\u672c\u6765\u4f1a\u5728\u5927\u4fc3\u5f53\u5929\u7206\u70b8\u7684 bug\u3002<\/span><\/section>\n<\/section>\n<\/li>\n<li style=\"margin: 10px 0px;color: rgb(74, 58, 37);\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u628a\u56db\u7ef4\u6821\u9a8c\u642c\u8fdb conftest.py\uff081 \u5929\uff09<\/span><\/strong><br \/>\n<section><span leaf=\"\"><br  \/><\/span><\/p>\n<section><span leaf=\"\">\u7ed3\u6784\u65ad\u8a00\u3001\u4e1a\u52a1\u7801\u65ad\u8a00\u3001\u6570\u636e\u5e93\u5de5\u5177\u3001Token \u7ba1\u7406\uff0c\u5168\u90e8\u6536\u8fdb&nbsp;<\/span><code style=\"background: rgb(242, 244, 248);color: rgb(192, 57, 43);padding: 1px 6px;border-radius: 4px;font-family: Consolas, Monaco, &quot;Courier New&quot;, monospace;font-size: 13.5px;\"><span leaf=\"\">conftest.py<\/span><\/code><span leaf=\"\">\u3002\u4ece\u8fd9\u5929\u8d77\uff0c\u65b0\u7528\u4f8b\u4e00\u5f8b\u6309\u56db\u7ef4\u5199\uff0c\u8001\u7528\u4f8b\u6bcf\u6b21\u6539\u5230\u7684\u65f6\u5019\u987a\u624b\u5347\u7ea7\u3002<\/span><\/section>\n<\/section>\n<\/li>\n<\/ol>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u6211\u7684\u5efa\u8bae\u662f\u6309\u987a\u5e8f\u505a\uff0c\u522b\u540c\u65f6\u94fa\u5f00\u3002<\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u524d\u4e24\u6761\u662f\u5730\u57fa\uff0c\u6295\u5165\u5c0f\u3001\u89c1\u6548\u5feb\uff0c\u505a\u5b8c\u56e2\u961f\u80fd\u7acb\u523b\u770b\u5230&#8221;\u54e6\u539f\u6765\u771f\u80fd\u6d4b\u51fa\u95ee\u9898&#8221;\uff0c\u540e\u9762\u63a8\u8d77\u6765\u963b\u529b\u5c31\u5c0f\u5f88\u591a\u3002\u7b2c 3 \u6761\u94fe\u8def\u6d4b\u8bd5\u76f8\u5bf9\u91cd\uff0c\u7b49\u524d\u4e24\u6761\u7a33\u5b9a\u4e86\u518d\u4e0a\u3002\u7b2c 4 \u6761\u5e76\u53d1\u6d4b\u8bd5\u5efa\u8bae\u6311\u6838\u5fc3\u63a5\u53e3\u505a\uff0c\u4e0d\u7528\u5168\u8986\u76d6\u3002<\/span><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u8fd8\u6709\u4e00\u4e2a\u5fc3\u6001\u95ee\u9898\u5f97\u8bf4\u6e05\u695a\uff1a<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u522b\u60f3\u7740\u4e00\u6b65\u5230\u4f4d\u3002<\/span><\/strong><\/p>\n<p style=\"margin: 14px 0px;color: rgb(51, 51, 51);font-family: -apple-system, &quot;system-ui&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Segoe UI&quot;, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 2em;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;\"><span leaf=\"\">\u63a5\u53e3\u6d4b\u8bd5\u7684\u56db\u7ef4\u8986\u76d6\u662f\u4e2a\u6e10\u8fdb\u8fc7\u7a0b\uff0c\u4e0d\u53ef\u80fd\u4e00\u5468\u4e4b\u5185\u628a\u51e0\u767e\u6761\u8001\u7528\u4f8b\u5168\u6539\u4e00\u904d\u3002\u6211\u4eec\u56e2\u961f\u5f53\u5e74\u662f\u82b1\u4e86\u4e24\u4e2a\u591a\u6708\u624d\u628a\u6838\u5fc3\u94fe\u8def\u94fa\u5b8c\u7684\uff0c\u4e2d\u95f4\u8fd8\u6709\u8fc7\u53cd\u590d\u3002\u6b63\u786e\u7684\u8282\u594f\u662f\uff1a\u65b0\u5199\u7684\u7528\u4f8b\u4e00\u5f8b\u6309\u56db\u7ef4\u8d70\uff0c\u8001\u7528\u4f8b\u7b49\u5230\u6709\u9700\u6c42\u6539\u5230\u5b83\u65f6\u987a\u624b\u5347\u7ea7\u3002\u534a\u5e74\u4e4b\u540e\u56de\u5934\u770b\uff0c\u8986\u76d6\u7387\u81ea\u7136\u5c31\u4e0a\u6765\u4e86\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-align: center;\"><span leaf=\"\"><span textstyle=\"\" style=\"background-color: rgb(255, 251, 0);\">\u5199\u5728\u672b\u5c3e\u7684\u4e00\u70b9\u60f3\u6cd5<\/span><\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\">\u6d4b\u8bd5\u8fd9\u4e2a\u5c97\u4f4d\uff0c\u4ef7\u503c\u4e0d\u5728\u4e8e&#8221;\u8bc1\u660e\u8f6f\u4ef6\u6ca1\u95ee\u9898&#8221;\u2014\u2014\u90a3\u662f\u4e0d\u53ef\u80fd\u7684\u3002\u4ef7\u503c\u5728\u4e8e<\/span><strong style=\"color: rgb(22, 33, 62);\"><span leaf=\"\">\u5c3d\u53ef\u80fd\u65e9\u5730\u628a\u95ee\u9898\u635e\u51fa\u6765<\/span><\/strong><span leaf=\"\">\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\">\u56db\u7ef4\u6846\u67b6\u505a\u7684\u4e8b\uff0c\u5c31\u662f\u628a\u53d1\u73b0\u95ee\u9898\u7684\u65f6\u95f4\u70b9\uff0c\u4ece&#8221;\u4e0a\u7ebf\u4e4b\u540e&#8221;\u63d0\u524d\u5230&#8221;\u63d0\u6d4b\u9636\u6bb5&#8221;\uff0c\u4ece&#8221;\u5ba2\u6237\u6295\u8bc9&#8221;\u63d0\u524d\u5230&#8221;CI \u62a5\u7ea2&#8221;\u3002\u8d8a\u65e9\u53d1\u73b0\uff0c\u4fee\u590d\u6210\u672c\u8d8a\u4f4e\uff0c\u56e2\u961f\u665a\u4e0a\u7761\u5f97\u8d8a\u8e0f\u5b9e\u3002<\/span><\/p>\n<p style=\"margin: 8px 0px;color: rgb(52, 73, 94);text-indent: 2em;\"><span leaf=\"\">\u63a5\u53e3\u8fd4\u56de 200 \u4ece\u6765\u90fd\u4e0d\u662f\u7ec8\u70b9\u3002\u5b83\u53ea\u662f\u4f60\u5f00\u59cb\u9a8c\u8bc1\u7684\u8d77\u70b9\u3002<\/span><\/p>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u53e3\u6d4b\u8bd5\u7684\u56db\u5c42\u8d28\u91cf\u5730\u56fe \u4ece\u53ea\u770b\u72b6\u6001\u7801\uff0c\u5230\u628a\u63a5\u53e3\u8d28\u91cf\u6d4b\u900f\u7684\u56db\u4e2a\u53f0\u9636 \u56fe\u7247\u5f15\u81ea\u5fae\u4fe1\u516c\u4f17\u53f7\uff0c\u626b\u7801\u5173\u6ce8\u9605\u8bfb\u539f\u6587 \u6211\u5e72\u6d4b [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":92,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-93","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-auto-tools"],"_links":{"self":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/comments?post=93"}],"version-history":[{"count":1,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/93\/revisions"}],"predecessor-version":[{"id":198,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/posts\/93\/revisions\/198"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/media\/92"}],"wp:attachment":[{"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/media?parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/categories?post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deartester.com\/index.php\/wp-json\/wp\/v2\/tags?post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}