【修复】订单号生成bug
This commit is contained in:
parent
77f6f91cda
commit
49f02b26a7
|
|
@ -228,15 +228,10 @@ class BlindboxOrder extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id, $member_id = 0)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . "_" . $member_id . "_" . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "_" . $member_id . "_" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "_" . $member_id . "_" . $time_str,120);
|
||||
$order_no = $time_str . $member_id . sprintf("%03d", $max_no);
|
||||
Cache::set($site_id . "_" . $member_id . "_" . $time_str, $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -808,15 +808,10 @@ class GiftCard extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id, $member_id = 0)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . "_" . $member_id . "_" . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "_" . $member_id . "_" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "_" . $member_id . "_" . $time_str,120);
|
||||
$order_no = $time_str . $member_id . sprintf("%03d", $max_no);
|
||||
Cache::set($site_id . "_" . $member_id . "_" . $time_str, $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -254,15 +254,10 @@ class GiftCardOrderCreate extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id, $member_id = 0)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . '_' . $member_id . '_' . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$order_no = $time_str . sprintf('%05d', $member_id) . sprintf('%03d', $max_no);
|
||||
Cache::set($site_id . '_' . $member_id . '_' . $time_str, $max_no);
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "_" . $member_id . "_" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "_" . $member_id . "_" . $time_str,120);
|
||||
$order_no = $time_str . $member_id . sprintf("%03d", $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -584,15 +584,10 @@ class OrderCreate extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id, $member_id = 0)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . "_" . $member_id . "_" . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "_" . $member_id . "_" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "_" . $member_id . "_" . $time_str,120);
|
||||
$order_no = $time_str . $member_id . sprintf("%03d", $max_no);
|
||||
Cache::set($site_id . "_" . $member_id . "_" . $time_str, $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,15 +137,10 @@ class OrderCreate extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id, $member_id = 0)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . "_" . $member_id . "_" . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "_" . $member_id . "_" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "_" . $member_id . "_" . $time_str,120);
|
||||
$order_no = $time_str . $member_id . sprintf("%03d", $max_no);
|
||||
Cache::set($site_id . "_" . $member_id . "_" . $time_str, $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
}
|
||||
|
|
@ -86,15 +86,10 @@ class WeappletReg extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id, $member_id = 0)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . "_" . $member_id . "_" . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "_" . $member_id . "_" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "_" . $member_id . "_" . $time_str,120);
|
||||
$order_no = $time_str . $member_id . sprintf("%03d", $max_no);
|
||||
Cache::set($site_id . "_" . $member_id . "_" . $time_str, $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
}
|
||||
|
|
@ -242,15 +242,10 @@ class MemberLevelOrder extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id, $member_id = 0)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . "_" . $member_id . "_" . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "_" . $member_id . "_" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "_" . $member_id . "_" . $time_str,120);
|
||||
$order_no = $time_str . $member_id . sprintf("%03d", $max_no);
|
||||
Cache::set($site_id . "_" . $member_id . "_" . $time_str, $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -281,15 +281,10 @@ class OrderCommon extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . '_' . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$order_no = $time_str . sprintf('%04d', $max_no);
|
||||
Cache::set($site_id . '_' . $time_str, $max_no);
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "__" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "__" . $time_str,120);
|
||||
$order_no = $time_str . sprintf("%03d", $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
/**********************************************************************************订单操作基础方法(订单关闭,订单完成,订单调价)开始********/
|
||||
|
|
|
|||
|
|
@ -382,15 +382,10 @@ class OrderCreate extends BaseModel
|
|||
*/
|
||||
public function createOrderNo($site_id, $member_id = 0)
|
||||
{
|
||||
$time_str = date('YmdHi');
|
||||
$max_no = Cache::get($site_id . "_" . $member_id . "_" . $time_str);
|
||||
if (!isset($max_no) || empty($max_no)) {
|
||||
$max_no = 1;
|
||||
} else {
|
||||
$max_no = $max_no + 1;
|
||||
}
|
||||
$time_str = date('YmdHis');
|
||||
$max_no = Cache::handler()->incr($site_id . "_" . $member_id . "_" . $time_str,1);
|
||||
Cache::handler()->expire($site_id . "_" . $member_id . "_" . $time_str,120);
|
||||
$order_no = $time_str . $member_id . sprintf("%03d", $max_no);
|
||||
Cache::set($site_id . "_" . $member_id . "_" . $time_str, $max_no);
|
||||
return $order_no;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
namespace app\pay\controller;
|
||||
use app\Controller;
|
||||
use addon\aliapp\model\CloudPay;
|
||||
use app\model\order\OrderCreate;
|
||||
|
||||
class LqjTest extends Controller
|
||||
{
|
||||
|
||||
|
|
@ -91,4 +93,10 @@ class LqjTest extends Controller
|
|||
var_dump($res);
|
||||
}
|
||||
}
|
||||
|
||||
public function testCreateOrderNo(){
|
||||
$BlindboxOrderCreateModel = new OrderCreate();
|
||||
echo $BlindboxOrderCreateModel->createOrderNo(1,2);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue