Ver Fonte

调整投注批次号生成规则

彭俊 há 6 anos atrás
pai
commit
13eea0a91c
2 ficheiros alterados com 11 adições e 1 exclusões
  1. 2 1
      Application/Api/Controller/Betorder.php
  2. 9 0
      Biz/Common/CommonFunction.php

+ 2 - 1
Application/Api/Controller/Betorder.php

@@ -363,7 +363,8 @@ class Betorder extends BaseController{
         //追加验证用户投注金额限额
         $this->bet_money_limit($data,$userInfo);
 
-        $batch_id = strtotime(date('Y-m-d H:i:s',time())).mt_rand('1','99');//批量ID
+        //获取订单批次号
+        $batch_id = $this->commonFunction->orderSn();///strtotime(date('Y-m-d H:i:s',time())).mt_rand('1','99');//批量ID
         //执行数据插入
         try {
             _beginTransaction();//开启事务

+ 9 - 0
Biz/Common/CommonFunction.php

@@ -1336,6 +1336,15 @@ class CommonFunction {
 
         return $sourceID;
     }
+
+    //生成订单/批次号
+    function orderSn() {
+		$year_code = array('A','B','C','D','E','F','G','H','I','J');//年份
+		$order_sn = $year_code[intval(date('Y'))-2019].
+			strtoupper(dechex(date('m'))).date('d').
+			substr(time(),-5).substr(microtime(),2,5).sprintf('d',rand(0,99));
+		return $order_sn;
+	}
 }
 
 ?>