1
This commit is contained in:
parent
86e8bf0d2c
commit
637ead94e3
@ -316,7 +316,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$orderId = OrderId::gen();
|
$orderId = OrderId::genInappOrderId();
|
||||||
InAppOrder::add(
|
InAppOrder::add(
|
||||||
$orderId,
|
$orderId,
|
||||||
$platform,
|
$platform,
|
||||||
|
@ -9,7 +9,8 @@ use phpcommon\SqlHelper;
|
|||||||
|
|
||||||
class OrderId {
|
class OrderId {
|
||||||
|
|
||||||
public static function gen(){
|
public static function gen()
|
||||||
|
{
|
||||||
SqlHelper::insert
|
SqlHelper::insert
|
||||||
(myself()->_getSelfMysql(),
|
(myself()->_getSelfMysql(),
|
||||||
't_orderid',
|
't_orderid',
|
||||||
@ -25,4 +26,23 @@ class OrderId {
|
|||||||
return $orderId;
|
return $orderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function genInappOrderId()
|
||||||
|
{
|
||||||
|
$orderId = self::gen();
|
||||||
|
if (strlen($orderId) > 32) {
|
||||||
|
error_log('genInappOrderId error order_id ' . $orderId);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
$newOrderId = $orderId;
|
||||||
|
while (strlen($newOrderId) < 32) {
|
||||||
|
$newOrderId .= 'A';
|
||||||
|
}
|
||||||
|
$newOrderId = substr($newOrderId, 0, 8) . '-' .
|
||||||
|
substr($newOrderId, 8, 4) . '-' .
|
||||||
|
substr($newOrderId, 12, 4) . '-' .
|
||||||
|
substr($newOrderId, 16, 4) . '-' .
|
||||||
|
substr($newOrderId, 20, 12);
|
||||||
|
return $newOrderId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user