请问订单号生成是怎么样

PHP · lumingliang · 于 5年前 发布 · 2816 次阅读

谢谢

共收到 5 条回复
Jacker#15年前 0 个赞

https://github.com/fecshop/yii2_fecshop/blob/master/services/Order.php

801行代码:

 /**
     * @property $order_id | Int
     * @return $increment_id | Int
     *                       通过 order_id 生成订单号。
     */
    protected function generateIncrementIdByOrderId($order_id)
    {
        $increment_id = (int) $this->increment_id + (int) $order_id;
        return $increment_id;
    }
lumingliang#25年前 0 个赞

这个方法,还是暴露了id啊

Fecmall#35年前 0 个赞

如果,你对这个敏感, 你可以使用uuid做id号

参考:https://github.com/fecshop/yii2_fecshop/blob/master/services/Session.php#L13:17

$uuid1 = Uuid::uuid1();
$this->_uuid = $uuid1->toString();
lumingliang#45年前 0 个赞

@Fecshop #3楼 uuid太长了,想要类似淘宝、京东那种

Fecmall#55年前 0 个赞

百度搜索,一堆解决方式

百度搜搜能解决的问题

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics