1
This commit is contained in:
parent
c981405d8c
commit
603ee1b28e
@ -6,6 +6,8 @@ use phpcommon;
|
|||||||
|
|
||||||
class OrderCtrl {
|
class OrderCtrl {
|
||||||
|
|
||||||
|
const SEQ_KEY = 'gamepay:seq';
|
||||||
|
|
||||||
private function getRedis()
|
private function getRedis()
|
||||||
{
|
{
|
||||||
$redis_conf = getGlobalRedisConfig();
|
$redis_conf = getGlobalRedisConfig();
|
||||||
@ -46,11 +48,17 @@ class OrderCtrl {
|
|||||||
|
|
||||||
public function genOrderId($account_id)
|
public function genOrderId($account_id)
|
||||||
{
|
{
|
||||||
|
$r = $this->getRedis();
|
||||||
|
$seq = $r->incrBy(self::SEQ_KEY, 1) & 0xffffff;
|
||||||
|
$r->pexpire(self::SEQ_KEY, 1000 * 10);
|
||||||
|
|
||||||
$hex_str = dechex($this->getStrDNA($account_id));
|
$hex_str = dechex($this->getStrDNA($account_id));
|
||||||
if (strlen($hex_str) < 2) {
|
if (strlen($hex_str) < 2) {
|
||||||
$hex_str = '0' . $hex_str;
|
$hex_str = '0' . $hex_str;
|
||||||
}
|
}
|
||||||
return uniqid('201020') . $hex_str;
|
$today = date("YmdHis");
|
||||||
|
$orderid = $today . $var=sprintf("%09d", $seq) . $hex_str;
|
||||||
|
return $orderid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrder($cp_orderid)
|
public function getOrder($cp_orderid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user