{"id":7592,"date":"2024-11-14T10:40:03","date_gmt":"2024-11-14T02:40:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7592\/"},"modified":"2024-11-14T10:40:03","modified_gmt":"2024-11-14T02:40:03","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e8%af%a2%e4%b8%a4%e4%b8%aa%e6%9c%88%e5%86%85%e6%b2%a1%e6%9c%89%e6%93%8d%e4%bd%9c%e8%ae%b0%e5%bd%95%e7%9a%84%e7%ae%a1%e7%90%86%e5%91%98%e5%a7%93%e5%90%8d%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7592\/","title":{"rendered":"\u5982\u4f55\u67e5\u8be2\u4e24\u4e2a\u6708\u5185\u6ca1\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458\u59d3\u540d\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173104494356986.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u67e5\u8be2\u4e24\u4e2a\u6708\u5185\u6ca1\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458\u59d3\u540d\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u67e5\u8be2\u4e24\u4e2a\u6708\u5185\u6ca1\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458\u59d3\u540d\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u67e5\u8be2\u6307\u5b9a\u65f6\u95f4\u6bb5\u5185\u65e0\u6d3b\u52a8\u8bb0\u5f55\u7684\u8868\u8bb0\u5f55<\/strong><\/p>\n<p>\u5bf9\u4e8e\u9898\u4e2d\u63d0\u51fa\u7684\u95ee\u9898\uff0c\u9700\u8981\u67e5\u8be2\u6700\u8fd1\u4e24\u4e2a\u6708\u6ca1\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458\u59d3\u540d\uff0c\u53ef\u4ee5\u4f7f\u7528 mysql \u4e2d\u7684 not in \u5b50\u67e5\u8be2\u6765\u5b9e\u73b0\uff1a<\/p>\n<pre>select * from admin where id not in (\n  select distinct admin_id from admin_log\n  where created_at &gt; date_sub(now(), interval 2 month)\n)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u67e5\u8be2\u89e3\u6790<\/strong><\/p>\n<ul>\n<li>admin \u662f\u9700\u8981\u67e5\u8be2\u7684\u8868\uff0c\u5305\u542b\u7ba1\u7406\u5458\u4fe1\u606f\u3002<\/li>\n<li>admin_log \u662f\u7ba1\u7406\u5458\u64cd\u4f5c\u8bb0\u5f55\u8868\u3002<\/li>\n<li>created_at \u662f\u7ba1\u7406\u5458\u64cd\u4f5c\u8bb0\u5f55\u7684\u521b\u5efa\u65f6\u95f4\u3002<\/li>\n<li>date_sub(now(), interval 2 month) \u8ba1\u7b97\u51fa\u5f53\u524d\u65f6\u95f4\u51cf\u53bb\u4e24\u4e2a\u6708\u7684\u65f6\u95f4\u6233\u3002<\/li>\n<li>not in \u5b50\u67e5\u8be2\u8fd4\u56de admin_id \u4e0d\u5728\u6700\u8fd1\u4e24\u4e2a\u6708\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458 id \u6570\u7ec4\u3002<\/li>\n<li>\u4e3b\u67e5\u8be2\u8fd4\u56de\u7ba1\u7406\u5458\u8868\u4e2d id \u4e0d\u5b58\u5728\u4e8e not in \u5b50\u67e5\u8be2\u7ed3\u679c\u96c6\u4e2d\u7684\u7ba1\u7406\u5458\u8bb0\u5f55\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u67e5\u8be2\u51fa\u6700\u8fd1\u4e24\u4e2a\u6708\u6ca1\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458\u59d3\u540d\u4e86\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u67e5\u8be2\u4e24\u4e2a\u6708\u5185\u6ca1\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458\u59d3\u540d\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u8be2\u6307\u5b9a\u65f6\u95f4\u6bb5\u5185\u65e0\u6d3b\u52a8\u8bb0\u5f55\u7684\u8868\u8bb0\u5f55 \u5bf9\u4e8e\u9898\u4e2d\u63d0\u51fa\u7684\u95ee\u9898\uff0c\u9700\u8981\u67e5\u8be2\u6700\u8fd1\u4e24\u4e2a\u6708\u6ca1\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458\u59d3\u540d\uff0c\u53ef\u4ee5\u4f7f\u7528 mysql \u4e2d\u7684 not in \u5b50\u67e5\u8be2\u6765\u5b9e\u73b0\uff1a select * from admin where id not in ( select distinct admin_id from admin_log where created_at &gt; date_sub(now(), interval 2 month) ) \u767b\u5f55\u540e\u590d\u5236 \u67e5\u8be2\u89e3\u6790 admin \u662f\u9700\u8981\u67e5\u8be2\u7684\u8868\uff0c\u5305\u542b\u7ba1\u7406\u5458\u4fe1\u606f\u3002 admin_log \u662f\u7ba1\u7406\u5458\u64cd\u4f5c\u8bb0\u5f55\u8868\u3002 created_at \u662f\u7ba1\u7406\u5458\u64cd\u4f5c\u8bb0\u5f55\u7684\u521b\u5efa\u65f6\u95f4\u3002 date_sub(now(), interval 2 month) \u8ba1\u7b97\u51fa\u5f53\u524d\u65f6\u95f4\u51cf\u53bb\u4e24\u4e2a\u6708\u7684\u65f6\u95f4\u6233\u3002 not in \u5b50\u67e5\u8be2\u8fd4\u56de admin_id \u4e0d\u5728\u6700\u8fd1\u4e24\u4e2a\u6708\u6709\u64cd\u4f5c\u8bb0\u5f55\u7684\u7ba1\u7406\u5458 id \u6570\u7ec4\u3002 \u4e3b\u67e5\u8be2\u8fd4\u56de\u7ba1\u7406\u5458\u8868\u4e2d id \u4e0d\u5b58\u5728\u4e8e not in \u5b50\u67e5\u8be2\u7ed3\u679c\u96c6\u4e2d\u7684\u7ba1\u7406\u5458\u8bb0\u5f55\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7592","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=7592"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7592\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}