stanley-king 3 年之前
父節點
當前提交
8fdc9876f6
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      mchsrv/control/merchant_refill.php

+ 9 - 1
mchsrv/control/merchant_refill.php

@@ -95,11 +95,12 @@ class merchant_refillControl extends mbMerchantControl
             else
             {
                 Log::record("no = {$no}",Log::DEBUG);
+                $mch_order = $this->make_sn();
                 $params = [ 'mchid' => $this->mchid(),
                     'buyer_id' => intval($merchant_info['admin_id']),
                     'amount' => $amount,
                     'card_no' => $no,
-                    'mch_order' => "",
+                    'mch_order' => $mch_order,
                     'notify_url' => "",
                     'org_quality' => $quality];
 
@@ -132,4 +133,11 @@ class merchant_refillControl extends mbMerchantControl
         $result['data'] = $data;
         return self::outsuccess($result);
     }
+
+    private function make_sn()
+    {
+        return mt_rand(1000, 9999)
+            . sprintf('%010d', time())
+            . sprintf('%06d', (float)microtime() * 1000000);
+    }
 }