{"id":59957,"date":"2025-04-24T11:04:47","date_gmt":"2025-04-24T03:04:47","guid":{"rendered":"https:\/\/fwq.ai\/blog\/59957\/"},"modified":"2025-04-24T11:04:47","modified_gmt":"2025-04-24T03:04:47","slug":"%e8%ae%a9ecshop%e6%96%87%e7%ab%a0%e5%88%97%e8%a1%a8%e9%a1%b5%e9%9d%a2%ef%bc%8c%e8%b0%83%e7%94%a8%e6%96%87%e7%ab%a0%e6%91%98%e8%a6%81-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/59957\/","title":{"rendered":"\u8ba9ecshop\u6587\u7ae0\u5217\u8868\u9875\u9762\uff0c\u8c03\u7528\u6587\u7ae0\u6458\u8981"},"content":{"rendered":"<p>01\uff09\u627e\u5230includes\/lib_article.php <span>\u6587\u4ef6<\/span>\u7684\u7b2c21\u884c\uff0c\u5c06\u4e0b\u9762\u65b9\u6cd5\u8986\u76d6\u539f\u65b9\u6cd5\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><font>\/**<br \/> * \u83b7\u5f97\u6587\u7ae0\u5206\u7c7b\u4e0b\u7684\u6587\u7ae0\u5217\u8868<br \/> *<br \/> * @access public<br \/> * @param integer $cat_id<br \/> * @param integer $page<br \/> * @param integer $size<br \/> *<br \/> * @return array<br \/> *\/<br \/> function get_cat_articles($cat_id, $page = 1, $size = 20 ,$requirement=&#8221;)<br \/> {<br \/> \/\/\u53d6\u51fa\u6240\u6709\u975e0\u7684\u6587\u7ae0<br \/> if ($cat_id == &#8216;-1&#8217;)<br \/> {<br \/> $cat_str = &#8216;cat_id &gt; 0&#8217;;<br \/> }<br \/> else<br \/> {<br \/> $cat_str = get_article_children($cat_id);<br \/> }<br \/> \/\/\u589e\u52a0\u641c\u7d22\u6761\u4ef6\uff0c\u5982\u679c\u6709\u641c\u7d22\u5185\u5bb9\u5c31\u8fdb\u884c\u641c\u7d22 <br \/> if ($requirement != &#8221;)<br \/> {<br \/> $sql = &#8216;SELECT article_id, title,content , author, add_time, file_url, open_type&#8217; .<br \/> &#8216; FROM &#8216; .$GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;article&#8217;) .<br \/> &#8216; WHERE is_open = 1 AND title like \\&#8217;%&#8217; . $requirement . &#8216;%\\&#8217; &#8216; .<br \/> &#8216; ORDER BY article_type DESC, article_id DESC&#8217;;<br \/> }<br \/> else <br \/> {<\/font><\/p>\n<p><font>$sql = &#8216;SELECT article_id, title,content , author, add_time, file_url, open_type&#8217; .<br \/> &#8216; FROM &#8216; .$GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;article&#8217;) .<br \/> &#8216; WHERE is_open = 1 AND &#8216; . $cat_str .<br \/> &#8216; ORDER BY article_type DESC, article_id DESC&#8217;;<br \/> }<\/font><\/p>\n<p><font>$res = $GLOBALS[&#8216;db&#8217;]-&gt;sel ectLimit($sql, $size, ($page-1) * $size);<\/font><\/p>\n<p><font>$arr = array();<br \/> if ($res)<br \/> {<br \/> while ($row = $GLOBALS[&#8216;db&#8217;]-&gt;fetchRow($res))<br \/> {<br \/> $article_id = $row[&#8216;article_id&#8217;];<\/font><\/p>\n<p><font>$arr[$article_id][&#8216;id&#8217;] = $article_id;<br \/> $arr[$article_id][&#8216;title&#8217;] = $row[&#8216;title&#8217;];<br \/> \/*68ecshop.com&nbsp; add*\/<br \/> $arr[$article_id][&#8216;content&#8217;] = $row[&#8216;content&#8217;];<\/font><\/p>\n<p><font>$arr[$article_id][&#8216;short_title&#8217;] = $GLOBALS[&#8216;_CFG&#8217;][&#8216;article_title_length&#8217;] &gt; 0 ? sub_str($row[&#8216;title&#8217;], $GLOBALS[&#8216;_CFG&#8217;][&#8216;article_title_length&#8217;]) : $row[&#8216;title&#8217;];<br \/> $arr[$article_id][&#8216;author&#8217;] = empty($row[&#8216;author&#8217;]) || $row[&#8216;author&#8217;] == &#8216;_SHOPHELP&#8217; ? $GLOBALS[&#8216;_CFG&#8217;][&#8216;shop_name&#8217;] : $row[&#8216;author&#8217;];<br \/> $arr[$article_id][&#8216;url&#8217;] = $row[&#8216;open_type&#8217;] != 1 ? build_uri(&#8216;article&#8217;, array(&#8216;aid&#8217;=&gt;$article_id), $row[&#8216;title&#8217;]) : trim($row[&#8216;file_url&#8217;]);<br \/> $arr[$article_id][&#8216;add_time&#8217;] = date($GLOBALS[&#8216;_CFG&#8217;][&#8216;date_format&#8217;], $row[&#8216;add_time&#8217;]);<br \/> }<br \/> }<\/font><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><font><font>02\uff09article_cat.dwt\u6587\u4ef6\u5faa\u73af<\/font><strong><font>\u6587\u7ae0<\/font><\/strong><font>\u7684\u65f6\u5019\uff0c\u6dfb\u52a0\u7ea2\u8272\u4ee3\u7801\uff0cCSS\u6837\u5f0f\u81ea\u5df1\u8c03\u3002<br \/> &nbsp; &nbsp;&nbsp; &nbsp;&lt;!&#8211; {foreach from=$artciles_list item=article} &#8211;&gt;<br \/> &nbsp; &nbsp;&nbsp; &nbsp;&lt;p&gt;&lt;a href=&#8221;{$article.url}&#8221; title=&#8221;{$article.title|escape:html}&#8221;&gt;{$article.short_title}&lt;\/a&gt;<br \/> &nbsp; &nbsp;&nbsp; &nbsp;&lt;\/p&gt;<\/p>\n<p> <\/font><font>&lt;div style=&#8221;border:1px solid #E8E8E8; padding:10px; margin:10px 0; color:#999&#8243;&gt;<br \/> &nbsp; &nbsp;&nbsp; &nbsp;{$article.content|strip_tags|truncate:40}&lt;a href=&#8221;{$article.url}&#8221; title=&#8221;{$article.title|escape:html}&#8221;&gt;[<span>\u8be6\u60c5<\/span>\u8fdb\u5165]&lt;\/a&gt;<br \/> &nbsp; &nbsp;&nbsp; &nbsp;&lt;\/div&gt;<\/font><\/p>\n<p> <\/font><font>&nbsp; &nbsp;&nbsp; &nbsp;&lt;!&#8211; {\/foreach} &#8211;&gt;<\/font><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>01\uff09\u627e\u5230includes\/lib_article.php \u6587\u4ef6\u7684\u7b2c21\u884c\uff0c\u5c06\u4e0b\u9762\u65b9\u6cd5\u8986\u76d6\u539f\u65b9\u6cd5\u3002 &nbsp; \/** * \u83b7\u5f97\u6587\u7ae0\u5206\u7c7b\u4e0b\u7684\u6587\u7ae0\u5217\u8868 * * @access public * @param integer $cat_id * @param integer $page * @param integer $size * * @return array *\/ function get_cat_articles($cat_id, $page = 1, $size = 20 ,$requirement=&#8221;) { \/\/\u53d6\u51fa\u6240\u6709\u975e0\u7684\u6587\u7ae0 if ($cat_id == &#8216;-1&#8217;) { $cat_str = &#8216;cat_id &gt; 0&#8217;; } else { $cat_str = get_article_children($cat_id); } [&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-59957","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59957","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=59957"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59957\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=59957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=59957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=59957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}