From 1958761e7ad347b78429f2d5f7fd1aa9dfa03cb5 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Fri, 16 Aug 2024 17:48:12 +0800 Subject: [PATCH] 1 --- doc/InGameMall.py | 2 +- sql/gamedb.sql | 3 +- .../controller/BaseAuthedController.class.php | 2 +- .../controller/InGameMallController.class.php | 68 +++++++++++++++---- webapp/models/InGameMall.php | 5 +- webapp/services/AddItemsService.php | 2 +- webapp/services/ContributionService.php | 1 + 7 files changed, 64 insertions(+), 19 deletions(-) diff --git a/doc/InGameMall.py b/doc/InGameMall.py index d5253cd8..89a652f3 100644 --- a/doc/InGameMall.py +++ b/doc/InGameMall.py @@ -18,7 +18,7 @@ class InGameMall(object): ['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格'], ['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'], ['price_filter', '', '价格过滤(用|分割)'], - ['type_filter', '', '类型过滤 1:英雄皮肤 2:芯片 3:英雄碎片 11:其它(材料、宝箱)'], + ['type_filter', '', '类型过滤 1:英雄皮肤 2:芯片 3:英雄碎片 5:金币 11:其它(材料、宝箱)'], ['item_filter', '', 'itemId过滤(用|分割)'], ['quality_filter', '', '品质过滤'], ], diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 4728a13d..8e9ad83d 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -1440,12 +1440,13 @@ DROP TABLE IF EXISTS `t_ingame_mall`; CREATE TABLE `t_ingame_mall` ( `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', `order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id', - `order_type` int(11) NOT NULL DEFAULT '0' COMMENT '1:英雄 2:芯片 3:碎片 4:宝箱', + `order_type` int(11) NOT NULL DEFAULT '0' COMMENT '1:英雄皮肤 2:芯片 3:英雄碎片 4:皮肤碎片 5:金币 11:其它', `seller` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller', `seller_address` varchar(60) DEFAULT '' COMMENT 'seller_address', `goods_uniid` varchar(50) NOT NULL DEFAULT '0' COMMENT '物品id', `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品itemId', `item_num` bigint NOT NULL DEFAULT '0' COMMENT '物品数量', + `pay_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:金币 1:砖石', `price` bigint NOT NULL DEFAULT '0' COMMENT '价格', `unit_price` decimal(10, 2) NOT NULL DEFAULT '0' COMMENT '单价', `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 67833f9f..e2531114 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -332,7 +332,7 @@ class BaseAuthedController extends BaseController { return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE,V_ITEM_BCEG,V_ITEM_STAR)); } - public function _addVirtualItem($itemId, $itemNum,$awardService,$propertyChgService) + public function _addVirtualItem($itemId, $itemNum) { if ($itemNum <= 0){ return; diff --git a/webapp/controller/InGameMallController.class.php b/webapp/controller/InGameMallController.class.php index 81846594..46a8a2c7 100644 --- a/webapp/controller/InGameMallController.class.php +++ b/webapp/controller/InGameMallController.class.php @@ -193,9 +193,11 @@ class InGameMallController extends BaseAuthedController { $this->_rspErr(1, 'param item_id error'); return; } - if (! $this->_isGoodsType($itemMeta['type'])){ - $this->_rspErr(1, 'param item_id error'); - return; + if ($itemId != V_ITEM_GOLD){ + if (! $this->_isGoodsType($itemMeta['type'])){ + $this->_rspErr(1, 'param item_id error'); + return; + } } switch ($itemMeta['type']){ case \mt\Item::HERO_SKIN_TYPE : { @@ -234,7 +236,7 @@ class InGameMallController extends BaseAuthedController { return; } $propertyChgService = new PropertyChgService(); - if (\mt\Item::isBagItem($itemMeta['type'],$itemMeta['sub_type'])){ + if (\mt\Item::isBagItem($itemMeta['type'],$itemMeta['sub_type']) || $itemId == V_ITEM_GOLD){ $costItems = array( array( 'item_id' => $itemId, @@ -276,12 +278,18 @@ class InGameMallController extends BaseAuthedController { $orderId = OrderId::gen(); $orderType = $this->_getGoodsType($itemMeta); + if ($orderType == InGameMall::GOLD_TYPE){ + $payType = 1; + }else{ + $payType = 0; + } InGameMall::add( $orderId, $orderType, $goodsUniid, $itemId, $amount, + $payType, $priceBn, $orderField ); @@ -305,9 +313,14 @@ class InGameMallController extends BaseAuthedController { myself()->_rspErr(1, ' goods price error'); return; } + if ($goodsDb['pay_type'] == 1){ + $costItemId = V_ITEM_DIAMOND; + }else{ + $costItemId = V_ITEM_GOLD; + } $costItems = array( array( - 'item_id' => V_ITEM_GOLD, + 'item_id' => $costItemId, 'item_num' => $goodsDb['price'] ) ); @@ -327,11 +340,18 @@ class InGameMallController extends BaseAuthedController { if (!$goods){ return; } + if ($goods['pay_type'] == 1){ + $payType = 'diamond'; + $payItemId = V_ITEM_DIAMOND; + }else{ + $payType = 'gold'; + $payItemId = V_ITEM_GOLD; + } $price = $goods['price']; InGameMall::buyOk($goods['order_id'],myself()->_getAccountId()); $costItems = array( array( - 'item_id' => V_ITEM_GOLD, + 'item_id' => $payItemId, 'item_num' => $price ) ); @@ -366,6 +386,11 @@ class InGameMallController extends BaseAuthedController { $propertyChgService->addChip(); } break; + case InGameMall::GOLD_TYPE:{ + myself()->_addVirtualItem($goods['item_id'],$goods['item_num']); + $propertyChgService->addUserChg(); + } + break; default : { Bag::addItem($goods['item_id'],$goods['item_num']); @@ -393,15 +418,17 @@ class InGameMallController extends BaseAuthedController { $taxGold = ceil($price*$taxRate); $falGold = $price - $taxGold; + + $mailContent = << V_ITEM_GOLD, + 'itemid' => $payItemId, 'itemnum' => $falGold ) ); @@ -420,7 +447,7 @@ EOD; 'seller' =>$goods['seller'], 'buyer' =>myself()->_getAccountId(), 'change' => array( - 'item_id' => V_ITEM_GOLD, + 'item_id' => $payItemId, 'item_num' => $falGold ), ); @@ -645,7 +672,8 @@ EOD; return; } $orderIdArr = explode("|",$orderIds); - $price = 0; + $goldPrice = 0; + $diamondPrice = 0; foreach ($orderIdArr as $orderId) { $goodsDb = InGameMall::findByOrderId($orderId); if (!$goodsDb) { @@ -656,12 +684,21 @@ EOD; myself()->_rspErr(1, 'cannot cancel the goods'); return; } - $price += $goodsDb['price']; + if ($goodsDb['pay_type'] == 1){ + $diamondPrice += $goodsDb['price']; + }else{ + $goldPrice += $goodsDb['price']; + } + } $costItems = array( array( 'item_id' => V_ITEM_GOLD, - 'item_num' => $price + 'item_num' => $goldPrice + ), + array( + 'item_id' => V_ITEM_DIAMOND, + 'item_num' => $diamondPrice ) ); $lackItem = null; @@ -708,6 +745,9 @@ EOD; if (!$itemMeta){ return 0; } + if ($itemMeta['id'] == V_ITEM_GOLD){ + return InGameMall::GOLD_TYPE; + } switch ($itemMeta['type']){ case \mt\Item::HERO_SKIN_TYPE : { return InGameMall::HERO_SKIN_TYPE; diff --git a/webapp/models/InGameMall.php b/webapp/models/InGameMall.php index 6b498668..5d6d7b4c 100644 --- a/webapp/models/InGameMall.php +++ b/webapp/models/InGameMall.php @@ -14,8 +14,10 @@ class InGameMall extends BaseModel { const CHIP_TYPE = 2; const HERO_FRAGMENT_TYPE = 3; const SKIN_FRAGMENT_TYPE = 4; + const GOLD_TYPE = 5; const OTHER_TYPE = 11; + const SYSTEM_MALL_ACCOUNT = "kingsome"; public static function findByOrderId($orderId) @@ -30,7 +32,7 @@ class InGameMall extends BaseModel { return $row; } - public static function add($orderId, $orderType, $goodsUniid,$itemId, $itemNum, $price, $orderField) + public static function add($orderId, $orderType, $goodsUniid,$itemId, $itemNum, $payType,$price, $orderField) { SqlHelper::insert (myself()->_getMysql(''), @@ -43,6 +45,7 @@ class InGameMall extends BaseModel { 'goods_uniid' => $goodsUniid, 'item_id' => $itemId, 'item_num' => $itemNum, + 'pay_type' => $payType, 'price' => $price, 'order1' => $orderField, 'unit_price' => $price/$itemNum, diff --git a/webapp/services/AddItemsService.php b/webapp/services/AddItemsService.php index 6e8b0cce..72382ffd 100644 --- a/webapp/services/AddItemsService.php +++ b/webapp/services/AddItemsService.php @@ -40,7 +40,7 @@ class AddItemsService extends BaseService $awardService->addItem($item['item_id'], $item['item_num']); } if (myself()->_isVirtualItem($item['item_id'])) { - myself()->_addVirtualItem($item['item_id'], $item['item_num'],$awardService,$propertyService); + myself()->_addVirtualItem($item['item_id'], $item['item_num']); $propertyService->addUserChg(); } else { $itemMeta = Item::get($item['item_id']); diff --git a/webapp/services/ContributionService.php b/webapp/services/ContributionService.php index 27ab0262..939cf837 100644 --- a/webapp/services/ContributionService.php +++ b/webapp/services/ContributionService.php @@ -6,6 +6,7 @@ class ContributionService extends BaseService { private static $ignoreCa = array( 'BlockChain@mintGoldBullion', + 'InGameMall@sellS', 'InGameMall@buyS', 'InGameMall@shoppingCartBuyS', );