From 5ae75c45b5c06231f8c9b90c1b31170cf19e59bc Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 3 Apr 2022 13:58:32 +0800 Subject: [PATCH] 1 --- sql/marketdb.sql | 5 ++++- webapp/controller/MarketController.class.php | 4 +++- webapp/models/BuyRecord.php | 10 ++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sql/marketdb.sql b/sql/marketdb.sql index 610db94b..33990775 100644 --- a/sql/marketdb.sql +++ b/sql/marketdb.sql @@ -49,6 +49,7 @@ CREATE TABLE `t_box_order` ( `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id', `type` varchar(60) NOT NULL DEFAULT '' COMMENT 'type', `buyer_address` varchar(60) NOT NULL DEFAULT '' COMMENT '购买者', + `raw_buyer_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'raw购买者', `price` varchar(60) NOT NULL DEFAULT '' COMMENT 'price', `payment_token_address` varchar(60) NOT NULL DEFAULT '' COMMENT '货币地址', `nonce` varchar(60) NOT NULL DEFAULT '' COMMENT 'nonce', @@ -137,9 +138,11 @@ CREATE TABLE `t_buy_record` ( `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', `blobdata` mediumblob COMMENT 'blobdata', `buyer_address` mediumblob COMMENT 'buyer_address', + `order_id` varchar(60) COMMENT '订单id', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`) + PRIMARY KEY (`idx`), + KEY `order_id` (`order_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 8f532318..5013f9c4 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -87,7 +87,8 @@ class MarketController extends BaseController { { $token = getReqVal('token', ''); $type = getReqVal('type', ''); - $buyerAddress = getReqVal('buyer_address', ''); + $rawBuyerAddress = getReqVal('buyer_address', ''); + $buyerAddress = strtolower($rawBuyerAddress); $price = getReqVal('price', ''); $paymentTokenAddress = getReqVal('payment_token_address', ''); $nonce = getReqVal('nonce', ''); @@ -194,6 +195,7 @@ class MarketController extends BaseController { 'batch_idx' => $currBatchMeta['id'], 'order_id' => $orderId, 'type' => $type, + 'raw_buyer_address' => $rawBuyerAddress, 'buyer_address' => $buyerAddress, 'price' => $price, 'payment_token_address' => $paymentTokenAddress, diff --git a/webapp/models/BuyRecord.php b/webapp/models/BuyRecord.php index 539d09d0..a6e941e2 100644 --- a/webapp/models/BuyRecord.php +++ b/webapp/models/BuyRecord.php @@ -36,6 +36,16 @@ class BuyRecord extends BaseModel { 'errmsg' => 'server internal error' ))); } + SqlHelper::update + (myself()->_getMarketMysql(), + 't_buy_record', + array( + 'idx' => $lastIdx + ), + array( + 'order_id' => $orderId + ) + ); return $orderId; }