生成订单编号 和产品编号
//订单号 产品编号
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));