生成订单编号 和产品编号

浏览:4510 发布日期:2017/11/21 分类:系统代码 关键字: 订单 产品 编号 生成
生成订单编号 和产品编号
//订单号   产品编号
function get_shop_number($type=0){
  if($type){
    $time =date('Ymd');
    $wh['time'] = array('gt',strtotime($time));
    $count = M('shop_goods')->where($wh)->count();
    $number =  'FRMO'.$time. str_pad($count+1, 6, '0', STR_PAD_LEFT);
  }else{
    $time =date('Y');
    $count = M('shop_goods')->order('id DESC')->find();
    $number =  'FG'.$time. str_pad($count['id']+1, 6, '0', STR_PAD_LEFT);
  }
  return $number;
}


$str = date('ymdHi') . str_pad(mt_rand(1, 999999), 6, '0', STR_PAD_LEFT);

$yCode = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
$orderSn = $yCode[intval(date('Y')) - 2019] . strtoupper(dechex(date('m'))) . date('d') . substr(time(), -5) . substr(microtime(), 2, 5) . sprintf('%02d', rand(0, 99));
评论( 相关
后面还有条评论,点击查看>>