From 9b92608a7514db8c8304f36fb7c0ef6b81ba1691 Mon Sep 17 00:00:00 2001 From: songliang Date: Wed, 21 Dec 2022 14:50:08 +0800 Subject: [PATCH 1/3] ... --- doc/Market.py | 2 ++ webapp/controller/MarketController.class.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/doc/Market.py b/doc/Market.py index 0747c547..50d75881 100644 --- a/doc/Market.py +++ b/doc/Market.py @@ -9,6 +9,7 @@ class NftIntro(object): ['idx', 0, 'idx'], ['token_id', '', 'token_id'], ['token_type', 0, 'nft类型 1:英雄 2:枪支 3:芯片'], + ['amount', 0, '堆叠数量'], ['createtime', 0, '创建时间(上架时间)'], ['modifytime', 0, '修改时间(更新价格等)'], ['s_price', 0, '出售价格-暂定'], @@ -368,6 +369,7 @@ class Market(object): ['token', '', 'token'], ['nft_token', '', 'nft_token'], ['s_price', '', '出售价格USDT'], + ['amount', 0, '出售数量'], ['payment_token_address', '', 'payment_token_address'], ['nonce', '', 'nonce'], ['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'], diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index a5585ea6..271f5393 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -884,6 +884,7 @@ class MarketController extends BaseController { $token = getReqVal('token', ''); $nft_token = getReqVal('nft_token', ''); $s_price = getReqVal('s_price', ''); + $amount = getReqVal('amount', 1); $payment_token_address = getReqVal('payment_token_address', ''); $nonce = getReqVal('nonce', ''); $signature = getReqVal('signature', ''); @@ -901,6 +902,7 @@ class MarketController extends BaseController { 'token_id' => $nft_token, 'owner_address' => $nftDetail['owner_address'], 'token_type' => $nftDetail['type'], + 'amount' => $amount, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(), 's_price' => $s_price, From 2f5e42e7132bdb97c0532701aa7537e3270d1252 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Wed, 21 Dec 2022 16:18:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=99=8D=E8=90=BD=E4=BC=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/User.py | 1 + doc/_common.py | 2 ++ webapp/controller/UserController.class.php | 15 +++++++++++++++ webapp/models/Parachute.php | 13 ++++++++++++- webapp/models/User.php | 13 ++++++++++++- 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/doc/User.py b/doc/User.py index d257da97..e28a1f54 100644 --- a/doc/User.py +++ b/doc/User.py @@ -77,6 +77,7 @@ class User(object): ['guild_id', 0, '跟新工会id(可选参数,不传就不更新)'], ['guild_job', 0, '跟新工会职位(可选参数,不传就不更新)'], ['guild_name', 0, '跟新工会名称(可选参数,不传就不更新)'], + ['parachute', 0, '跟新降落伞(可选参数,不传就不更新)'], ], 'response': [ _common.RspHead(), diff --git a/doc/_common.py b/doc/_common.py index e38c0f55..7711c7f8 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -149,6 +149,8 @@ class UserInfo(object): ['guild_id', '', '工会id'], ['guild_job', 0, '工会职位'], ['guild_name', '', '工会名称'], + ['parachute', '', '当前使用的降落伞id'], + ['!parachute_list', [0], '拥有的降落伞列表'], ] class UserSimple(object): diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index f876b9d2..6b346dd5 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -486,6 +486,21 @@ class UserController extends BaseAuthedController { 'valid_func' => function ($val, &$errCode, &$errMsg) { return true; } + ), + 'parachute' => array( + 'field_name' => 'parachute', + 'val_func' => function ($val) { + return $val; + }, + 'valid_func' => function ($val, &$errCode, &$errMsg) { + if (User::isValidParachute($val)) { + return true; + } else { + $errCode = 1; + $errMsg = 'parachute parameter error'; + return false; + } + } ) ); $fieldsKv = array(); diff --git a/webapp/models/Parachute.php b/webapp/models/Parachute.php index 5c7a97fc..286dbfa2 100644 --- a/webapp/models/Parachute.php +++ b/webapp/models/Parachute.php @@ -8,14 +8,25 @@ use mt; use phpcommon\SqlHelper; class Parachute extends BaseModel { + public static $parachute = '170001'; //默认降落伞 + public static function getMyParachute(){ - return SqlHelper::ormSelect( + $list = array( + self::$parachute + ); + $rows = SqlHelper::ormSelect( myself()->_getSelfMysql(), 't_parachute', array( 'account_id' => myself()->_getAccountId(), ) ); + if ($rows){ + foreach ($rows as $row){ + array_push($list, $row['item_id']); + } + } + return $list; } public static function addParachute($itemMeta){ if ($itemMeta){ diff --git a/webapp/models/User.php b/webapp/models/User.php index 5b0c3729..0746e1c7 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -4,11 +4,13 @@ namespace models; require_once('mt/Item.php'); require_once('models/UserSeasonRing.php'); +require_once('models/Parachute.php'); use mt; use phpcommon; use phpcommon\SqlHelper; use models\UserSeasonRing; +use models\Parachute; class User extends BaseModel { @@ -69,6 +71,8 @@ class User extends BaseModel { 'guild_id' => $row['guild_id'], 'guild_job' => $row['guild_job'], 'guild_name' => $row['guild_name'], + 'parachute' => $row['parachute'] ? $row['parachute'] : Parachute::$parachute, + 'parachute_list' => Parachute::getMyParachute(), ); } @@ -106,7 +110,9 @@ class User extends BaseModel { 'guild_id' => $row['guild_id'], 'guild_job' => $row['guild_job'], 'guild_name' => $row['guild_name'], - 'ring_list' => UserSeasonRing::ringList($row['account_id']) + 'ring_list' => UserSeasonRing::ringList($row['account_id']), + 'parachute' => $row['parachute'] ? $row['parachute'] : Parachute::$parachute, + 'parachute_list' => Parachute::getMyParachute(), ); } @@ -150,6 +156,11 @@ class User extends BaseModel { return in_array($headFrame, $headFrameList); } + public static function isValidParachute($parachute){ + $parachuteList = Parachute::getMyParachute(); + return in_array($parachute, $parachuteList); + } + private static function getHeadList($userInfo) { $headList = emptyReplace(json_decode($userInfo['head_list'], true), array()); From 09036f72a50ab3ca3de77704e290288143f0b5fd Mon Sep 17 00:00:00 2001 From: hujiabin Date: Wed, 21 Dec 2022 16:20:44 +0800 Subject: [PATCH 3/3] 1 --- sql/gamedb.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index fd809c41..4c5563f5 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -65,6 +65,7 @@ CREATE TABLE `t_user` ( `guild_id` varchar(60) NOT NULL DEFAULT '' COMMENT '工会id', `guild_job` int(11) NOT NULL DEFAULT '0' COMMENT '工会职位', `guild_name` varchar(255) NOT NULL DEFAULT '' COMMENT '工会名称', + `parachute` int(11) NOT NULL DEFAULT '0' COMMENT '降落伞ID', PRIMARY KEY (`idx`), UNIQUE KEY `account_id` (`account_id`), KEY `channel` (`channel`)