common.php 565 B

123456789101112131415161718
  1. <?php
  2. // 应用公共文件
  3. if (!function_exists('getNewOrderId')) {
  4. /**
  5. * 生成订单唯一id
  6. * @param $uid 用户uid
  7. * @return string
  8. */
  9. function getNewOrderId()
  10. {
  11. list($msec, $sec) = explode(' ', microtime());
  12. $msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
  13. $orderId = 'wx' . $msectime . mt_rand(10000, 99999);
  14. if (\app\models\auction\AuctionOrder::where('order_id', $orderId)) $orderId = 'wx' . $msectime . mt_rand(10000, 99999);
  15. return $orderId;
  16. }
  17. }