{"id":330,"date":"2025-04-07T12:02:25","date_gmt":"2025-04-07T04:02:25","guid":{"rendered":"https:\/\/cn1.club\/?p=330"},"modified":"2025-04-07T12:03:55","modified_gmt":"2025-04-07T04:03:55","slug":"%e5%90%8e%e5%8f%b0%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f%e6%93%8d%e4%bd%9c%e6%97%a5%e5%bf%97%e6%a8%a1%e5%9d%97%e7%9a%84%e5%ad%97%e6%ae%b5%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/cn1.club\/?p=330","title":{"rendered":"\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf[\u64cd\u4f5c\u65e5\u5fd7]\u6a21\u5757\u7684\u5b57\u6bb5\u8bbe\u8ba1"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/cn1.club\/wp-content\/uploads\/2025\/04\/1743998327-u20877382143345344383fm253fmtautoapp120fJPEG-edited.webp\" alt=\"\" class=\"wp-image-332\" srcset=\"http:\/\/cn1.club\/wp-content\/uploads\/2025\/04\/1743998327-u20877382143345344383fm253fmtautoapp120fJPEG-edited.webp 1200w, http:\/\/cn1.club\/wp-content\/uploads\/2025\/04\/1743998327-u20877382143345344383fm253fmtautoapp120fJPEG-edited-300x200.webp 300w, http:\/\/cn1.club\/wp-content\/uploads\/2025\/04\/1743998327-u20877382143345344383fm253fmtautoapp120fJPEG-edited-1024x683.webp 1024w, http:\/\/cn1.club\/wp-content\/uploads\/2025\/04\/1743998327-u20877382143345344383fm253fmtautoapp120fJPEG-edited-768x512.webp 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>\u5728\u5f00\u53d1\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\u7684\u8fc7\u7a0b\u4e2d\uff0c\u64cd\u4f5c\u65e5\u5fd7\u6a21\u5757\u662f\u81f3\u5173\u91cd\u8981\u7684\u4e00\u73af\u3002\u65e0\u8bba\u662f\u7528\u4e8e\u884c\u4e3a\u5ba1\u8ba1\u3001\u5b89\u5168\u8ffd\u8e2a\uff0c\u8fd8\u662f\u95ee\u9898\u6392\u67e5\uff0c\u5408\u7406\u7684\u65e5\u5fd7\u5b57\u6bb5\u8bbe\u8ba1\u90fd\u80fd\u5927\u5e45\u63d0\u5347\u7cfb\u7edf\u53ef\u7ef4\u62a4\u6027\u548c\u53ef\u8ffd\u6eaf\u6027\u3002<\/p>\n\n\n\n<p>\u672c\u6587\u5c06\u7ed3\u5408\u5b9e\u9645\u4f7f\u7528\u573a\u666f\uff0c\u68b3\u7406\u51fa\u4e00\u5957\u901a\u7528\u3001\u6269\u5c55\u6027\u5f3a\u7684\u64cd\u4f5c\u65e5\u5fd7\u5b57\u6bb5\u8bbe\u8ba1\u65b9\u6848\uff0c\u4f9b\u540e\u53f0\u5f00\u53d1\u53c2\u8003\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-0\">\u4e00\u3001\u57fa\u7840\u5b57\u6bb5<\/h3>\n\n\n\n<p>\u57fa\u7840\u5b57\u6bb5\u4e3b\u8981\u8bb0\u5f55\u64cd\u4f5c\u884c\u4e3a\u7684\u6838\u5fc3\u4fe1\u606f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>id<\/strong>\uff1a\u4e3b\u952e\uff0c\u81ea\u589e\u6216 UUID<\/li>\n\n\n\n<li><strong>module<\/strong>\uff1a\u529f\u80fd\u6a21\u5757\u540d\u79f0\uff0c\u5982\u201c\u7528\u6237\u7ba1\u7406\u201d\u3001\u201c\u8d44\u6e90\u5ba1\u6838\u201d\u7b49<\/li>\n\n\n\n<li><strong>action<\/strong>\uff1a\u64cd\u4f5c\u7c7b\u578b\uff0c\u5982\u201c\u65b0\u589e\u201d\u3001\u201c\u7f16\u8f91\u201d\u3001\u201c\u5220\u9664\u201d\u3001\u201c\u5bfc\u51fa\u201d\u7b49<\/li>\n\n\n\n<li><strong>content<\/strong>\uff1a\u65e5\u5fd7\u5185\u5bb9\u63cf\u8ff0\uff0c\u4f8b\u5982\u201c\u5220\u9664\u4e86\u7528\u6237 ID: 123\u201d<\/li>\n\n\n\n<li><strong>log_level<\/strong>\uff1a\u65e5\u5fd7\u7b49\u7ea7\uff0c\u5e38\u7528 info \/ warn \/ error<\/li>\n\n\n\n<li><strong>created_at<\/strong>\uff1a\u65e5\u5fd7\u65f6\u95f4\u6233\uff0c\u8bb0\u5f55\u64cd\u4f5c\u53d1\u751f\u7684\u65f6\u95f4<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-1\">\u4e8c\u3001\u64cd\u4f5c\u4eba\u4fe1\u606f<\/h3>\n\n\n\n<p>\u8bb0\u5f55\u64cd\u4f5c\u6765\u6e90\u7528\u6237\u7684\u8eab\u4efd\u548c\u89d2\u8272\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>operator_id<\/strong>\uff1a\u64cd\u4f5c\u4eba ID<\/li>\n\n\n\n<li><strong>operator_name<\/strong>\uff1a\u64cd\u4f5c\u4eba\u59d3\u540d\uff08\u4fbf\u4e8e\u5c55\u793a\uff09<\/li>\n\n\n\n<li><strong>role<\/strong>\uff1a\u64cd\u4f5c\u4eba\u89d2\u8272\uff0c\u4f8b\u5982 admin\u3001editor\u3001auditor \u7b49<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-2\">\u4e09\u3001\u8bf7\u6c42\u73af\u5883\u4fe1\u606f<\/h3>\n\n\n\n<p>\u7528\u4e8e\u8ffd\u8e2a\u8bbf\u95ee\u6765\u6e90\uff0c\u4fbf\u4e8e\u5b89\u5168\u5ba1\u8ba1\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>ip_address<\/strong>\uff1a\u8bbf\u95ee\u8005\u7684 IP \u5730\u5740<\/li>\n\n\n\n<li><strong>user_agent<\/strong>\uff1a\u5ba2\u6237\u7aef\u8bbe\u5907\u4fe1\u606f\uff08\u5982\u6d4f\u89c8\u5668\u548c\u64cd\u4f5c\u7cfb\u7edf\uff09<\/li>\n\n\n\n<li><strong>request_method<\/strong>\uff1a\u8bf7\u6c42\u65b9\u5f0f\uff08GET\u3001POST\u3001PUT\u3001DELETE\uff09<\/li>\n\n\n\n<li><strong>request_url<\/strong>\uff1a\u63a5\u53e3\u5730\u5740\u6216\u9875\u9762\u8def\u5f84<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-3\">\u56db\u3001\u64cd\u4f5c\u7ed3\u679c\u4fe1\u606f<\/h3>\n\n\n\n<p>\u7528\u4e8e\u8bb0\u5f55\u64cd\u4f5c\u662f\u5426\u6210\u529f\u4ee5\u53ca\u5931\u8d25\u539f\u56e0\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>status<\/strong>\uff1a\u64cd\u4f5c\u7ed3\u679c\u72b6\u6001\uff0c\u4f8b\u5982 success \/ fail<\/li>\n\n\n\n<li><strong>error_message<\/strong>\uff1a\u5931\u8d25\u65f6\u7684\u9519\u8bef\u4fe1\u606f\uff0c\u4fbf\u4e8e\u95ee\u9898\u8ffd\u8e2a<\/li>\n\n\n\n<li><strong>duration<\/strong>\uff1a\u64cd\u4f5c\u8017\u65f6\uff08\u5355\u4f4d\uff1a\u6beb\u79d2\uff09\uff0c\u7528\u4e8e\u6027\u80fd\u5206\u6790<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-4\">\u4e94\u3001\u53ef\u9009\u5b57\u6bb5\uff08\u89c6\u9700\u6c42\u6269\u5c55\uff09<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>params<\/strong>\uff1a\u63d0\u4ea4\u7684\u53c2\u6570\u5185\u5bb9\uff0c\u6ce8\u610f\u5e94\u5bf9\u654f\u611f\u5b57\u6bb5\u8fdb\u884c\u8131\u654f\u5904\u7406<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-5\">\u516d\u3001\u5b57\u6bb5\u8bbe\u8ba1\u793a\u4f8b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >{\n  &quot;id&quot;: 123,\n  &quot;module&quot;: &quot;\u7528\u6237\u7ba1\u7406&quot;,\n  &quot;action&quot;: &quot;\u5220\u9664&quot;,\n  &quot;content&quot;: &quot;\u5220\u9664\u4e86\u7528\u6237 ID: 456&quot;,\n  &quot;log_level&quot;: &quot;info&quot;,\n  &quot;operator_id&quot;: 1,\n  &quot;operator_name&quot;: &quot;\u8d85\u7ea7\u7ba1\u7406\u5458&quot;,\n  &quot;role&quot;: &quot;admin&quot;,\n  &quot;status&quot;: &quot;success&quot;,\n  &quot;request_method&quot;: &quot;DELETE&quot;,\n  &quot;request_url&quot;: &quot;\/api\/users\/456&quot;,\n  &quot;ip_address&quot;: &quot;192.168.1.100&quot;,\n  &quot;user_agent&quot;: &quot;Mozilla\/5.0 (Windows NT 10.0; Win64; x64)...&quot;,\n  &quot;params&quot;: &quot;{\\&quot;nickname\\&quot;: \\&quot;\u6d4b\u8bd5\u7528\u6237\\&quot;}&quot;,\n  &quot;duration&quot;: 85,\n  &quot;created_at&quot;: &quot;2025-04-07T14:00:00&quot;\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-6\">\u4e03\u3001\u8bbe\u8ba1\u5efa\u8bae<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u65e5\u5fd7\u8868\u5e94\u652f\u6301\u5b9a\u671f\u5f52\u6863\u6216\u5206\u8868\uff0c\u907f\u514d\u6570\u636e\u91cf\u8fc7\u5927\u5f71\u54cd\u6027\u80fd\u3002<\/li>\n\n\n\n<li>\u5efa\u8bae\u4e3a\u91cd\u8981\u64cd\u4f5c\uff08\u5982\u5220\u9664\u3001\u6743\u9650\u4fee\u6539\uff09\u8bbe\u7f6e\u9ad8\u7b49\u7ea7\u65e5\u5fd7\uff0c\u5e76\u652f\u6301\u5355\u72ec\u7b5b\u9009\u3002<\/li>\n\n\n\n<li>\u8bb0\u5f55\u53c2\u6570\u5185\u5bb9\u65f6\uff0c\u5e94\u907f\u514d\u4fdd\u5b58\u654f\u611f\u4fe1\u606f\uff0c\u5982\u5bc6\u7801\u3001\u624b\u673a\u53f7\u7b49\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4e00\u5957\u5408\u7406\u7684\u65e5\u5fd7\u5b57\u6bb5\u8bbe\u8ba1\uff0c\u4e0d\u4ec5\u6709\u52a9\u4e8e\u5b89\u5168\u5408\u89c4\u548c\u6570\u636e\u8ffd\u8e2a\uff0c\u4e5f\u80fd\u4e3a\u540e\u671f\u7cfb\u7edf\u4f18\u5316\u63d0\u4f9b\u6709\u529b\u7684\u6570\u636e\u652f\u6301\u3002\u4ee5\u4e0a\u5b57\u6bb5\u8bbe\u8ba1\u9002\u7528\u4e8e\u591a\u7528\u6237\u540e\u53f0\u7cfb\u7edf\uff0c\u5c24\u5176\u662f\u6d89\u53ca\u7ba1\u7406\u5458\u4e0e\u666e\u901a\u7528\u6237\u5206\u6743\u7684\u573a\u666f\u3002<\/p>\n\n\n\n<p>\u53ef\u6839\u636e\u4e1a\u52a1\u5177\u4f53\u9700\u6c42\u505a\u9002\u5f53\u88c1\u526a\u6216\u6269\u5c55\uff0c\u4fdd\u6301\u7075\u6d3b\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" style=\"font-size:24px\" id=\"toc-7\">operation_logs \u8868\u5efa\u8868 SQL[Mysql]<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >CREATE TABLE `operation_logs` (\n  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT &#039;\u4e3b\u952eID&#039;,\n  `module` VARCHAR(100) NOT NULL COMMENT &#039;\u529f\u80fd\u6a21\u5757\u540d\u79f0&#039;,\n  `action` VARCHAR(50) NOT NULL COMMENT &#039;\u64cd\u4f5c\u7c7b\u578b\uff0c\u5982\u65b0\u589e\/\u7f16\u8f91\/\u5220\u9664&#039;,\n  `content` TEXT COMMENT &#039;\u64cd\u4f5c\u5185\u5bb9\u63cf\u8ff0&#039;,\n  `log_level` ENUM(&#039;info&#039;, &#039;warning&#039;, &#039;error&#039;) DEFAULT &#039;info&#039; COMMENT &#039;\u65e5\u5fd7\u7b49\u7ea7&#039;,\n  \n  `operator_id` BIGINT UNSIGNED NOT NULL COMMENT &#039;\u64cd\u4f5c\u4ebaID&#039;,\n  `operator_name` VARCHAR(100) COMMENT &#039;\u64cd\u4f5c\u4eba\u59d3\u540d&#039;,\n  `role` VARCHAR(50) COMMENT &#039;\u64cd\u4f5c\u4eba\u89d2\u8272&#039;,\n\n  `status` ENUM(&#039;success&#039;, &#039;fail&#039;) DEFAULT &#039;success&#039; COMMENT &#039;\u64cd\u4f5c\u7ed3\u679c&#039;,\n  `error_message` TEXT COMMENT &#039;\u5931\u8d25\u539f\u56e0&#039;,\n\n  `request_method` VARCHAR(10) COMMENT &#039;\u8bf7\u6c42\u65b9\u6cd5\uff0c\u5982GET\/POST&#039;,\n  `request_url` VARCHAR(255) COMMENT &#039;\u8bf7\u6c42\u5730\u5740&#039;,\n  `params` TEXT COMMENT &#039;\u8bf7\u6c42\u53c2\u6570\uff08\u8131\u654f\uff09&#039;,\n  `ip_address` VARCHAR(45) COMMENT &#039;IP\u5730\u5740&#039;,\n  `user_agent` VARCHAR(255) COMMENT &#039;\u8bbe\u5907\u4fe1\u606f&#039;,\n  `duration` INT UNSIGNED COMMENT &#039;\u64cd\u4f5c\u8017\u65f6\uff08ms\uff09&#039;,\n\n  `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT &#039;\u64cd\u4f5c\u65f6\u95f4&#039;,\n\n  PRIMARY KEY (`id`),\n  KEY `idx_operator_id` (`operator_id`),\n  KEY `idx_module` (`module`),\n  KEY `idx_created_at` (`created_at`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT=&#039;\u540e\u53f0\u64cd\u4f5c\u65e5\u5fd7\u8868&#039;;\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5f00\u53d1\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\u7684\u8fc7\u7a0b\u4e2d\uff0c\u64cd\u4f5c\u65e5\u5fd7\u6a21\u5757\u662f\u81f3\u5173\u91cd\u8981\u7684\u4e00\u73af\u3002\u65e0\u8bba\u662f\u7528\u4e8e\u884c\u4e3a\u5ba1\u8ba1\u3001\u5b89\u5168\u8ffd\u8e2a\uff0c\u8fd8\u662f\u95ee\u9898\u6392\u67e5\uff0c\u5408\u7406\u7684\u65e5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":331,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"class_list":["post-330","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coder"],"_links":{"self":[{"href":"http:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=330"}],"version-history":[{"count":0,"href":"http:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/330\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/media\/331"}],"wp:attachment":[{"href":"http:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=330"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}