From 112e52ec9d5a8a428ac88f88650c746a40b2d8ef Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 1 Aug 2024 12:48:25 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 19 ++++++++ .../controller/BigwheelController.class.php | 4 -- webapp/models/MidData.php | 47 +++++++++++++++++++ 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 webapp/models/MidData.php diff --git a/sql/gamedb.sql b/sql/gamedb.sql index c54c180e..fbadd09d 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -1948,3 +1948,22 @@ CREATE TABLE `t_box_alloc` ( KEY `idx_createtime` (`createtime`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_middata` +-- + +DROP TABLE IF EXISTS `t_middata`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_middata` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `type` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'type', + `data` text COMMENT 'data', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_type` (`account_id`, `type`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; diff --git a/webapp/controller/BigwheelController.class.php b/webapp/controller/BigwheelController.class.php index 9bb009b9..f2986488 100644 --- a/webapp/controller/BigwheelController.class.php +++ b/webapp/controller/BigwheelController.class.php @@ -1,17 +1,13 @@ _getSelfMysql(), + 't_middata', + array( + 'account_id' => myself()->_getAccountId(), + 'type' => $type, + ) + ); + return $row ? json_decode($row['data'], true) : null; + } + + + public static function setData($type, $data) + { + SqlHelper::upsert + (myself()->_getSelfMysql(), + 't_middata', + array( + 'account_id' => myself()->_getAccountId(), + 'type' => $type + ), + array( + 'data' => $data, + 'modifytime' => myself()->_getNowTime() + ), + array( + 'account_id' => myself()->_getAccountId(), + 'type' => $type, + 'data' => $data, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); + } + +}