{"id":59745,"date":"2025-04-23T11:53:07","date_gmt":"2025-04-23T03:53:07","guid":{"rendered":"https:\/\/fwq.ai\/blog\/59745\/"},"modified":"2025-04-23T11:53:07","modified_gmt":"2025-04-23T03:53:07","slug":"ecshop%e6%96%87%e7%ab%a0%e5%a2%9e%e5%8a%a0%e7%82%b9%e5%87%bb%e8%ae%bf%e9%97%ae%e9%87%8f%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/59745\/","title":{"rendered":"ecshop\u6587\u7ae0\u589e\u52a0\u70b9\u51fb\u8bbf\u95ee\u91cf\u7684\u65b9\u6cd5"},"content":{"rendered":"<p> \u4e3aecshop\u6587\u7ae0\u67e5\u770b\u4e00\u4e0b\u6587\u7ae0\u70b9\u51fb\u91cf\uff0c\u53ef\u662f\u9ed8\u8ba4\u662f\u6ca1\u6709\u8fd9\u4e2a\u5b57\u6bb5\u7684\uff0c\u90a3\u6211\u4eec\u8be5\u600e\u4e48\u505a\u624d\u80fd\u628a\u5b83\u5448\u73b0\u51fa\u6765\uff0c\u73b0\u5728\u5c31\u753168ecshop\u7684\u6280\u672f\u6765\u4e3a\u4f60\u8bb2\u89e3\u4e00\u4e0b\u5427<\/p>\n<p>  \u7b2c\u4e00\u6b65\uff1a\u4e3aecshop\u7684\u6587\u7ae0\u8868\u589e\u52a0\u4e00\u4e2a\u5b57\u6bb5click_count\u4ee5\u5b58\u50a8\u6587\u7ae0\u7684\u70b9\u51fb\u6b21\u6570\u6d4f\u89c8\u6b21\u6570\uff0c\u5982\u4f55\u4e3a\u6587\u7ae0\u8868\u589e\u52a0\u51fb\u70b9\u51fb\u6b21\u6570\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u4f60\u7684ecshop\u7f51\u5e97\u540e\u53f0&#8212;&gt;\u6570\u636e\u5e93\u7ba1\u7406&#8212;&gt;sql\u67e5\u8be2\u6267\u884c\u4e00\u6761SQL\u8bed\u53e5\uff1a   \u4ee3\u7801\u5982\u4e0b   &nbsp; &nbsp; ALTER TABLE ecs_article ADD COLUMN click_count INT(10) DEFAULT &nbsp;0; &nbsp;   \u6ce8\u610f\u8868\u53e5ecs_article\u4e2d\u7684\u8868\u524d\u7f00\u53ef\u80fd\u968f\u7740\u4f60\u7684ecshop\u5b89\u88c5\u65f6\u7684\u8bbe\u7f6e\u4e0d\u540c\u800c\u4e0d\u540c\uff0c\u5982\u679c\u4f60\u7684\u8868\u524d\u7f00\u662fshop_\u8bf7\u628asql\u53e5\u8bed\u4e2d\u7684ecs_\u6362\u6210shop_\uff0c\u5426\u5219sql\u8bed\u53e5\u5c06\u6267\u884c\u4e0d\u6210\u529f\u3002&nbsp;   \u7b2c\u4e8c\u6b65\uff1a\u4fee\u6539article.php\uff0c\u6d4f\u89c8\u6587\u7ae0\u65f6\u589e\u52a0\u70b9\u51fb\u6b21\u6570\u6570\u503c\uff1a   \u4ee3\u7801\u5982\u4e0b\uff1a\u7b2c4\u30015\u884c\u662f\u65b0\u589e\u4ee3\u7801&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; assign_dynamic(&#8216;article&#8217;); &nbsp;&nbsp;   &nbsp; &nbsp; } &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; \/* \u66f4\u65b0\u70b9\u51fb\u6b21\u6570 *\/ &nbsp;   &nbsp; &nbsp; $db-&gt;query(&#8216;UPDATE &#8216; . $ecs-&gt;table(&#8216;article&#8217;) . &#8221; SET click_count = click_count + 1 WHERE &nbsp;article_id = &#8216;$article_id'&#8221;); &nbsp;&nbsp;&nbsp; &nbsp;   &nbsp; &nbsp; if(isset($article) &amp;&amp; $article[&#8216;cat_id&#8217;] &gt; 2) &nbsp;&nbsp;   \u7b2c\u4e09\u6b65\uff1a\u4fee\u6539article.dwt\u628a\u6587\u7ae0\u7684\u70b9\u51fb\u6b21\u6570\u663e\u793a\u51fa\u6765   \u4ee3\u7801\u5982\u4e0b   &nbsp; &nbsp; &lt;font class=&#8221;f3&#8243;&gt;{$article.author|escape:html} \/ {$article.add_time}\/{$article.click_count}&lt;\/font&gt; &nbsp;   \u5176\u4e2d{$article.click_count}\u4ee3\u8868\u7684\u6587\u7ae0\u70b9\u51fb\u6b21\u6570   \u8fd9\u6837\u5c31\u53ef\u4ee5\u4e86\uff0c\u5982\u679c\u60f3\u8981\u52a0\u4e0a\u540e\u53f0\u7684\u53ef\u64cd\u4f5c\u6027\u4e5f\u5f88\u7b80\u5355\uff0c\u64cd\u4f5c\u5982\u4e0b\uff1a   \uff081\uff09\u6253\u5f00\u6587\u4ef6\/languages\/zh_cn\/admin\/article.php \u6dfb\u52a0\u4ee3\u7801\uff1a&nbsp;   &nbsp; &nbsp; $_LANG[&#8216;all_cat&#8217;] = &#8216;\u5168\u90e8\u5206\u7c7b&#8217;; &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8211;\u65b0\u589e\u4ee3\u7801&#8211;*\/ &nbsp;   &nbsp; &nbsp; $_LANG[&#8216;click_count&#8217;] = &#8216;\u70b9\u51fb\u6570&#8217;; &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8211;end&#8211;*\/ &nbsp;&nbsp;   \uff082\uff09\u6253\u5f00\u6587\u4ef6\/admin\/templates\/article_list.htm \u4ee3\u7801\u5982\u4e0b&nbsp;   &nbsp; &nbsp; &lt;th&gt;&lt;a href=&#8221;javascript:listTable.sort(&#8216;article_type&#8217;); &#8220;&gt;{$lang.article_type}&lt;\/a&gt;{$sort_article_type}&lt;\/th&gt; &nbsp;   &nbsp; &nbsp; &lt;!&#8211;\u65b0\u589e\u4ee3\u7801&#8211;&gt; &nbsp;   &nbsp; &nbsp; &lt;th&gt;&lt;a href=&#8221;javascript:listTable.sort(&#8216;click_count&#8217;)&#8221;&gt;{$lang.click_count}&lt;\/a&gt;&lt;\/th&gt; &nbsp;   &nbsp; &nbsp; &lt;!&#8211;end&#8211;&gt; &nbsp;   &nbsp; &nbsp; &lt;th&gt;&lt;a href=&#8221;javascript:listTable.sort(&#8216;is_open&#8217;); &#8220;&gt;{$lang.is_open}&lt;\/a&gt;{$sort_is_open}&lt;\/th&gt; &nbsp;   &nbsp; &nbsp; &lt;td align=&#8221;center&#8221;&gt;&lt;span&gt;{if $list.article_type eq 0}{$lang.common}{else}{$lang.top}{\/if}&lt;\/span&gt;&lt;\/td&gt; &nbsp;   &nbsp; &nbsp; &lt;!&#8211;\u65b0\u589e\u4ee3\u7801&#8211;&gt; &nbsp;   &nbsp; &nbsp; &lt;td align=&#8221;center&#8221;&gt;&lt;span onclick=&#8221;javascript:listTable.edit(this, &#8216;edit_click_count&#8217;, {$list.article_id})&#8221;&gt;{$list.click_count|escape:html}&lt;\/span&gt;&lt;\/td&gt; &nbsp;   &nbsp; &nbsp; &lt;!&#8211;end&#8211;&gt; &nbsp;   &nbsp; &nbsp; &lt;td align=&#8221;center&#8221;&gt;{if $list.cat_id &gt; 0}&lt;span&gt; &nbsp;   \uff083\uff09\u6253\u5f00\u6587\u4ef6\/admin\/article.php \u5927\u6982335\u884c\u7684\u4f4d\u7f6e\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a   &nbsp; &nbsp; \/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; *\/ &nbsp;   &nbsp; &nbsp; \/\/&#8211; \u7f16\u8f91\u6587\u7ae0\u4e3b\u9898 &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; *\/ &nbsp;   &nbsp; &nbsp; elseif ($_REQUEST[&#8216;act&#8217;] == &#8216;edit_title&#8217;) &nbsp;&nbsp;   &nbsp; &nbsp; { &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; check_authz_json(&#8216;article_manage&#8217;); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $id &nbsp; &nbsp;= intval($_POST[&#8216;id&#8217;]); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $title = json_str_iconv(trim($_POST[&#8216;val&#8217;])); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; \/* \u68c0\u67e5\u6587\u7ae0\u6807\u9898\u662f\u5426\u91cd\u590d *\/ &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; if ($exc-&gt;num(&#8220;title&#8221;, $title, $id) != 0) &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; make_json_error(sprintf($_LANG[&#8216;title_exist&#8217;], $title)); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($exc-&gt;edit(&#8220;title = &#8216;$title'&#8221;, $id)) &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clear_cache_files(); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; admin_log($title, &#8216;edit&#8217;, &#8216;article&#8217;); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; make_json_result(stripslashes($title)); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; make_json_error($db-&gt;error()); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;&nbsp;   &nbsp; &nbsp; } &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8211;\u65b0\u589e\u4ee3\u7801&#8211;*\/ &nbsp;   &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; *\/ &nbsp;   &nbsp; &nbsp; \/\/&#8211; \u7f16\u8f91\u6587\u7ae0\u70b9\u51fb &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; *\/ &nbsp;   &nbsp; &nbsp; elseif ($_REQUEST[&#8216;act&#8217;] == &#8216;edit_click_count&#8217;) &nbsp;&nbsp;   &nbsp; &nbsp; { &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; check_authz_json(&#8216;article_manage&#8217;); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $id &nbsp; &nbsp;= intval($_POST[&#8216;id&#8217;]); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $click_count = json_str_iconv(trim($_POST[&#8216;val&#8217;])); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; if ($exc-&gt;edit(&#8220;click_count = &#8216;$click_count'&#8221;, $id)) &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clear_cache_files(); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; admin_log($click_count, &#8216;edit&#8217;, &#8216;article&#8217;); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; make_json_result(stripslashes($click_count)); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; make_json_error($db-&gt;error()); &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8211;end&#8211;*\/ &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; *\/ &nbsp;   &nbsp; &nbsp; \/\/&#8211; \u5207\u6362\u662f\u5426\u663e\u793a &nbsp;&nbsp;   &nbsp; &nbsp; \/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; *\/ &nbsp;   \u8fdb\u5165\u540e\u53f0&#8211;\u6587\u7ae0\u5217\u8868\uff0c\u67e5\u770b\u4e00\u4e0b\uff0c\u5e76\u4e14\u70b9\u51fb\u5c31\u53ef\u4ee5\u76f4\u63a5\u4fee\u6539  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3aecshop\u6587\u7ae0\u67e5\u770b\u4e00\u4e0b\u6587\u7ae0\u70b9\u51fb\u91cf\uff0c\u53ef\u662f\u9ed8\u8ba4\u662f\u6ca1\u6709\u8fd9\u4e2a\u5b57\u6bb5\u7684\uff0c\u90a3\u6211\u4eec\u8be5\u600e\u4e48\u505a\u624d\u80fd\u628a\u5b83\u5448\u73b0\u51fa\u6765\uff0c\u73b0\u5728\u5c31\u753168ecshop\u7684\u6280\u672f\u6765\u4e3a\u4f60\u8bb2\u89e3\u4e00\u4e0b\u5427 \u7b2c\u4e00\u6b65\uff1a\u4e3aecshop\u7684\u6587\u7ae0\u8868\u589e\u52a0\u4e00\u4e2a\u5b57\u6bb5click_count\u4ee5\u5b58\u50a8\u6587\u7ae0\u7684\u70b9\u51fb\u6b21\u6570\u6d4f\u89c8\u6b21\u6570\uff0c\u5982\u4f55\u4e3a\u6587\u7ae0\u8868\u589e\u52a0\u51fb\u70b9\u51fb\u6b21\u6570\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u4f60\u7684ecshop\u7f51\u5e97\u540e\u53f0&#8212;&gt;\u6570\u636e\u5e93\u7ba1\u7406&#8212;&gt;sql\u67e5\u8be2\u6267\u884c\u4e00\u6761SQL\u8bed\u53e5\uff1a \u4ee3\u7801\u5982\u4e0b &nbsp; &nbsp; ALTER TABLE ecs_article ADD COLUMN click_count INT(10) DEFAULT &nbsp;0; &nbsp; \u6ce8\u610f\u8868\u53e5ecs_article\u4e2d\u7684\u8868\u524d\u7f00\u53ef\u80fd\u968f\u7740\u4f60\u7684ecshop\u5b89\u88c5\u65f6\u7684\u8bbe\u7f6e\u4e0d\u540c\u800c\u4e0d\u540c\uff0c\u5982\u679c\u4f60\u7684\u8868\u524d\u7f00\u662fshop_\u8bf7\u628asql\u53e5\u8bed\u4e2d\u7684ecs_\u6362\u6210shop_\uff0c\u5426\u5219sql\u8bed\u53e5\u5c06\u6267\u884c\u4e0d\u6210\u529f\u3002&nbsp; \u7b2c\u4e8c\u6b65\uff1a\u4fee\u6539article.php\uff0c\u6d4f\u89c8\u6587\u7ae0\u65f6\u589e\u52a0\u70b9\u51fb\u6b21\u6570\u6570\u503c\uff1a \u4ee3\u7801\u5982\u4e0b\uff1a\u7b2c4\u30015\u884c\u662f\u65b0\u589e\u4ee3\u7801&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assign_dynamic(&#8216;article&#8217;); &nbsp;&nbsp; &nbsp; &nbsp; } &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; \/* \u66f4\u65b0\u70b9\u51fb\u6b21\u6570 *\/ &nbsp; &nbsp; &nbsp; $db-&gt;query(&#8216;UPDATE &#8216; . $ecs-&gt;table(&#8216;article&#8217;) . &#8221; SET click_count = click_count + 1 WHERE &nbsp;article_id = &#8216;$article_id&#8217;&#8221;); &nbsp;&nbsp;&nbsp; [&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-59745","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59745","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=59745"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59745\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=59745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=59745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=59745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}