From bc2a2679d36a620776467862130fa9890ddafed1 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Wed, 31 Aug 2022 19:41:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=B7=BB=E5=8A=A0=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=8A=AF=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/gamedb.sql | 4 +- webapp/controller/UserController.class.php | 61 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 520656ef..6aaae28e 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -151,7 +151,7 @@ CREATE TABLE `t_hero` ( `last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `chip_ids` varchar(100) NOT NULL DEFAULT '0' COMMENT '已镶嵌的芯片idx组', + `chip_ids` varchar(100) NOT NULL DEFAULT '' COMMENT '已镶嵌的芯片idx组', `skill_common` varchar(255) NOT NULL DEFAULT '100100|100120|100140|100160|100180|100200|100220|100240|100260|100280' COMMENT '通用技能', `skill_points` int(11) NOT NULL DEFAULT '0' COMMENT '技能点', PRIMARY KEY (`idx`), @@ -269,7 +269,7 @@ CREATE TABLE `t_gun` ( `last_pve_get_ceg_time` bigint NOT NULL DEFAULT '0' COMMENT '最后pve获取金币的时间', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `chip_ids` varchar(100) NOT NULL DEFAULT '0' COMMENT '已镶嵌的芯片idx组', + `chip_ids` varchar(100) NOT NULL DEFAULT '' COMMENT '已镶嵌的芯片idx组', PRIMARY KEY (`idx`), UNIQUE KEY `token_id` (`token_id`), KEY `account_id` (`account_id`) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 8cd9d645..c0da4377 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -3,12 +3,14 @@ require_once('models/User.php'); require_once('models/Hero.php'); require_once('models/Season.php'); +require_once('models/Nft.php'); require_once('mt/Parameter.php'); require_once('mt/Drop.php'); require_once('mt/Season.php'); require_once('mt/Hero.php'); require_once('mt/Rank.php'); +require_once('mt/Item.php'); require_once('services/AwardService.php'); require_once('services/PropertyChgService.php'); @@ -19,6 +21,7 @@ use phpcommon\SqlHelper; use models\User; use models\Hero; use models\Season; +use models\Nft; class UserController extends BaseAuthedController { @@ -35,6 +38,9 @@ class UserController extends BaseAuthedController { $userInfo = $this->_safeGetOrmUserInfo(); if (!$userInfo) { $this->createNewUser($userName, $avatarUrl); + + $this->addChip(); + $userInfo = $this->_getOrmUserInfo(); } if (!$this->loginCheck($userInfo)) { @@ -46,6 +52,61 @@ class UserController extends BaseAuthedController { $this->_incDailyV(TN_DAILY_LOGINS, 0, 1); } + private function addChip(){ + $list1 = [130001,130002,130003,130004,130005,130006,130007,130008,130009,130010]; + $list2 = [130011,130012,130013,130014,130015,130016,130017]; + for ($i=1;$i<=15;$i++){ + $itemId1 = $list1[rand(0,9)]; + $itemMeta = mt\Item::get($itemId1); + if ($itemMeta) { + $tokenType = Nft::getTokenType($itemMeta); + if ($tokenType == Nft::NONE_TYPE) { +// myself()->_rspErr(1, 'param item_id error'); + return; + } else { + SqlHelper::insert( + myself()->_getMarketMysql(), + 't_nft', + array( + 'token_id' => myself()->_getNowTime()+$i+5, + 'token_type' => $tokenType, + 'game_id' => 2006, + 'item_id' => $itemId1, + 'owner_address' => myself()->_getOpenId(), + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), + ) + ); + } + } + } + for ($i=16;$i<=30;$i++){ + $itemId = $list2[rand(0,7)]; + $itemMeta = mt\Item::get($itemId); + if ($itemMeta) { + $tokenType = Nft::getTokenType($itemMeta); + if ($tokenType == Nft::NONE_TYPE) { +// myself()->_rspErr(1, 'param item_id error'); + return; + } else { + SqlHelper::insert( + myself()->_getMarketMysql(), + 't_nft', + array( + 'token_id' => myself()->_getNowTime()+$i+5, + 'token_type' => $tokenType, + 'game_id' => 2006, + 'item_id' => $itemId, + 'owner_address' => myself()->_getOpenId(), + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), + ) + ); + } + } + } + } + private function loginCheck($userInfo) { $seasonService = new services\SeasonService();