{"id":199419,"date":"2025-05-03T08:53:31","date_gmt":"2025-05-03T00:53:31","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199419\/"},"modified":"2025-05-03T08:53:31","modified_gmt":"2025-05-03T00:53:31","slug":"%e4%bf%ae%e6%ad%a3ecshop%e5%90%8e%e5%8f%b0%e8%ae%a2%e5%8d%95%e7%bb%9f%e8%ae%a1%e6%95%b0%e6%8d%ae%e4%b8%8d%e5%87%86%e7%a1%ae","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199419\/","title":{"rendered":"\u4fee\u6b63Ecshop\u540e\u53f0\u8ba2\u5355\u7edf\u8ba1\u6570\u636e\u4e0d\u51c6\u786e"},"content":{"rendered":"<p>Ecshop\u672c\u8eab\u6e90\u7801\u5199\u5f97\u5c31\u6709\u95ee\u9898\u3002\u6253\u5f00order_status.php\u6587\u4ef6\uff0c\u7ffb\u5230\u6700\u4e0b\u65b9\uff0c\u770bfunction get_orderinfo($start_date, $end_date)\u7684\u5b9a\u4e49\uff0c\u5176\u4e2d\u6240\u6709\u7684sql\u90fd\u7528\u4e86\u4e0b\u9762\u7684\u4ee3\u7801\uff1a   &nbsp;   &nbsp;function get_orderinfo($start_date, $end_date)   &nbsp;{   &nbsp; &nbsp; $order_info = array();   &nbsp;   &nbsp; &nbsp; \/* \u672a\u786e\u8ba4\u8ba2\u5355\u6570 *\/   &nbsp; &nbsp; $sql = &#8216;SELECT COUNT(*) AS unconfirmed_num FROM &#8216; .$GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;order_info&#8217;).   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8221; WHERE order_status = &#8216;&#8221; .OS_UNCONFIRMED. &#8220;&#8216; AND add_time &gt;= &#8216;$start_date'&#8221;.   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8221; AND add_time &lt; &#8216;&#8221; . ($end_date + 86400) . &#8220;&#8216;&#8221;;&nbsp;   \u5f88\u663e\u7136\uff0c\u8fd9\u91cc\u6709\u4e2a\u5f88\u660e\u663e\u7684\u903b\u8f91\u9519\u8bef\uff0c\u5373$end_date+86400\uff0c\u9664\u975e\u8fd9\u91cc\u7528\u6237\u9009\u62e9\u7684\u5f00\u59cb\u65f6\u95f4\u548c\u7ed3\u675f\u65f6\u95f4\u662f\u540c\u4e00\u5929\uff0c\u5426\u5219\u6ca1\u6709\u5fc5\u8981\u52a0\u4e0a86400(86400\u79d2\u7b49\u4e8e1\u5929)\uff0c\u8fd9\u4e2a\u9519\u8bef\u7ed3\u679c\u4f1a\u5bfc\u81f4\u6700\u540e\u7684\u8ba2\u5355\u7edf\u8ba1\u6570\u91cf\u5df2\u7ecf\u4e0d\u662f\u5728\u6307\u5b9a\u65f6\u95f4\u6bb5\u5185\u7684\u6570\u636e\uff0c\u800c\u662f\u6307\u5b9a\u7684\u65f6\u95f4\u540e\u518d\u52a0\u4e0a\u4e00\u5929\u3002   &nbsp;   &nbsp;   \u5c06\u65e0\u7528\u7684\u5df2\u786e\u8ba4\u8ba2\u5355\u7edf\u8ba1\u4ee3\u7801\u6539\u6210\u5df2\u652f\u4ed8\u7684\u7edf\u8ba1\u4ee3\u7801\uff1a   &nbsp;   \/* \u5df2\u786e\u8ba4\u8ba2\u5355\u6570 *\/   &nbsp; &nbsp; $sql = &#8216;SELECT COUNT(*) AS confirmed_num FROM &#8216; .$GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;order_info&#8217;).   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8221; WHERE order_status = &#8216;&#8221; .OS_CONFIRMED. &#8220;&#8216; AND shipping_status NOT &#8220;. db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . &#8221; AND pay_status NOT&#8221; . db_create_in(array(PS_PAYED, PS_PAYING)) .&#8221; AND add_time &gt;= &#8216;$start_date'&#8221;.   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8221; AND add_time &lt; &#8216;&#8221; . ($end_date + 86400) . &#8220;&#8216;&#8221;;   &nbsp; &nbsp; $order_info[&#8216;confirmed_num&#8217;] = $GLOBALS[&#8216;db&#8217;]-&gt;getOne($sql);   \u6539\u6210\uff1a   &nbsp;   \/* by ldhost.cn \u5df2\u652f\u4ed8\u8ba2\u5355\u6570 *\/   &nbsp; &nbsp; $sql = &#8216;SELECT COUNT(*) AS confirmed_num FROM &#8216; .$GLOBALS[&#8216;ecs&#8217;]-&gt;table(&#8216;order_info&#8217;).   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8221; WHERE pay_status =&#8221; . PS_PAYED .&#8221; AND shipping_status NOT&#8221; . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) .&#8221; AND add_time &gt;= &#8216;$start_date'&#8221;.   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8221; AND add_time &lt; $end_date&#8221;;   &nbsp; &nbsp; $order_info[&#8216;confirmed_num&#8217;] = $GLOBALS[&#8216;db&#8217;]-&gt;getOne($sql);   &nbsp;  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ecshop\u672c\u8eab\u6e90\u7801\u5199\u5f97\u5c31\u6709\u95ee\u9898&#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-199419","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199419","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=199419"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199419\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}