{"id":199190,"date":"2025-05-03T14:02:30","date_gmt":"2025-05-03T06:02:30","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199190\/"},"modified":"2025-05-03T14:02:30","modified_gmt":"2025-05-03T06:02:30","slug":"ecshop%e4%b8%ad%e7%ba%a2%e5%8c%85%e7%bc%96%e7%a0%81%e7%94%9f%e6%88%90%e8%a7%84%e5%88%99%e5%88%86%e6%9e%90%e5%92%8c%e6%94%b9%e8%bf%9b","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199190\/","title":{"rendered":"ecshop\u4e2d\u7ea2\u5305\u7f16\u7801\u751f\u6210\u89c4\u5219\u5206\u6790\u548c\u6539\u8fdb"},"content":{"rendered":"<p>&nbsp;<span style=\"font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">\u6211\u4eec\u77e5\u9053\u5728<\/span><span style=\"font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">ecshop\u540e\u53f0<\/span><span style=\"font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">\u7684\u4fc3\u9500\u7ba1\u7406\u91cc\u9762\uff0c\u6709\u7ea2\u5305\u7684\u529f\u80fd\u3002<\/span><span style=\"font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">ecshop\u7ea2\u5305<\/span><span style=\"font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">\u7684\u529f\u80fd\u65e0\u975e\u5c31\u662f\u53ef\u4ee5\u76f4\u63a5\u62b5\u6d88\u73b0\u91d1\u7684\u4f5c\u7528\uff0cecshop\u7ea2\u5305\u6709\u4e24\u7c7b\u578b\uff0c\u4e00\u79cd\u662f\u76f4\u63a5\u53d1\u9001\u5230\u4e2a\u4eba\u5e10\u6237\u4e0a\u53bb\u7684\u3002\u5c31\u662f\u5b58\u50a8\u5728ecs_user_bonus\u8868\u4e2d\u7684\uff0c\u8fd9\u4e2a\u4e00\u65e6\u53d1\u9001\u5230\u5ba2\u6237\u7684\u5e10\u6237\u4e0a\u53bb\u3002\u90a3\u4e48\u610f\u5473\u7740\u522b\u4eba\u62ff\u5230\u4e86\u8fd9\u4e2a\u7f16\u7801\uff0c\u4e5f\u4e0d\u80fd\u4f7f\u7528\u8fd9\u4e2a\u7f16\u7801\u8fdb\u884c\u62b5\u6263\u3002\u53e6\u5916\u4e00\u79cdecshop\u7ea2\u5305\u5c31\u662f\u7ebf\u4e0b\u53d1\u9001\u7684\u3002\u5f53\u4f60\u5f97\u5230\u8fd9\u4e2a\u7f16\u7801\uff0c\u5728\u7ea2\u5305\u7684\u6709\u6548\u671f\u5185\uff0c\u53ef\u4ee5\u4f7f\u7528\u8be5\u7ea2\u5305\u3002<\/span><\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp;&nbsp; \u6211\u4eec\u5fc5\u987b\u77e5\u9053\uff0cecshop\u7684\u7ea2\u5305\u7f16\u7801\u662f\u6709\u95ee\u9898\u7684\u3002\u6211\u4eec\u770bflow.php<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp;&nbsp; if (((!empty($bonus) &amp;&amp; $bonus[&#8216;user_id&#8217;] == $_SESSION[&#8216;user_id&#8217;]) || ($bonus[&#8216;type_money&#8217;] &gt; 0 &amp;&amp; empty($bonus[&#8216;user_id&#8217;]))) &amp;&amp; $bonus[&#8216;order_id&#8217;] &lt;= 0)<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u8fd9\u4e00\u53e5\u8868\u793a\uff0c\u5c31\u7b97\u662f\u8be5\u7f16\u7801\u6ca1\u88ab\u4f7f\u7528\u3002\u53ea\u8981\u662f\u53d1\u5230\u4e2a\u4eba\u5e10\u6237\u53bb\u4e4b\u540e\u3002\u5373\u4f7f\u4f60\u767b\u9646\u4e86\uff0c\u4e5f\u4e0d\u80fd\u901a\u8fc7\u8fd9\u4e2a\u7f16\u7801\u6765\u8fdb\u884c\u4f7f\u7528\uff0c\u6240\u4ee5\u8fd9\u5c31\u662f\u4e00\u5927\u95ee\u9898\u3002<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u5176\u6b21\uff0c\u6211\u4eec\u770becshop\u7ea2\u5305\u7684\u7f16\u7801\u751f\u6210\u673a\u5236\u3002<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $num = $db-&gt;getOne(&#8220;SELECT MAX(bonus_sn) FROM &#8220;. $ecs-&gt;table(&#8216;user_bonus&#8217;));<br \/> &nbsp;&nbsp;&nbsp; $num = $num ? floor($num \/ 10000) : 100000;<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp; for ($i = 0, $j = 0; $i &lt; $bonus_sum; $i++)<br \/> &nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $bonus_sn = ($num + $i) . str_pad(mt_rand(0, 9999), 4, &#8216;0&#8217;, STR_PAD_LEFT);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $db-&gt;query(&#8220;INSERT INTO &#8220;.$ecs-&gt;table(&#8216;user_bonus&#8217;).&#8221; (bonus_type_id, bonus_sn) VALUES(&#8216;$bonus_typeid&#8217;, &#8216;$bonus_sn&#8217;)&#8221;);<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $j++;<br \/> &nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp;&nbsp; \u9996\u5148\u6211\u4eec\u770b\u6e05\u695a\uff0c\u5f53\u4f60\u7684\u7ea2\u5305\u7f16\u7801\u8fbe\u5230\u4e86\u51e0\u767e\u5b8c\u4ee5\u4e0a\uff0c\u5c31\u5bb9\u6613\u4ea7\u751f\u91cd\u590d\u7684\u7f16\u7801\u3002\u5176\u6b21\uff0c\u5728\u5f55\u5165\u7ea2\u5305\u7f16\u7801\u7684\u65f6\u5019\uff0c\u6839\u672c\u6ca1\u5224\u65ad\u662f\u5426\u6709\u91cd\u590d\u7684\u7ea2\u5305\uff0c\u8fd9\u5c31\u9020\u6210\u4e86\u5f88\u5927\u7684\u95ee\u9898\uff0c\u5982\u679c\u7ea2\u5305\u7f16\u7801\u91cd\u590d\uff0c\u90a3\u5c06\u662f\u975e\u5e38\u4e25\u91cd\u7684\u95ee\u9898<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp; $db-&gt;query(&#8220;INSERT INTO &#8220;.$ecs-&gt;table(&#8216;user_bonus&#8217;).&#8221; (bonus_type_id, bonus_sn) VALUES(&#8216;$bonus_typeid&#8217;, &#8216;$bonus_sn&#8217;)&#8221;);<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp; \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u9996\u5148\u6211\u4eec\u5fc5\u987b\u4fdd\u8bc1\u5728\u5f55\u5165\u7f16\u7801\u4e4b\u524d\uff0c\u786e\u4fdd\u8be5\u7f16\u7801\u6ca1\u91cd\u590d\uff0c\u6240\u4ee5\u5fc5\u987b\u5224\u65ad\u6570\u636e\u5e93\u4e2d\u662f\u5426\u6709\u8be5\u7f16\u7801\u3002\u90a3\u4e48\u6211\u4eec\u5c31\u5fc5\u987b\u5bf9bonus_sn \u6765\u8fdb\u884c\u626b\u63cf\u5224\u65ad\uff0c\u90a3\u4e48\u591a\u6570\u636e\u5982\u4f55\u63d0\u9ad8\u626b\u63cf\u901f\u5ea6\u5462\u3002\u6211\u4eec\u5fc5\u987b\u5728bonus_sn\u4e0a\u5efa\u7acb\u7d22\u5f15\u3002\u5176\u6b21\uff0c\u6211\u4eec\u53ef\u4ee5\u4fee\u6539\u7ea2\u5305\u7f16\u7801\u7684\u89c4\u5219\u3002\u65e2\u7136\u662f\u5341\u4f4d\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u7528\u6211\u4eec\u81ea\u5df1\u7684\u529e\u6cd5\u6765\u5f97\u5230\u3002<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp; static function GenSecret($len=6, $type=self::CHAR_WORD)<br \/> &nbsp;&nbsp;&nbsp; {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $secret = &#8221;;<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for ($i = 0; $i &lt; $len;&nbsp; $i++) {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( self::CHAR_NUM==$type ){<br \/> &nbsp;&nbsp;&nbsp;&nbsp;if (0==$i) {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$secret .= chr(rand(49, 57));<br \/> &nbsp;&nbsp;&nbsp;&nbsp;} else {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$secret .= chr(rand(48, 57));<br \/> &nbsp;&nbsp;&nbsp;&nbsp;}<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }else if ( self::CHAR_WORD==$type ){<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $secret .= chr(rand(65, 90));<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }else{<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( 0==$i ){<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $secret .= chr(rand(65, 90));<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $secret .= (0==rand(0,1))?chr(rand(65, 90)):chr(rand(48,57));<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $secret;<br \/> &nbsp;&nbsp;&nbsp; }<\/p>\n<p style=\"padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;font-family: Verdana, Arial, Tahoma;font-size: 14px;line-height: 25px\">&nbsp;&nbsp;&nbsp;\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u8981\u5f3a\u8fc7ecshop\u7ea2\u5305\u9ed8\u8ba4\u7684\u7f16\u7801\u89c4\u5219\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u6211\u4eec\u77e5\u9053\u5728ecsho&#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-199190","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199190","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=199190"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199190\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}