{"id":199421,"date":"2025-05-03T13:00:22","date_gmt":"2025-05-03T05:00:22","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199421\/"},"modified":"2025-05-03T13:00:22","modified_gmt":"2025-05-03T05:00:22","slug":"%e4%bc%98%e5%8c%96ecshop%e5%8a%a0%e5%bf%abecshop%e9%a6%96%e9%a1%b5%e8%ae%bf%e9%97%ae%e9%80%9f%e5%ba%a6","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199421\/","title":{"rendered":"\u4f18\u5316ecshop\u52a0\u5febecshop\u9996\u9875\u8bbf\u95ee\u901f\u5ea6"},"content":{"rendered":"<p>\u5047\u5982ECshop\u7684\u4ea7\u54c1\u6570\u5230\u8fbe\u51e0\u4e07\uff0c\u5341\u51e0\u4e07\u7684\u65f6\u5206\uff0c\u5047\u5982\u4e3b\u9875\u6ca1\u6709\u7f13\u5b58\uff0c\u521d\u6b21\u62dc\u8bbf\u7684\u65f6\u5206\uff0c\u4f60\u4f1a\u53d1\u73b0\u5176\u6162\u65e0\u6bd4\uff0c\u7f18\u7531\u5373\u662f\u6e05\u7a7a\u4e86Cache\u540e\u6216\u8bb8\u6ca1\u6709Cache\u7684\u60c5\u51b5\u4e0b\uff0cECshop\u4f1aBulid\u4e00\u4e9bCache\u6570\u636e\uff0c\u81f4\u4f7f\u62dc\u8bbf\u5f88\u6162\uff0c\u4f46\u54b1\u4eec\u6709\u65f6\u5206\u540e\u53f0\u4fee\u6539\u7c7b\u76ee\u6216\u8bb8\u522b\u7684\u7684\uff0c\u7ecf\u5e38\u4f1a\u89e6\u53d1\u6e05\u7a7aCache\uff0c\u6240\u4ee5\u4e3b\u9875\u521d\u6b21\u62dc\u8bbf\u4e5f\u6210\u4e86\u7591\u95ee\u3002   \u5728\u5927\u6570\u636e\u91cf\u7684\u60c5\u51b5\u4e0b\uff0c\u5f71\u54cd\u4e3b\u9875\u901f\u5ea6\u6700\u5927\u7684\u5373\u662f\u5f15\u8350\u7684Best\u3001Hot\u3001New Item\u7684\u6570\u636eBulid\uff0c\u5b83\u4f1a\u628a\u4e00\u5207\u7684\u590d\u5408\u6761\u4ef6\u7684\u4ea7\u54c1\u90fd\u4f1a\u8bfb\u4e00\u904d\uff0c\u7136\u540e\u5b58\u5230\/temp\/static_caches\/recommend_goods.php\u8fd9\u4e2a\u6587\u4ef6\u4e0b\uff0c\u6709\u65f6\u5206\u4f1a\u5230\u8fbe10M\u6216\u8bb8\u6570\u5341M\uff0c\u672c\u6765\u54b1\u4eec\u5e76\u4e0d\u9700\u8981\u4e00\u5207\u7684\u4ea7\u54c1\u90fdBulid\u8fdb\u5165\uff0c\u7531\u4e8e\u8fd9\u4e2a\u7f13\u5b58\u53ea\u7528\u5728\u4e3b\u9875\u548cCategory\u9875\u7684\u8c03\u7528\uff0c\u6709\u70b9\u7cdf\u8e4b\u3002\uff08P.S \u7531\u4e8eCategory\u62dc\u8bbf\u672c\u6765\u5c31\u6bd4\u8f83\u6162\uff0c\u6240\u4ee5\u6211\u628a\u7545\u9500\u4ea7\u54c1\u5728Category\u7684\u5c55\u73b0\u5c4f\u853d\u4e86\uff0c\u6240\u4ee5\u53ea\u5269\u4e3b\u9875\u8c03\u7528\uff09   \u4e3b\u9875\u5c55\u73b0\u7684\u65f6\u5206\uff0c\u4e09\u79cd\u7c7b\u578bBest\u3001Hot\u3001New\u53ea\u5c55\u73b010\u4e2a\u4ea7\u54c1\uff08\u6211\u6ca1\u6709\u6311\u9009\u5c55\u73b0\u591a\u4e2a\u7c7b\u76ee\uff09\uff0c\u6240\u4ee5\u8fd9\u4e2a\u4e0a\u9762\u6709\u5f88\u5927\u7684\u4f18\u5316\u7a7a\u95f4\u3002   \u7ffb\u5f00include\u76ee\u5f55\u4e0b\u7684lib_goods.php\u6587\u4ef6\uff0c\u627e\u5230function get_recommend_goods() \u51fd\u6570\uff0c\u521d\u59cb\u7684\u5927\u6982\u662f   [php]   function get_recommend_goods($type = &#8221;, $cats = &#8221;)   {   if (!in_array($type, array(&#8216;best&#8217;, &#8216;new&#8217;, &#8216;hot&#8217;)))   {   return array();   }   &nbsp;   \/\/\u53d6\u4e0d\u540c\u63a8\u8350\u5bf9\u5e94\u7684\u5546\u54c1   static $type_goods = array();   if (empty($type_goods[$type]))   {   \/\/\u521d\u59cb\u5316\u6570\u636e   $type_goods[&#8216;best&#8217;] = array();   $type_goods[&#8216;new&#8217;] = array();   $type_goods[&#8216;hot&#8217;] = array();   $data = read_static_cache(&#8216;recommend_goods&#8217;);   if ($data === false)   {   $sql = &#8216;SELECT g.goods_id, g.is_best, g.is_new, g.is_hot, g.is_promote, b.brand_name,g.sort_order &#8216; .   &#8216; FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .   &#8216; LEFT JOIN &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;brand&#8217;) . &#8216; AS b ON b.brand_id = g.brand_id &#8216; .   &#8216; WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND (g.is_best = 1 OR g.is_new =1 OR g.is_hot = 1)&#8217;.   &#8216; ORDER BY g.sort_order, g.last_update DESC&#8217;;   $goods_res = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);   \/\/\u5b9a\u4e49\u63a8\u8350,\u6700\u65b0\uff0c\u70ed\u95e8\uff0c\u4fc3\u9500\u5546\u54c1   $goods_data[&#8216;best&#8217;] = array();   $goods_data[&#8216;new&#8217;] = array();   $goods_data[&#8216;hot&#8217;] = array();   $goods_data[&#8216;brand&#8217;] = array();   if (!empty($goods_res))   {   foreach($goods_res as $data)   {   if ($data[&#8216;is_best&#8217;] == 1)   {   $goods_data[&#8216;best&#8217;][] = array(&#8216;goods_id&#8217; =&gt; $data[&#8216;goods_id&#8217;], &#8216;sort_order&#8217; =&gt; $data[&#8216;sort_order&#8217;]);   }   if ($data[&#8216;is_new&#8217;] == 1)   {   $goods_data[&#8216;new&#8217;][] = array(&#8216;goods_id&#8217; =&gt; $data[&#8216;goods_id&#8217;], &#8216;sort_order&#8217; =&gt; $data[&#8216;sort_order&#8217;]);   }   if ($data[&#8216;is_hot&#8217;] == 1)   {   $goods_data[&#8216;hot&#8217;][] = array(&#8216;goods_id&#8217; =&gt; $data[&#8216;goods_id&#8217;], &#8216;sort_order&#8217; =&gt; $data[&#8216;sort_order&#8217;]);   }   if ($data[&#8216;brand_name&#8217;] != &#8221;)   {   $goods_data[&#8216;brand&#8217;][$data[&#8216;goods_id&#8217;]] = $data[&#8216;brand_name&#8217;];   }   }   }   write_static_cache(&#8216;recommend_goods&#8217;, $goods_data);   }   else   {   $goods_data = $data;   }   &nbsp;   $time = gmtime();   $order_type = $GLOBALS[&#8216;_CFG&#8217;][&#8216;recommend_order&#8217;];   &nbsp;   \/\/\u6309\u63a8\u8350\u6570\u91cf\u53ca\u6392\u5e8f\u53d6\u6bcf\u4e00\u9879\u63a8\u8350\u663e\u793a\u7684\u5546\u54c1 order_type\u53ef\u4ee5\u6839\u636e\u540e\u53f0\u8bbe\u5b9a\u8fdb\u884c\u5404\u79cd\u6761\u4ef6\u663e\u793a   static $type_array = array();   $type2lib = array(&#8216;best&#8217;=&gt;&#8217;recommend_best&#8217;, &#8216;new&#8217;=&gt;&#8217;recommend_new&#8217;, &#8216;hot&#8217;=&gt;&#8217;recommend_hot&#8217;);   if (empty($type_array))   {   foreach($type2lib as $key =&gt; $data)   {   if (!empty($goods_data[$key]))   {   $num = get_library_number($data);   $data_count = count($goods_data[$key]);   $num = $data_count &gt; $num ? $num : $data_count;   if ($order_type == 0)   {   \/\/usort($goods_data[$key], &#8216;goods_sort&#8217;);   $rand_key = array_slice($goods_data[$key], 0, $num);   foreach($rand_key as $key_data)   {   $type_array[$key][] = $key_data[&#8216;goods_id&#8217;];   }   }   else   {   $rand_key = array_rand($goods_data[$key], $num);   if ($num == 1)   {   $type_array[$key][] = $goods_data[$key][$rand_key][&#8216;goods_id&#8217;];   }   else   {   foreach($rand_key as $key_data)   {   $type_array[$key][] = $goods_data[$key][$key_data][&#8216;goods_id&#8217;];   }   }   }   }   else   {   $type_array[$key] = array();   }   }   }   &nbsp;   \/\/\u53d6\u51fa\u6240\u6709\u7b26\u5408\u6761\u4ef6\u7684\u5546\u54c1\u6570\u636e\uff0c\u5e76\u5c06\u7ed3\u679c\u5b58\u5165\u5bf9\u5e94\u7684\u63a8\u8350\u7c7b\u578b\u6570\u7ec4\u4e2d   $sql = &#8216;SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, &#8216; .   &#8220;IFNULL(mp.user_price, g.shop_price * &#8216;$_SESSION[discount]&#8217;) AS shop_price, &#8220;.   &#8220;promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd &#8221; .   &#8216;FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .   &#8220;LEFT JOIN &#8221; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;member_price&#8217;) . &#8221; AS mp &#8220;.   &#8220;ON mp.goods_id = g.goods_id AND mp.user_rank = &#8216;$_SESSION[user_rank]&#8217; &#8220;;   $type_merge = array_merge($type_array[&#8216;new&#8217;], $type_array[&#8216;best&#8217;], $type_array[&#8216;hot&#8217;]);   $type_merge = array_unique($type_merge);   $sql .= &#8216; WHERE g.goods_id &#8216; . db_create_in($type_merge);   $sql .= &#8216; ORDER BY g.sort_order, g.last_update DESC&#8217;;   &nbsp;   $result = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);   foreach ($result AS $idx =&gt; $row)   {   if ($row[&#8216;promote_price&#8217;] &gt; 0)   {   $promote_price = bargain_price($row[&#8216;promote_price&#8217;], $row[&#8216;promote_start_date&#8217;], $row[&#8216;promote_end_date&#8217;]);   $goods[$idx][&#8216;promote_price&#8217;] = $promote_price &gt; 0 ? price_format($promote_price) : &#8221;;   }   else   {   $goods[$idx][&#8216;promote_price&#8217;] = &#8221;;   }   &nbsp;   $goods[$idx][&#8216;id&#8217;] = $row[&#8216;goods_id&#8217;];   $goods[$idx][&#8216;name&#8217;] = $row[&#8216;goods_name&#8217;];   $goods[$idx][&#8216;brief&#8217;] = $row[&#8216;goods_brief&#8217;];   $goods[$idx][&#8216;brand_name&#8217;] = isset($goods_data[&#8216;brand&#8217;][$row[&#8216;goods_id&#8217;]]) ? $goods_data[&#8216;brand&#8217;][$row[&#8216;goods_id&#8217;]] : &#8221;;   $goods[$idx][&#8216;goods_style_name&#8217;] = add_style($row[&#8216;goods_name&#8217;],$row[&#8216;goods_name_style&#8217;]);   &nbsp;   $goods[$idx][&#8216;short_name&#8217;] = $GLOBALS[&#8216;_CFG&#8217;][&#8216;goods_name_length&#8217;] &gt; 0 ?   sub_str($row[&#8216;goods_name&#8217;], $GLOBALS[&#8216;_CFG&#8217;][&#8216;goods_name_length&#8217;]) : $row[&#8216;goods_name&#8217;];   $goods[$idx][&#8216;short_style_name&#8217;] = add_style($goods[$idx][&#8216;short_name&#8217;],$row[&#8216;goods_name_style&#8217;]);   $goods[$idx][&#8216;market_price&#8217;] = price_format($row[&#8216;market_price&#8217;]);   $goods[$idx][&#8216;shop_price&#8217;] = price_format($row[&#8216;shop_price&#8217;]);   $goods[$idx][&#8216;thumb&#8217;] = get_image_path($row[&#8216;goods_id&#8217;], $row[&#8216;goods_thumb&#8217;], true);   $goods[$idx][&#8216;goods_img&#8217;] = get_image_path($row[&#8216;goods_id&#8217;], $row[&#8216;goods_img&#8217;]);   $goods[$idx][&#8216;url&#8217;] = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217; =&gt; $row[&#8216;goods_id&#8217;]), $row[&#8216;goods_name&#8217;]);   if (in_array($row[&#8216;goods_id&#8217;], $type_array[&#8216;best&#8217;]))   {   $type_goods[&#8216;best&#8217;][] = $goods[$idx];   }   if (in_array($row[&#8216;goods_id&#8217;], $type_array[&#8216;new&#8217;]))   {   $type_goods[&#8216;new&#8217;][] = $goods[$idx];   }   if (in_array($row[&#8216;goods_id&#8217;], $type_array[&#8216;hot&#8217;]))   {   $type_goods[&#8216;hot&#8217;][] = $goods[$idx];   }   }   }   return $type_goods[$type];   }   [\/php]   \u6211\u4eec\u601d\u8def\u5c31\u662f\u4e0d\u8bfb\u53d6\u6240\u6709\u7684\u5546\u54c1\u4fe1\u606f\uff0c\u800c\u662fBest\u3001Hot\u3001New\u591f\u7528\u5c55\u793a\u5c31\u884c\u4e86\uff0c\u6240\u4ee5\u628a\u4ee3\u7801\u8c03\u6574\u4e86\u4e00\u4e0b\uff0c\u9650\u5236\u4e86Bulid\u7684\u5546\u54c1\u6570\uff0c\u53bb\u6389\u4e86\u4e00\u4e9b\u6211\u4e0d\u9700\u8981\u7684Join\u8868\uff0c\u5f53\u7136\u5927\u5bb6\u4e0d\u4e00\u5b9a\u8981\u7167\u7740\u6211\u505a\uff0c\u6211\u8bb2\u7684\u90fd\u662f\u601d\u8def\uff0c\u770b\u81ea\u5df1\u7684\u5b9e\u9645\u60c5\u51b5\uff0c\u8981\u6709\u70b9\u7a0b\u5e8f\u57fa\u672c\u529f\u3002   &nbsp;   \u66f4\u6539\u540e\u7684\u4ee3\u7801\u5982\u4e0b\uff1a   &nbsp;   [php]   function get_recommend_goods($type = &#8221;, $cats = &#8221;)   {   if (!in_array($type, array(&#8216;best&#8217;, &#8216;new&#8217;, &#8216;hot&#8217;)))   {   return array();   }   &nbsp;   \/\/\u53d6\u4e0d\u540c\u63a8\u8350\u5bf9\u5e94\u7684\u5546\u54c1   static $type_goods = array();   if (empty($type_goods[$type]))   {   \/\/\u521d\u59cb\u5316\u6570\u636e   $type_goods[&#8216;best&#8217;] = array();   $type_goods[&#8216;new&#8217;] = array();   $type_goods[&#8216;hot&#8217;] = array();   $data = read_static_cache(&#8216;recommend_goods&#8217;);   if ($data === false)   {   $sql = &#8216;SELECT g.goods_id, g.sort_order &#8216; .   &#8216; FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .   &#8216; WHERE (g.is_best = 1)&#8217;.   &#8216; ORDER BY g.goods_number DESC limit 50&#8217;;   $goods_res = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);   $goods_data[&#8216;best&#8217;] = array();   &nbsp;   if (!empty($goods_res))   {   foreach($goods_res as $data)   {   $goods_data[&#8216;best&#8217;][] = array(&#8216;goods_id&#8217; =&gt; $data[&#8216;goods_id&#8217;], &#8216;sort_order&#8217; =&gt; $data[&#8216;sort_order&#8217;]);   }   }   &nbsp;   $sql = &#8216;SELECT g.goods_id, g.sort_order &#8216; .   &#8216; FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .   &#8216; WHERE (g.is_new = 1 and g.is_best = 0 and g.is_hot = 0)&#8217;.   &#8216; ORDER BY g.goods_id DESC limit 50&#8217;;   $goods_res = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);   $goods_data[&#8216;new&#8217;] = array();   &nbsp;   if (!empty($goods_res))   {   foreach($goods_res as $data)   {   $goods_data[&#8216;new&#8217;][] = array(&#8216;goods_id&#8217; =&gt; $data[&#8216;goods_id&#8217;], &#8216;sort_order&#8217; =&gt; $data[&#8216;sort_order&#8217;]);   }   }   &nbsp;   $sql = &#8216;SELECT g.goods_id, g.sort_order &#8216; .   &#8216; FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .   &#8216; WHERE (g.is_hot = 1 and g.is_best = 0)&#8217;.   &#8216; ORDER BY g.goods_number DESC limit 50&#8217;;   $goods_res = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);   $goods_data[&#8216;hot&#8217;] = array();   &nbsp;   if (!empty($goods_res))   {   foreach($goods_res as $data)   {   $goods_data[&#8216;hot&#8217;][] = array(&#8216;goods_id&#8217; =&gt; $data[&#8216;goods_id&#8217;], &#8216;sort_order&#8217; =&gt; $data[&#8216;sort_order&#8217;]);   }   }   &nbsp;   write_static_cache(&#8216;recommend_goods&#8217;, $goods_data);   }   else   {   $goods_data = $data;   }   &nbsp;   $time = gmtime();   $order_type = $GLOBALS[&#8216;_CFG&#8217;][&#8216;recommend_order&#8217;];   &nbsp;   \/\/\u6309\u63a8\u8350\u6570\u91cf\u53ca\u6392\u5e8f\u53d6\u6bcf\u4e00\u9879\u63a8\u8350\u663e\u793a\u7684\u5546\u54c1 order_type\u53ef\u4ee5\u6839\u636e\u540e\u53f0\u8bbe\u5b9a\u8fdb\u884c\u5404\u79cd\u6761\u4ef6\u663e\u793a   static $type_array = array();   $type2lib = array(&#8216;best&#8217;=&gt;&#8217;recommend_best&#8217;, &#8216;new&#8217;=&gt;&#8217;recommend_new&#8217;, &#8216;hot&#8217;=&gt;&#8217;recommend_hot&#8217;);   if (empty($type_array))   {   foreach($type2lib as $key =&gt; $data)   {   if (!empty($goods_data[$key]))   {   $num = get_library_number($data);   $data_count = count($goods_data[$key]);   $num = $data_count &gt; $num ? $num : $data_count;   if ($order_type == 0)   {   \/\/usort($goods_data[$key], &#8216;goods_sort&#8217;);   $rand_key = array_slice($goods_data[$key], 0, $num);   foreach($rand_key as $key_data)   {   $type_array[$key][] = $key_data[&#8216;goods_id&#8217;];   }   }   else   {   $rand_key = array_rand($goods_data[$key], $num);   if ($num == 1)   {   $type_array[$key][] = $goods_data[$key][$rand_key][&#8216;goods_id&#8217;];   }   else   {   foreach($rand_key as $key_data)   {   $type_array[$key][] = $goods_data[$key][$key_data][&#8216;goods_id&#8217;];   }   }   }   }   else   {   $type_array[$key] = array();   }   }   }   &nbsp;   \/\/\u53d6\u51fa\u6240\u6709\u7b26\u5408\u6761\u4ef6\u7684\u5546\u54c1\u6570\u636e\uff0c\u5e76\u5c06\u7ed3\u679c\u5b58\u5165\u5bf9\u5e94\u7684\u63a8\u8350\u7c7b\u578b\u6570\u7ec4\u4e2d   $sql = &#8216;SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, g.shop_price, &#8216; .   &#8220;promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd &#8221; .   &#8216;FROM &#8216; . $GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;goods&#8217;) . &#8216; AS g &#8216; .   &#8221; &#8220;;   $type_merge = array_merge($type_array[&#8216;new&#8217;], $type_array[&#8216;best&#8217;], $type_array[&#8216;hot&#8217;]);   $type_merge = array_unique($type_merge);   $sql .= &#8216; WHERE g.goods_id &#8216; . db_create_in($type_merge);   $sql .= &#8216; ORDER BY g.goods_number DESC&#8217;;   &nbsp;   $result = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);   foreach ($result AS $idx =&gt; $row)   {   if ($row[&#8216;promote_price&#8217;] &gt; 0)   {   $promote_price = bargain_price($row[&#8216;promote_price&#8217;], $row[&#8216;promote_start_date&#8217;], $row[&#8216;promote_end_date&#8217;]);   $goods[$idx][&#8216;promote_price&#8217;] = $promote_price &gt; 0 ? price_format($promote_price) : &#8221;;   }   else   {   $goods[$idx][&#8216;promote_price&#8217;] = &#8221;;   }   &nbsp;   $goods[$idx][&#8216;id&#8217;] = $row[&#8216;goods_id&#8217;];   $goods[$idx][&#8216;name&#8217;] = $row[&#8216;goods_name&#8217;];   $goods[$idx][&#8216;brief&#8217;] = $row[&#8216;goods_brief&#8217;];   $goods[$idx][&#8216;brand_name&#8217;] = isset($goods_data[&#8216;brand&#8217;][$row[&#8216;goods_id&#8217;]]) ? $goods_data[&#8216;brand&#8217;][$row[&#8216;goods_id&#8217;]] : &#8221;;   $goods[$idx][&#8216;goods_style_name&#8217;] = add_style($row[&#8216;goods_name&#8217;],$row[&#8216;goods_name_style&#8217;]);   &nbsp;   $goods[$idx][&#8216;short_name&#8217;] = $GLOBALS[&#8216;_CFG&#8217;][&#8216;goods_name_length&#8217;] &gt; 0 ?   sub_str($row[&#8216;goods_name&#8217;], $GLOBALS[&#8216;_CFG&#8217;][&#8216;goods_name_length&#8217;]) : $row[&#8216;goods_name&#8217;];   $goods[$idx][&#8216;short_style_name&#8217;] = add_style($goods[$idx][&#8216;short_name&#8217;],$row[&#8216;goods_name_style&#8217;]);   $goods[$idx][&#8216;market_price&#8217;] = price_format($row[&#8216;market_price&#8217;]);   $goods[$idx][&#8216;shop_price&#8217;] = price_format($row[&#8216;shop_price&#8217;]);   $goods[$idx][&#8216;thumb&#8217;] = get_image_path($row[&#8216;goods_id&#8217;], $row[&#8216;goods_thumb&#8217;], true);   $goods[$idx][&#8216;goods_img&#8217;] = get_image_path($row[&#8216;goods_id&#8217;], $row[&#8216;goods_img&#8217;]);   $goods[$idx][&#8216;url&#8217;] = build_uri(&#8216;goods&#8217;, array(&#8216;gid&#8217; =&gt; $row[&#8216;goods_id&#8217;]), $row[&#8216;goods_name&#8217;]);   if (in_array($row[&#8216;goods_id&#8217;], $type_array[&#8216;best&#8217;]))   {   $type_goods[&#8216;best&#8217;][] = $goods[$idx];   }   if (in_array($row[&#8216;goods_id&#8217;], $type_array[&#8216;new&#8217;]))   {   $type_goods[&#8216;new&#8217;][] = $goods[$idx];   }   if (in_array($row[&#8216;goods_id&#8217;], $type_array[&#8216;hot&#8217;]))   {   $type_goods[&#8216;hot&#8217;][] = $goods[$idx];   }   }   }   return $type_goods[$type];   }   [\/php]   \u8fd9\u6837\u6539\u4e86\u4ee5\u540e\uff0cBulid\u7684\u9759\u6001\u6587\u4ef6\u5e94\u8be5\u53ea\u670913K\u5de6\u53f3\uff0c\u901f\u5ea6\u5927\u5927\u52a0\u5feb\u3002  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5047\u5982ECshop\u7684\u4ea7\u54c1\u6570\u5230\u8fbe\u51e0\u4e07&#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-199421","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199421","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=199421"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199421\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}