{"id":199123,"date":"2025-05-03T10:26:05","date_gmt":"2025-05-03T02:26:05","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199123\/"},"modified":"2025-05-03T10:26:05","modified_gmt":"2025-05-03T02:26:05","slug":"%e5%9c%a8ecshop%e9%a6%96%e9%a1%b5%e6%98%be%e7%a4%ba%e7%a7%af%e5%88%86%e5%95%86%e5%9f%8e%e9%87%8c%e7%9a%84%e5%95%86%e5%93%81","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199123\/","title":{"rendered":"\u5728ECSHOP\u9996\u9875\u663e\u793a\u79ef\u5206\u5546\u57ce\u91cc\u7684\u5546\u54c1"},"content":{"rendered":"<p>&nbsp;<span style=\"font-family: \u5b8b\u4f53, Verdana, Arial;line-height: 18px;font-size: 12px\">\u4eca\u65e5\u770b\u5230ecshop\u8bba\u575b\u91cc\u6709\u4e9b\u670b\u53cb\u5728\u8ba8\u8bba\u201c\u5982\u4f55\u5728\u9996\u9875\u8c03\u7528\u79ef\u5206\u5546\u57ce\u91cc\u7684\u5546\u54c1\u201d\uff0c <\/span><\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u4e5f\u6709\u4e00\u4e9b\u670b\u53cb\u5df2\u7ecf\u5199\u51fa\u4e86\u5927\u90e8\u5206\u4ee3\u7801\uff0c\u4f46\u662f\u7531\u4e8e\u4e2a\u522b\u9519\u8bef\uff0c\u672a\u80fd\u5b9e\u73b0\u3002<\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u4e0b\u9762\u5c31\u4ee5ECSHOP2.7.2\u5b98\u65b9\u9ed8\u8ba4\u6a21\u677f\u4e3a\u57fa\u7840\uff0c\u7ed9\u5927\u5bb6\u63d0\u4f9b\u4e00\u4e2a\u5b8c\u6574\u7684\u89e3\u51b3\u65b9\u6848\u3002<br \/> 1\uff09\u3001<br \/> \u9996\u5148\u6253\u5f00 index.php \u6587\u4ef6<br \/> \u5728\u6700\u672b\u5c3e\u589e\u52a0\u4e0b\u9762\u51fd\u6570\uff0c\u6ce8\u610f\u5343\u4e07\u4e0d\u8981\u5199\u5230 \u201c?&gt;\u201d \u7684\u5916\u9762\u53bb\uff0c\u8981\u52a0\u5728\u201c?&gt;\u201d\u7684\u524d\u9762\u3002<br \/> &nbsp;<\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right-width: 1px;border-right-style: solid;border-top-width: 1px;border-top-style: solid;background-image: initial;background-attachment: initial;border-left-width: 1px;border-left-style: solid;width: 673px;border-bottom-width: 1px;border-bottom-style: solid;background-position: initial initial;background-repeat: initial initial\">\n<tbody>\n<tr>\n<td>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\"><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\/**<br \/> * \u83b7\u5f97\u79ef\u5206\u5546\u57ce\u70ed\u95e8\u5546\u54c1<br \/> *<br \/> * @param&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $limit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u5217\u51fa\u6761\u6570<br \/> * @param&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ishot&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u662f\u5426\u53ea\u663e\u793a\u70ed\u9500<br \/> * @return array<br \/> *\/<br \/> function index_get_exchange($limit=3,$ishot=0)<br \/> {<br \/> &nbsp;&nbsp;&nbsp; \/* \u83b7\u5f97\u70ed\u95e8\u79ef\u5206\u5546\u54c1\u5217\u8868 *\/<br \/> $sql_ishot=$ishot ? &#8221; AND eg.is_hot=1 &#8221; : &#8220;&#8221;;<br \/> $sql = &#8216;SELECT g.goods_id, g.goods_name, g.goods_name_style, eg.exchange_integral, &#8216; .<br \/> &#8216; g.goods_type,g.goods_brief, g.goods_thumb, g.goods_img, eg.is_hot &#8216; .<br \/> &#8216; FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;exchange_goods&#8217;) . &#8216; AS eg LEFT JOIN &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g ON g.goods_id = eg.goods_id&nbsp; &#8216; .<br \/> &#8216; WHERE eg.is_exchange = 1 AND g.is_delete = 0 &#8216;. $sql_ishot .&#8217;&nbsp; limit &#8216;.$limit;<\/font><\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\"><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">$res = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);<br \/> &nbsp;&nbsp;&nbsp; $arr = array();<br \/> &nbsp;&nbsp; foreach($res AS $idx =&gt; $row)<br \/> &nbsp;&nbsp;&nbsp; {<br \/> $arr[$idx][&#8216;name&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $row[&#8216;goods_name&#8217;];<br \/> $arr[$idx][&#8216;goods_brief&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $row[&#8216;goods_brief&#8217;];<br \/> $arr[$idx][&#8216;goods_style_name&#8217;] = add_style($row[&#8216;goods_name&#8217;],$row[&#8216;goods_name_style&#8217;]);<br \/> $arr[$idx][&#8216;exchange_integral&#8217;] = $row[&#8216;exchange_integral&#8217;];<br \/> $arr[$idx][&#8216;type&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = $row[&#8216;goods_type&#8217;];<br \/> $arr[$idx][&#8216;goods_thumb&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = get_image_path($row[&#8216;goods_id&#8217;], $row[&#8216;goods_thumb&#8217;], true);<br \/> $arr[$idx][&#8216;goods_img&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = get_image_path($row[&#8216;goods_id&#8217;], $row[&#8216;goods_img&#8217;]);<br \/> $arr[$idx][&#8216;url&#8217;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = build_uri(&#8216;exchange_goods&#8217;, array(&#8216;gid&#8217;=&gt;$row[&#8216;goods_id&#8217;]), $row[&#8216;goods_name&#8217;]);<br \/> &nbsp;&nbsp;&nbsp; }<br \/> &nbsp;&nbsp;&nbsp; return $arr;<br \/> }<\/font><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u7136\u540e\u7ee7\u7eed\u5728 index.php \u6587\u4ef6\u4e2d \u627e\u5230 <\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;<\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;$smarty-&gt;assign(&#8216;shop_notice&#8217;,&nbsp;&nbsp;&nbsp;&nbsp; $_CFG[&#8216;shop_notice&#8217;]);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ \u5546\u5e97\u516c\u544a<\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;\u5728\u5b83\u4e0b\u8fb9\u53e6\u8d77\u4e00\u884c\u589e\u52a0\u5982\u4e0b\u4ee3\u7801<\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;$smarty-&gt;assign(&#8216;goods_exchange_list&#8217;,index_get_exchange(6,0));&nbsp; \/\/\u79ef\u5206\u5546\u57ce<\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;\u5982\u679c\u4f60\u60f3\u53ea\u663e\u793a\u70ed\u9500\u7684\u79ef\u5206\u5546\u54c1\uff0c\u53ea\u9700\u5c06\u4e0a\u9762\u4ee3\u7801\u7a0d\u4f5c\u4fee\u6539\u5373\u53ef<\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;$smarty-&gt;assign(&#8216;goods_exchange_list&#8217;,index_get_exchange(6,1));&nbsp; \/\/\u79ef\u5206\u5546\u57ce<\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\"> 2\uff09\u3001\u4e0b\u9762\u7ee7\u7eed\u4fee\u6539\u6a21\u677f\u6587\u4ef6 themes\/default\/index.dwt<\/p>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">\u5728\u4f60\u60f3\u663e\u793a\u79ef\u5206\u5546\u57ce\u5546\u54c1\u7684\u5730\u65b9\uff0c\u52a0\u5165\u4e0b\u9762\u4ee3\u7801\u6bb5<br \/> &nbsp;<\/p>\n<table cellspacing=\"0\" cellpadding=\"5\" style=\"border-right-width: 1px;border-right-style: solid;border-top-width: 1px;border-top-style: solid;background-image: initial;background-attachment: initial;border-left-width: 1px;border-left-style: solid;width: 673px;border-bottom-width: 1px;border-bottom-style: solid;background-position: initial initial;background-repeat: initial initial\">\n<tbody>\n<tr>\n<td><font style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&lt;!&#8211;\u79ef\u5206\u5546\u57ce\u5217\u8868&#8211;&gt;<br \/> &lt;div class=&#8221;box&#8221;&gt;<br \/> &nbsp;&lt;div class=&#8221;box_1&#8243;&gt;<br \/> &nbsp; &lt;h3&gt;&lt;span&gt;&lt;a href=&#8221;\/exchange.php&#8221; class=&#8221;f6&#8243;&gt;\u79ef\u5206\u5546\u57ce&lt;\/a&gt;&lt;\/span&gt;&lt;\/h3&gt;<br \/> &nbsp;&nbsp;&nbsp; &lt;div class=&#8221;centerPadd&#8221;&gt;<br \/> &nbsp;&nbsp;&nbsp; &lt;div class=&#8221;clearfix goodsBox&#8221; style=&#8221;border:none;&#8221;&gt;<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!&#8211;{foreach name=goods_exchange_list from=$goods_exchange_list item=exchange_goods}&#8211;&gt;<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=&#8221;goodsItem&#8221;&gt;<br \/> &nbsp;&nbsp;&lt;a href=&#8221;{$exchange_goods.url}&#8221; target=&#8221;_blank&#8221;&gt;&lt;img src=&#8221;{$exchange_goods.goods_thumb}&#8221; alt=&#8221;{$exchange_goods.goods_name}&#8221; class=&#8221;goodsimg&#8221; \/&gt;&lt;\/a&gt;&lt;br \/&gt;<br \/> &nbsp;&nbsp; &lt;p&gt;&lt;a href=&#8221;{$exchange_goods.url}&#8221; target=&#8221;_blank&#8221;&gt;<br \/> &nbsp;&nbsp;&lt;!&#8211; {if $exchange_goods.goods_style_name} &#8211;&gt;<br \/> &nbsp;&nbsp;&lt;font class=&#8221;f3&#8243;&gt;{$exchange_goods.goods_style_name}&lt;\/font&gt;&lt;br \/&gt;<br \/> &nbsp;&nbsp;&lt;!&#8211; {else} &#8211;&gt;<br \/> &nbsp;&nbsp;&lt;font class=&#8221;f3&#8243;&gt;{$exchange_goods.goods_name}&lt;\/font&gt;&lt;br \/&gt;<br \/> &nbsp;&nbsp;&lt;!&#8211; {\/if} &#8211;&gt;<br \/> &nbsp;&nbsp;&lt;\/a&gt;<br \/> &nbsp;&nbsp;&lt;\/p&gt;<br \/> {$lang.exchange_integral}&lt;font class=&#8221;price&#8221;&gt;{$exchange_goods.exchange_integral}&lt;\/font&gt;<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;\/div&gt;<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!&#8211;{\/foreach}&#8211;&gt;<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class=&#8221;more&#8221;&gt;&lt;a href=&#8221;\/exchange.php&#8221;&gt;&lt;img src=&#8221;images\/more.gif&#8221; \/&gt;&lt;\/a&gt;&lt;\/div&gt;<br \/> &nbsp;&nbsp;&nbsp; &lt;\/div&gt;<br \/> &nbsp;&nbsp;&nbsp; &lt;\/div&gt;<br \/> &nbsp;&lt;\/div&gt;<br \/> &lt;\/div&gt;<br \/> &lt;div class=&#8221;blank5&#8243;&gt;&lt;\/div&gt;<\/font><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-width: initial;border-color: initial;list-style-type: none;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px\">&nbsp;<\/p>\n<p> 3\uff09\u3001\u5230\u540e\u53f0\u6e05\u9664\u4e0b\u7f13\u5b58\uff0c\u7136\u540e\u5237\u65b0\u9996\u9875\u5c31\u80fd\u770b\u5230\u6548\u679c\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u4eca\u65e5\u770b\u5230ecshop&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-199123","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=199123"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199123\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}