This commit is contained in:
aozhiwei 2023-07-31 19:39:03 +08:00
parent 6fe6eac13d
commit 066ce6bc9b
2 changed files with 46 additions and 0 deletions

View File

@ -1278,6 +1278,25 @@ CREATE TABLE `t_user_honor` (
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_orderid`
--
DROP TABLE IF EXISTS `t_orderid`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_orderid` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`request` mediumblob COMMENT 'request',
`confirmed` int(11) NOT NULL DEFAULT '0' COMMENT '是否已确认',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
KEY `account_id` (`account_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_inapp_record`
--

27
webapp/models/OrderId.php Normal file
View File

@ -0,0 +1,27 @@
<?php
namespace models;
use phpcommon\SqlHelper;
class OrderId {
public static function gen(){
SqlHelper::insert
(myself()->_getSelfMysql(),
't_orderid',
array(
'account_id' => myself()->_getAccountId(),
'request' => json_encode($_REQUEST),
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
$lastIdx = SqlHelper::getLastInsertId(myself()->_getSelfMysql());
$orderId = strftime('%Y%m%d%H%M%S', myself()->_getNowTime()) . pad($lastIdx % 100000, 5);
return $orderId;
}
}