Files
liche/common/helpers/order_helper.php
T
2022-10-20 19:57:22 +08:00

43 lines
1005 B
PHP

<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/12/06
* Time: 10:23
*/
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* 生成订单号
* int $city_id
* string $source 狸车【liche】
* string $category
* int $pay_type 微信【1】
* int $order_type 普通订单【1】
* */
if ( ! function_exists('create_order_no'))
{
function create_order_no($city_id = 350200, $source = '', $pay_type = 1, $order_type = 1)
{
switch ($source)
{
case 'liche':
$source_id = sprintf("%02d", 1);
break;
case 'licheb':
$source_id = sprintf("%02d", 2);
break;
case 'market':
$source_id = sprintf("%02d", 51);
break;
default:
$source_id = sprintf("%02d", 0);
}
return $city_id . $source_id . $pay_type . $order_type . date('Ymd') . sprintf("%06d", rand(1,999999));
}
}