修改订单逻辑和订单ID生成方式

This commit is contained in:
mkm 2024-05-30 16:29:47 +08:00
parent 9c1d2dd62e
commit a98895c01a
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ class OrderLogic extends BaseLogic
} }
$order = [ $order = [
'time' => time(), 'time' => time(),
'number' => static::getNewOrderId('PF'), 'number' => getNewOrderId('PF'),
'total' => self::$total, 'total' => self::$total,
'pay_type' => $params['pay_type'] ?? 0, 'pay_type' => $params['pay_type'] ?? 0,
'cart_id' => implode(',', $cartId), 'cart_id' => implode(',', $cartId),

View File

@ -324,7 +324,7 @@ if (!function_exists('getNewOrderId')) {
{ {
list($msec, $sec) = explode(' ', microtime()); list($msec, $sec) = explode(' ', microtime());
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', ''); $msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
$orderId = $type . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369)); $orderId = $type . $msectime . mt_rand(100, max(intval($msec * 10) + 100, 983));
return $orderId; return $orderId;
} }
} }