From 51840afaeba5c279dd92f92e63c5cf964effcc8a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 5 Aug 2023 14:20:42 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 25 ++++++++++++++++++ webapp/models/Market.php | 56 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 webapp/models/Market.php diff --git a/sql/gamedb.sql b/sql/gamedb.sql index f4392fef..dc588ed7 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -1397,6 +1397,31 @@ CREATE TABLE `t_mall` ( ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `t_market` +-- + +DROP TABLE IF EXISTS `t_market`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_market` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id', + `token_id` varchar(60) NOT NULL COMMENT 'token_id', + `owner` varchar(60) NOT NULL COMMENT 'owner', + `nft_token` varchar(60) NOT NULL COMMENT 'nft_token', + `amount` varchar(255) NOT NULL DEFAULT '' COMMENT 'amount', + `currency` varchar(60) NOT NULL COMMENT 'currency', + `price` varchar(255) NOT NULL DEFAULT '' COMMENT 'price', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `activated` int(11) NOT NULL DEFAULT '0' COMMENT 'activated', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + DROP TABLE IF EXISTS `t_web2_order`; CREATE TABLE `t_web2_order` ( `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', diff --git a/webapp/models/Market.php b/webapp/models/Market.php new file mode 100644 index 00000000..79f6ffc3 --- /dev/null +++ b/webapp/models/Market.php @@ -0,0 +1,56 @@ +_getMysql(''), + 't_market', + array( + 'order_id' => $orderId + ) + ); + return $row; + } + + public static function upsert($OrderId, $fieldsKv){ + SqlHelper::upsert + (myself()->_getMysql(''), + 't_market', + array( + 'order_id' => $OrderId + ), + array( + ), + array( + 'order_id' => $OrderId, + 'order_type' => getXVal($fieldsKv,'order_type',0), + 'account_id' => myself()->_getAccountId(), + 'address' => myself()->_getAddress(), + 'status' => 0, + 'item_id' => $fieldsKv['item_id'], + 'item_num' => $fieldsKv['item_num'], + 'ext_data' => getXVal($fieldsKv,'ext_data',''), + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), + 'price' => $fieldsKv['price'], + ) + ); + } + + public static function update($OrderId, $fieldsKv){ + SqlHelper::upsert + (myself()->_getMysql(''), + 't_market', + array( + 'order_id' => $OrderId + ), + $fieldsKv + ); + } + +}