{"id":199281,"date":"2025-05-03T08:38:33","date_gmt":"2025-05-03T00:38:33","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199281\/"},"modified":"2025-05-03T08:38:33","modified_gmt":"2025-05-03T00:38:33","slug":"ecshop%e8%87%aa%e5%8a%a8%e6%8a%8a%e8%b5%a0%e5%93%81%e6%b7%bb%e5%8a%a0%e5%88%b0%e8%b4%ad%e7%89%a9%e8%bd%a6%e7%9a%84%e5%bc%80%e5%8f%91","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199281\/","title":{"rendered":"ecshop\u81ea\u52a8\u628a\u8d60\u54c1\u6dfb\u52a0\u5230\u8d2d\u7269\u8f66\u7684\u5f00\u53d1"},"content":{"rendered":"<p><span>&nbsp;<span style=\"font-family: \u5b8b\u4f53, Verdana, Arial;line-height: 21px;text-indent: 28px\">\u628a\u4ee5\u4e0b\u4ee3\u7801\u52a0\u5230flow.php\u6587\u4ef6\uff08165\u884c\uff09\uff0c$result[&#8216;confirm_type&#8217;] = !empty($_CFG[&#8216;cart_confirm&#8217;]) ? $_CFG[&#8216;cart_confirm&#8217;] : 2;\u7684\u4e0a\u9762<\/span><\/span><\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;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;font-family: \u5b8b\u4f53, Verdana, Arial;line-height: 21px;text-indent: 28px\"><span><br \/> &nbsp;&nbsp;&nbsp; \/* \u53d6\u5f97\u4f18\u60e0\u6d3b\u52a8 *\/<br \/> &nbsp;&nbsp;&nbsp; $favourable_list = favourable_list($_SESSION[&#8216;user_rank&#8217;]);<\/span><\/p>\n<p style=\"margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;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;font-family: \u5b8b\u4f53, Verdana, Arial;line-height: 21px;text-indent: 28px\"><span><br \/> &nbsp;\/\/ \u81ea\u52a8\u628a\u8d60\u54c1\u6dfb\u52a0\u5230\u8d2d\u7269\u8f66<br \/> &nbsp;foreach($favourable_list as $v)<br \/> &nbsp;{<br \/> if(!$v[&#8216;available&#8217;]) continue;<br \/> &nbsp;&nbsp;\/* \u53d6\u5f97\u4f18\u60e0\u6d3b\u52a8\u4fe1\u606f *\/<br \/> &nbsp;&nbsp;$act_id = $v[&#8216;act_id&#8217;];<br \/> &nbsp;&nbsp;$favourable = favourable_info($act_id);<br \/> &nbsp;<br \/> &nbsp;&nbsp;\/* \u68c0\u67e5\u8d2d\u7269\u8f66\u4e2d\u662f\u5426\u5df2\u6709\u8be5\u4f18\u60e0 *\/<br \/> &nbsp;&nbsp;$cart_favourable = cart_favourable();<br \/> &nbsp;&nbsp;if (favourable_used($favourable, $cart_favourable))<br \/> &nbsp;&nbsp;{<br \/> &nbsp;&nbsp;&nbsp;continue;<br \/> &nbsp;&nbsp;}<br \/> &nbsp;&nbsp;$gift = array();<br \/> &nbsp;&nbsp;foreach($v[&#8216;gift&#8217;] as $g)<br \/> &nbsp;&nbsp;{<br \/> &nbsp;&nbsp;&nbsp;$gift[] = $g[&#8216;id&#8217;];<br \/> &nbsp;&nbsp;}<br \/> &nbsp;&nbsp;<br \/> &nbsp;&nbsp;\/* \u8d60\u54c1\uff08\u7279\u60e0\u54c1\uff09\u4f18\u60e0 *\/<br \/> &nbsp;&nbsp;if ($favourable[&#8216;act_type&#8217;] == FAT_GOODS)<br \/> &nbsp;&nbsp;{<br \/> &nbsp;&nbsp;&nbsp;\/* \u68c0\u67e5\u662f\u5426\u5df2\u5728\u8d2d\u7269\u8f66 *\/<br \/> &nbsp;&nbsp;&nbsp;$sql = &#8220;SELECT goods_name&#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8221; FROM &#8221; . $ecs-&gt;table(&#8216;cart&#8217;) .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8221; WHERE session_id = &#8216;&#8221; . SESS_ID . &#8220;&#8216;&#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8221; AND rec_type = &#8216;&#8221; . CART_GENERAL_GOODS . &#8220;&#8216;&#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8221; AND is_gift = &#8216;$act_id'&#8221; .<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8221; AND goods_id &#8221; . db_create_in($gift);<br \/> &nbsp;&nbsp;&nbsp;$gift_name = $db-&gt;getCol($sql);<br \/> &nbsp;&nbsp;&nbsp;if (!empty($gift_name))<br \/> &nbsp;&nbsp;&nbsp;{<br \/> &nbsp;&nbsp;&nbsp;&nbsp;continue;<br \/> &nbsp;&nbsp;&nbsp;}<br \/> &nbsp;<br \/> &nbsp;&nbsp;&nbsp;\/* \u68c0\u67e5\u6570\u91cf\u662f\u5426\u8d85\u8fc7\u4e0a\u9650 *\/<br \/> &nbsp;&nbsp;&nbsp;$count = isset($cart_favourable[$act_id]) ? $cart_favourable[$act_id] : 0;<br \/> &nbsp;&nbsp;&nbsp;if ($favourable[&#8216;act_type_ext&#8217;] &gt; 0 &amp;&amp; $count + count($gift) &gt; $favourable[&#8216;act_type_ext&#8217;])<br \/> &nbsp;&nbsp;&nbsp;{<br \/> &nbsp;&nbsp;&nbsp;&nbsp;continue;<br \/> &nbsp;&nbsp;&nbsp;}<br \/> &nbsp;<br \/> &nbsp;&nbsp;&nbsp;\/* \u6dfb\u52a0\u8d60\u54c1\u5230\u8d2d\u7269\u8f66 *\/<br \/> &nbsp;&nbsp;&nbsp;foreach ($favourable[&#8216;gift&#8217;] as $g)<br \/> &nbsp;&nbsp;&nbsp;{<br \/> &nbsp;&nbsp;&nbsp;&nbsp;add_gift_to_cart($act_id, $g[&#8216;id&#8217;], $g[&#8216;price&#8217;]);<br \/> &nbsp;&nbsp;&nbsp;}<br \/> &nbsp;&nbsp;}<br \/> &nbsp;}<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u628a\u4ee5\u4e0b\u4ee3\u7801\u52a0\u5230flo&#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-199281","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199281","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=199281"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199281\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}