From c28cb72a82bc944fccce08024da81a4fae29f611 Mon Sep 17 00:00:00 2001 From: songliang Date: Tue, 4 Apr 2023 21:02:28 +0800 Subject: [PATCH 01/15] ... --- webapp/controller/ShopController.class.php | 592 +++++++++++---------- 1 file changed, 308 insertions(+), 284 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 7ca082e9..6b8a38f8 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -27,7 +27,8 @@ use models\Gun; use models\GunSkin; use models\ShopBuyRecord; -class ShopController extends BaseAuthedController { +class ShopController extends BaseAuthedController +{ const TOKEN_TYPE_CEG = '1'; const TOKEN_TYPE_CEC = '2'; @@ -48,27 +49,57 @@ class ShopController extends BaseAuthedController { public function getGoodsList() { $goodsList = mt\ShopGoods::all(); - - $this->_rspData(array( - 'goods_list' => $goodsList ? $goodsList : array(), - )); + $goodsList = $goodsList ? $goodsList : array(); + $buyRecordHash = ShopBuyRecord::allToHash(); + + foreach ($goodsList as $goods) { + $goods['bought_times'] = 0; + switch ($goods['limit_type']) { + case mt\Item::DAILY_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $goods['id']); + $goods['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0; + } + break; + case mt\Item::WEEKLY_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $goods['id']); + $goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0; + } + break; + case mt\Item::TOTAL_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $goods['id']); + $goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0; + } + break; + default: { + } + break; + } + } + + $this->_rspData( + array( + 'goods_list' => $goodsList, + ) + ); } public function getShopNames() { $shopList = mt\Shop::all(); - $this->_rspData(array( - 'shop_name_list' => $shopList ? $shopList : array(), - )); + $this->_rspData( + array( + 'shop_name_list' => $shopList ? $shopList : array(), + ) + ); } - + public function buyGoodsNew() { $id = getReqVal('id', 0); $token_type = getReqVal('token_type', ''); $goods_num = getReqVal('goods_num', 0); - + $row = mt\ShopGoods::get($id); $desired_token_type = $row['token_type']; @@ -79,7 +110,7 @@ class ShopController extends BaseAuthedController { return; } - if ($goods_num>$row['max_amount']) { + if ($goods_num > $row['max_amount']) { $this->_rspErr(1, "goods_num parameter error, max_amount: {$row['max_amount']}"); return; } @@ -87,84 +118,80 @@ class ShopController extends BaseAuthedController { $buyRecordHash = ShopBuyRecord::allToHash(); $boughtTimes = 1; switch ($row['limit_type']) { - case ShopController::DAILY_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $id); - $boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1: 1; - if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $row['limit_num']) { - $this->_rspErr(2, 'Has reached the maximum number of purchase restrictions today'); - return; - } - if ($row['limit_num'] <= 0) { - $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); - return; - } - } - break; - case ShopController::WEEKLY_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $id); - $boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1: 1; - if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $row['limit_num']) { - $this->_rspErr(2, 'The maximum number of purchase restrictions this week has been reached'); - return; - } - if ($row['limit_num'] <= 0) { - $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); - return; - } - } - break; - case ShopController::TOTAL_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $id); - $boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1: 1; - if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $row['limit_num']) { - $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); - return; - } - if ($row['limit_num'] <= 0) { - $this->_rspErr(2, 'he maximum number of purchase restrictions has been reached'); - return; - } - } - break; - default: - { - } - break; + case ShopController::DAILY_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $id); + $boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1; + if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $row['limit_num']) { + $this->_rspErr(2, 'Has reached the maximum number of purchase restrictions today'); + return; + } + if ($row['limit_num'] <= 0) { + $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); + return; + } + } + break; + case ShopController::WEEKLY_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $id); + $boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1; + if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $row['limit_num']) { + $this->_rspErr(2, 'The maximum number of purchase restrictions this week has been reached'); + return; + } + if ($row['limit_num'] <= 0) { + $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); + return; + } + } + break; + case ShopController::TOTAL_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $id); + $boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1; + if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $row['limit_num']) { + $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); + return; + } + if ($row['limit_num'] <= 0) { + $this->_rspErr(2, 'he maximum number of purchase restrictions has been reached'); + return; + } + } + break; + default: { + } + break; } $price_array = splitStr1($row['price']); $discount_array = splitStr1($row['discount']); - + $need_price = $price_array[$token_pos]; $discount = $discount_array[$token_pos]; - $discount_begin = strtotime($row['discount_begin'].' UTC'); - $discount_end = strtotime($row['discount_end'].' UTC'); + $discount_begin = strtotime($row['discount_begin'] . ' UTC'); + $discount_end = strtotime($row['discount_end'] . ' UTC'); $nowTime = $this->_getNowTime(); - - if ($nowTime>=$discount_begin && $nowTime<$discount_end) { - + + if ($nowTime >= $discount_begin && $nowTime < $discount_end) { + $need_price = ceil($need_price * ($discount / 100.0)); } $costItemId = $this->getCostItemIdByTokenType($token_type); - - switch($token_type) { + + switch ($token_type) { case ShopController::TOKEN_TYPE_CEG: case ShopController::TOKEN_TYPE_CEC: - $costItems = $this->makeCostItems($costItemId, $goods_num*$need_price); + $costItems = $this->makeCostItems($costItemId, $goods_num * $need_price); $lackItem = null; if (!$this->_hasEnoughItems($costItems, $lackItem)) { $this->_rspErr(2, $this->_getLackItemErrMsg($lackItem)); return; } - + $itemMeta = mt\Item::get($row['goods_id']); $propertyChgService = new services\PropertyChgService(); - for ($i = 0; $i<$goods_num; $i++) { + for ($i = 0; $i < $goods_num; $i++) { $this->internalAddItem($propertyChgService, $itemMeta); } $awardService = new services\AwardService(); @@ -184,19 +211,20 @@ class ShopController extends BaseAuthedController { 'limit_type' => $row['limit_type'], 'bought_times' => $boughtTimes, 'total_buy_times' => $row['limit_num'], - ); - { + ); { $priceInfo = mt\Item::getPriceInfo($itemMeta); if (!empty($priceInfo)) { $goodsDto['price_info'] = $priceInfo['price_info']; } } $propertyChgService->addUserChg(); - $this->_rspData(array( - 'award' => $awardService->toDto(), - 'property_chg' => $propertyChgService->toDto(), - 'goods_chg' => $goodsDto - )); + $this->_rspData( + array( + 'award' => $awardService->toDto(), + 'property_chg' => $propertyChgService->toDto(), + 'goods_chg' => $goodsDto + ) + ); break; case ShopController::TOKEN_TYPE_BCEG: @@ -208,13 +236,13 @@ class ShopController extends BaseAuthedController { case ShopController::TOKEN_TYPE_MATIC: case ShopController::TOKEN_TYPE_BNB: default: - $this->_rspErr(1, "token_type is unsupport, {$token_type}"); + $this->_rspErr(1, "token_type is unsupport, {$token_type}"); } } private function getCostItemIdByTokenType($token_type) { - switch($token_type) { + switch ($token_type) { case ShopController::TOKEN_TYPE_CEG: return V_ITEM_GOLD; break; @@ -254,13 +282,15 @@ class ShopController extends BaseAuthedController { } $goodsList = mt\ShopGoods::getGoodsList($shopId); if (!$goodsList) { - $this->_rspData(array( - 'info' => array( - 'shop_id' => $shopId, - 'goods_list1' => array(), - 'goods_list2' => array(), + $this->_rspData( + array( + 'info' => array( + 'shop_id' => $shopId, + 'goods_list1' => array(), + 'goods_list2' => array(), + ) ) - )); + ); return; } $buyRecordHash = ShopBuyRecord::allToHash(); @@ -279,28 +309,24 @@ class ShopController extends BaseAuthedController { 'total_buy_times' => $itemMeta['limit_num'], ); switch ($itemMeta['limit_type']) { - case mt\Item::DAILY_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); - $goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0; - } - break; - case mt\Item::WEEKLY_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); - $goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0; - } - break; - case mt\Item::TOTAL_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); - $goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0; - } - break; - default: - { - } - break; + case mt\Item::DAILY_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); + $goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0; + } + break; + case mt\Item::WEEKLY_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); + $goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0; + } + break; + case mt\Item::TOTAL_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); + $goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0; + } + break; + default: { + } + break; } $priceInfo = mt\Item::getPriceInfo($itemMeta); if (!empty($priceInfo)) { @@ -309,13 +335,15 @@ class ShopController extends BaseAuthedController { } } } - $this->_rspData(array( - 'info' => array( - 'shop_id' => $shopId, - 'goods_list1' => $goodsDtoList1, - 'goods_list2' => $goodsDtoList2, + $this->_rspData( + array( + 'info' => array( + 'shop_id' => $shopId, + 'goods_list1' => $goodsDtoList1, + 'goods_list2' => $goodsDtoList2, + ) ) - )); + ); } public function buyGoods() @@ -345,54 +373,49 @@ class ShopController extends BaseAuthedController { $buyRecordHash = ShopBuyRecord::allToHash(); $boughtTimes = 1; switch ($itemMeta['limit_type']) { - case mt\Item::DAILY_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); - $boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1: 1; - if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $itemMeta['limit_num']) { - $this->_rspErr(2, 'Has reached the maximum number of purchase restrictions today'); - return; - } - if ($itemMeta['limit_num'] <= 0) { - $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); - return; - } - } - break; - case mt\Item::WEEKLY_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); - $boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1: 1; - if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $itemMeta['limit_num']) { - $this->_rspErr(2, 'The maximum number of purchase restrictions this week has been reached'); - return; - } - if ($itemMeta['limit_num'] <= 0) { - $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); - return; - } - } - break; - case mt\Item::TOTAL_BUY_LIMIT: - { - $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); - $boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1: 1; - if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $itemMeta['limit_num']) { - $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); - return; - } - if ($itemMeta['limit_num'] <= 0) { - $this->_rspErr(2, 'he maximum number of purchase restrictions has been reached'); - return; - } - } - break; - default: - { - } - break; - } - { + case mt\Item::DAILY_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); + $boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1; + if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $itemMeta['limit_num']) { + $this->_rspErr(2, 'Has reached the maximum number of purchase restrictions today'); + return; + } + if ($itemMeta['limit_num'] <= 0) { + $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); + return; + } + } + break; + case mt\Item::WEEKLY_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); + $boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1; + if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $itemMeta['limit_num']) { + $this->_rspErr(2, 'The maximum number of purchase restrictions this week has been reached'); + return; + } + if ($itemMeta['limit_num'] <= 0) { + $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); + return; + } + } + break; + case mt\Item::TOTAL_BUY_LIMIT: { + $buyRecord = getXVal($buyRecordHash, $itemMeta['id']); + $boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1; + if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $itemMeta['limit_num']) { + $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); + return; + } + if ($itemMeta['limit_num'] <= 0) { + $this->_rspErr(2, 'he maximum number of purchase restrictions has been reached'); + return; + } + } + break; + default: { + } + break; + } { $errCode = 0; $errMsg = ''; if (!$this->canBuy($itemMeta, $errCode, $errMsg)) { @@ -433,29 +456,31 @@ class ShopController extends BaseAuthedController { 'limit_type' => $itemMeta['limit_type'], 'bought_times' => $boughtTimes, 'total_buy_times' => $itemMeta['limit_num'], - ); - { + ); { $priceInfo = mt\Item::getPriceInfo($itemMeta); if (!empty($priceInfo)) { $goodsDto['price_info'] = $priceInfo['price_info']; } } $propertyChgService->addUserChg(); - $this->_rspData(array( - 'award' => $awardService->toDto(), - 'property_chg' => $propertyChgService->toDto(), - 'goods_chg' => $goodsDto - )); + $this->_rspData( + array( + 'award' => $awardService->toDto(), + 'property_chg' => $propertyChgService->toDto(), + 'goods_chg' => $goodsDto + ) + ); } public function getDiscountList() { - $items = array(); - { - $types = array(mt\Item::HERO_TYPE, - mt\Item::HERO_SKIN_TYPE, - mt\Item::GUN_SKIN_TYPE); - mt\Item::filter(function ($meta) use(&$items, &$types) { + $items = array(); { + $types = array( + mt\Item::HERO_TYPE, + mt\Item::HERO_SKIN_TYPE, + mt\Item::GUN_SKIN_TYPE + ); + mt\Item::filter(function ($meta) use (&$items, &$types) { if (mt\Item::inTypes($meta, $types)) { array_push($items, $meta); } @@ -463,7 +488,7 @@ class ShopController extends BaseAuthedController { }); } $goodsDtoList = array(); - array_walk($items, function ($val) use(&$priceList, &$goodsDtoList) { + array_walk($items, function ($val) use (&$priceList, &$goodsDtoList) { $goodsDto = array( 'item_id' => $val['id'], 'gold_discount' => 0, @@ -475,16 +500,14 @@ class ShopController extends BaseAuthedController { foreach ($costGroup as $cost) { if ($cost['discount'] > 0) { switch ($cost['item_id']) { - case V_ITEM_GOLD: - { - $goodsDto['gold_discount'] = $cost['discount']; - } - break; - case V_ITEM_DIAMOND: - { - $goodsDto['diamond_discount'] = $cost['discount']; - } - break; + case V_ITEM_GOLD: { + $goodsDto['gold_discount'] = $cost['discount']; + } + break; + case V_ITEM_DIAMOND: { + $goodsDto['diamond_discount'] = $cost['discount']; + } + break; } } } @@ -492,11 +515,13 @@ class ShopController extends BaseAuthedController { if ($goodsDto['gold_discount'] > 0 || $goodsDto['diamond_discount'] > 0) { array_push($goodsDtoList, $goodsDto); } - } + } }); - $this->_rspData(array( - 'goods_list' => $goodsDtoList, - )); + $this->_rspData( + array( + 'goods_list' => $goodsDtoList, + ) + ); } private function outsideBuy($shopId, $itemId, $itemNum, $costItemId) @@ -516,14 +541,15 @@ class ShopController extends BaseAuthedController { $this->_rspErr(1, 'cost_item_id parameter error'); return; } - $types = array(mt\Item::HERO_TYPE, - mt\Item::HERO_SKIN_TYPE, - mt\Item::GUN_SKIN_TYPE); + $types = array( + mt\Item::HERO_TYPE, + mt\Item::HERO_SKIN_TYPE, + mt\Item::GUN_SKIN_TYPE + ); if (!mt\Item::inTypes($itemMeta, $types)) { $this->_rspErr(1, 'item_id parameter error'); return; - } - { + } { $errCode = 0; $errMsg = ''; if (!$this->canBuy($itemMeta, $errCode, $errMsg)) { @@ -564,29 +590,31 @@ class ShopController extends BaseAuthedController { 'limit_type' => $itemMeta['limit_type'], 'bought_times' => 0, 'total_buy_times' => $itemMeta['limit_num'], - ); - { + ); { $priceInfo = mt\Item::getPriceInfo($itemMeta); if (!empty($priceInfo)) { $goodsDto['price_info'] = $priceInfo; } } $propertyChgService->addUserChg(); - $this->_rspData(array( - 'award' => $awardService->toDto(), - 'property_chg' => $propertyChgService->toDto(), - 'goods_chg' => $goodsDto - )); + $this->_rspData( + array( + 'award' => $awardService->toDto(), + 'property_chg' => $propertyChgService->toDto(), + 'goods_chg' => $goodsDto + ) + ); } private function getOutsideShopInfo() { - $items = array(); - { - $types = array(mt\Item::HERO_TYPE, - mt\Item::HERO_SKIN_TYPE, - mt\Item::GUN_SKIN_TYPE); - mt\Item::filter(function ($meta) use(&$items, &$types) { + $items = array(); { + $types = array( + mt\Item::HERO_TYPE, + mt\Item::HERO_SKIN_TYPE, + mt\Item::GUN_SKIN_TYPE + ); + mt\Item::filter(function ($meta) use (&$items, &$types) { if (mt\Item::inTypes($meta, $types)) { array_push($items, $meta); } @@ -595,7 +623,7 @@ class ShopController extends BaseAuthedController { } $goodsDtoList1 = array(); $goodsDtoList2 = array(); - array_walk($items, function ($val) use(&$priceList, &$goodsDtoList1, &$goodsDtoList2) { + array_walk($items, function ($val) use (&$priceList, &$goodsDtoList1, &$goodsDtoList2) { $goodsDto = array( 'goods_id' => $val['id'], 'item_id' => $val['id'], @@ -611,19 +639,21 @@ class ShopController extends BaseAuthedController { array_push($goodsDtoList1, $goodsDto); } }); - $this->_rspData(array( - 'info' => array( - 'shop_id' => mt\Shop::OUTSIDE_SHOP, - 'goods_list1' => $goodsDtoList1, - 'goods_list2' => $goodsDtoList2, + $this->_rspData( + array( + 'info' => array( + 'shop_id' => mt\Shop::OUTSIDE_SHOP, + 'goods_list1' => $goodsDtoList1, + 'goods_list2' => $goodsDtoList2, + ) ) - )); + ); } private function getCostItems($priceInfo, $costItemId) { $costGroup = null; - array_walk($priceInfo['price_info']['cost_list'], function ($val) use(&$costGroup, $costItemId) { + array_walk($priceInfo['price_info']['cost_list'], function ($val) use (&$costGroup, $costItemId) { if ($costGroup) { return; } @@ -637,19 +667,22 @@ class ShopController extends BaseAuthedController { } $costItems = array(); array_walk($costGroup, function ($val) use (&$costItems, $priceInfo) { - if ($val['discount'] > 0 && + if ( + $val['discount'] > 0 && $this->_getNowTime() >= $priceInfo['discount_begin_time'] && $this->_getNowTime() <= $priceInfo['discount_end_time'] ) { array_push($costItems, array( 'item_id' => $val['item_id'], - 'item_num' => (int)($val['item_num'] * ($priceInfo['discount'] / 100)), - )); + 'item_num' => (int) ($val['item_num'] * ($priceInfo['discount'] / 100)), + ) + ); } else { array_push($costItems, array( 'item_id' => $val['item_id'], 'item_num' => $val['item_num'], - )); + ) + ); } }); return $costItems; @@ -658,37 +691,32 @@ class ShopController extends BaseAuthedController { private function internalAddItem($propertyChgService, $itemMeta) { switch ($itemMeta['type']) { - case mt\Item::HERO_TYPE: - { - Hero::addHero($itemMeta); - $propertyChgService->addHeroChg(); - $propertyChgService->addUserChg(); - } - break; - case mt\Item::HERO_SKIN_TYPE: - { - HeroSkin::addSkin($itemMeta); - $propertyChgService->addHeroSkinChg(); - } - break; - case mt\Item::GUN_TYPE: - { - Gun::addGun($itemMeta); - $propertyChgService->addGunChg(); - } - break; - case mt\Item::GUN_SKIN_TYPE: - { - GunSkin::addSkin($itemMeta); - $propertyChgService->addGunSkinChg(); - } - break; - default: - { - Bag::addItem($itemMeta['id'], 1); - $propertyChgService->addBagChg(); - } - break; + case mt\Item::HERO_TYPE: { + Hero::addHero($itemMeta); + $propertyChgService->addHeroChg(); + $propertyChgService->addUserChg(); + } + break; + case mt\Item::HERO_SKIN_TYPE: { + HeroSkin::addSkin($itemMeta); + $propertyChgService->addHeroSkinChg(); + } + break; + case mt\Item::GUN_TYPE: { + Gun::addGun($itemMeta); + $propertyChgService->addGunChg(); + } + break; + case mt\Item::GUN_SKIN_TYPE: { + GunSkin::addSkin($itemMeta); + $propertyChgService->addGunSkinChg(); + } + break; + default: { + Bag::addItem($itemMeta['id'], 1); + $propertyChgService->addBagChg(); + } + break; } } @@ -697,43 +725,39 @@ class ShopController extends BaseAuthedController { $errCode = 0; $errMsg = ''; switch ($itemMeta['type']) { - case mt\Item::HERO_TYPE: - { - $heroDb = Hero::find($itemMeta['id']); - if ($heroDb) { - $errCode = 10; - $errMsg = 'You already have the hero'; - return false; - } - } - break; - case mt\Item::HERO_SKIN_TYPE: - { - $heroSkinDb = HeroSkin::find($itemMeta['id']); - if ($heroSkinDb) { - $errCode = 10; - $errMsg = 'You already have the skin'; - return false; - } - } - break; - case mt\Item::GUN_SKIN_TYPE: - { - $gunSkinDb = GunSkin::find($itemMeta['id']); - if ($gunSkinDb) { - $errCode = 10; - $errMsg = 'You already have the skin'; - return false; - } - } - break; - default: - { - return true; - } - break; + case mt\Item::HERO_TYPE: { + $heroDb = Hero::find($itemMeta['id']); + if ($heroDb) { + $errCode = 10; + $errMsg = 'You already have the hero'; + return false; + } + } + break; + case mt\Item::HERO_SKIN_TYPE: { + $heroSkinDb = HeroSkin::find($itemMeta['id']); + if ($heroSkinDb) { + $errCode = 10; + $errMsg = 'You already have the skin'; + return false; + } + } + break; + case mt\Item::GUN_SKIN_TYPE: { + $gunSkinDb = GunSkin::find($itemMeta['id']); + if ($gunSkinDb) { + $errCode = 10; + $errMsg = 'You already have the skin'; + return false; + } + } + break; + default: { + return true; + } + break; } return true; } -} +} \ No newline at end of file From 486962f875fc063c896ec13d2ad6109572914dea Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 4 Apr 2023 21:19:31 +0800 Subject: [PATCH 02/15] ... --- webapp/controller/ShopController.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 6b8a38f8..11bbacd5 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -52,7 +52,7 @@ class ShopController extends BaseAuthedController $goodsList = $goodsList ? $goodsList : array(); $buyRecordHash = ShopBuyRecord::allToHash(); - foreach ($goodsList as $goods) { + foreach ($goodsList as &$goods) { $goods['bought_times'] = 0; switch ($goods['limit_type']) { case mt\Item::DAILY_BUY_LIMIT: { @@ -62,12 +62,12 @@ class ShopController extends BaseAuthedController break; case mt\Item::WEEKLY_BUY_LIMIT: { $buyRecord = getXVal($buyRecordHash, $goods['id']); - $goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0; + $goods['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0; } break; case mt\Item::TOTAL_BUY_LIMIT: { $buyRecord = getXVal($buyRecordHash, $goods['id']); - $goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0; + $goods['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0; } break; default: { From 399e3a00db1d6da7b7e8e027446cde83d7675bc6 Mon Sep 17 00:00:00 2001 From: songliang Date: Tue, 4 Apr 2023 21:22:12 +0800 Subject: [PATCH 03/15] ... --- doc/_common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/_common.py b/doc/_common.py index 064f3977..cbd5814f 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -394,7 +394,8 @@ class NewGoods(object): ['limit_num', 0, '限购数量'], ['buy_cond', '', '购买条件'], ['buy_gift', '', '购买次数赠品'], - ['normal_gift', '', '普通狗赠品'] + ['normal_gift', '', '普通狗赠品'], + ['bought_times', 0, '已购买次数'] ] class ShopName(object): From 2d645b19c14e6a95db25da7e0863884f954fc3ea Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 6 Apr 2023 17:31:09 +0800 Subject: [PATCH 04/15] 1 --- sql/gamedb.sql | 19 ++++++++++++ webapp/controller/BattleController.class.php | 18 +++++++++++ webapp/controller/UserController.class.php | 32 ++++++++++---------- 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 0776cb8f..3a6060a6 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -699,6 +699,25 @@ CREATE TABLE `t_battle_settlement_team` ( ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `t_battle_settlement_team` +-- + +DROP TABLE IF EXISTS `t_battle_input`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_battle_input` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `battle_uuid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', + `room_uuid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'room_id', + `input` mediumblob COMMENT 'input', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `battle_room_uuid` (`battle_uuid`, `room_uuid`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `t_battle_history` -- diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 0a6f009c..f6888313 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -129,6 +129,24 @@ class BattleController extends BaseAuthedController { $this->_rspErr(1, 'Repeated request'); return; } + SqlHelper::upsert + (myself()->_getSelfMysql(), + 't_battle_input', + array( + 'battle_uuid' => $battle_uuid, + 'room_uuid' => $room_uuid, + ), + array( + 'input' => json_encode($data) + ), + array( + 'battle_uuid' => $battle_uuid, + 'room_uuid' => $room_uuid, + 'input' => json_encode($data), + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), + ) + ); $teamList = array(); if ($data) { $teamList = $data['team_list']; diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 5ec55eb4..7796e135 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -130,17 +130,17 @@ class UserController extends BaseAuthedController { } private function _addFreeItem(){ - $chipMeta = \mt\Item::getMetaListByType(\mt\Item::CHIP_TYPE); - foreach ($chipMeta as $row){ - Chip::addChip($row); - } - - foreach (mt\Parameter::getListValue('creator_hero_id') as $heroId) { - $heroMeta = mt\Item::get($heroId); - if ($heroMeta) { - Hero::addHero($heroMeta); - } - } +// $chipMeta = \mt\Item::getMetaListByType(\mt\Item::CHIP_TYPE); +// foreach ($chipMeta as $row){ +// Chip::addChip($row); +// } +// +// foreach (mt\Parameter::getListValue('creator_hero_id') as $heroId) { +// $heroMeta = mt\Item::get($heroId); +// if ($heroMeta) { +// Hero::addHero($heroMeta); +// } +// } $addItems =array(); foreach (mt\Parameter::getListValue('creator_present_items') as $itemsStr) { list($itemId, $itemNum) = explode(':', $itemsStr); @@ -152,11 +152,11 @@ class UserController extends BaseAuthedController { )); } } - array_push($addItems, - array( - 'item_id' => V_ITEM_GOLD, - 'item_num' => 50 - )); +// array_push($addItems, +// array( +// 'item_id' => V_ITEM_GOLD, +// 'item_num' => 50 +// )); $awardService = new services\AwardService(); $propertyChgService = new services\PropertyChgService(); From d48f40660e5d438540c4be4b7dbc8a63cb3f7ede Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 6 Apr 2023 20:31:28 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=9A=84=E9=9A=8F=E6=9C=BA=E5=AE=9D=E7=AE=B1=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BaseAuthedController.class.php | 20 +++++++++++++++++++ webapp/controller/BattleController.class.php | 14 +------------ webapp/mt/Item.php | 2 ++ webapp/services/AwardService.php | 17 ++++++++++++---- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 58bb676e..c585717b 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -463,6 +463,11 @@ class BaseAuthedController extends BaseController { $propertyService->addChip(); } break; + case mt\Item::RANDOM_BOX_TYPE: + { + $this->_openRandomBox($itemMeta,$awardService,$propertyService); + } + break; default: { $this->_addLog('additems', 'invalid_item', array( @@ -489,6 +494,21 @@ class BaseAuthedController extends BaseController { } } + public function _openRandomBox($itemMeta,$awardService,$propertyService){ + if ($itemMeta['include_item_id']) { + $includeItemIds = explode('|', $itemMeta['include_item_id']); + $key = array_rand($includeItemIds,1); + + $items = array( + array( + 'item_id' => $includeItemIds[$key] , + 'item_num' => 1 + ) + ); + $this->_addItems($items,$awardService,$propertyService); + } + } + public function _addTryUsingItems($items) { foreach ($items as $item) { diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index f6888313..ed711803 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -186,19 +186,7 @@ class BattleController extends BaseAuthedController { // $this->_rspData($data); $this->_rspOk(); } - - public function test(){ -// echo "当前时间=>" . time() . '|' . date('Y-m-d H:i:s',time()) ; -// echo "当天时间=>" . $this->_getDaySeconds(time()) . '|' . date('Y-m-d H:i:s',$this->_getDaySeconds(time())); -// echo "下一天时间=>" . ($this->_getDaySeconds(time())+3600*24) . '|' . date('Y-m-d H:i:s',$this->_getDaySeconds(time())+3600*24); -// echo "当周时间=>" . $this->_getMondaySeconds() . '|' . date('Y-m-d H:i:s',$this->_getMondaySeconds()); -// echo "下周时间=>" . ($this->_getMondaySeconds() + 7*24*3600) . '|' . date('Y-m-d H:i:s',$this->_getMondaySeconds() + 7*24*3600); -// $this->switchAccount('james'); -// $user = $this->_getOrmUserInfo(); -// print_r($user); - - } - + /* http post php://input diff --git a/webapp/mt/Item.php b/webapp/mt/Item.php index 65561bbc..e88e82ad 100644 --- a/webapp/mt/Item.php +++ b/webapp/mt/Item.php @@ -94,6 +94,8 @@ class Item { const PARACHUTE_TYPE = 16; const CHIP_BOX_TYPE = 17; const RING_TYPE = 19; + const EMOJI_TYPE = 20; + const RANDOM_BOX_TYPE = 21; const FUNC_RENAME_CARD_SUBTYPE = 1; const MATERIAL_CHIP_SUBTYPE = 3; diff --git a/webapp/services/AwardService.php b/webapp/services/AwardService.php index ea7d0b9f..ed099262 100644 --- a/webapp/services/AwardService.php +++ b/webapp/services/AwardService.php @@ -2,6 +2,8 @@ namespace services; +use mt\Item; + class AwardService extends BaseService { private $items = array(); @@ -14,10 +16,17 @@ class AwardService extends BaseService { return; } } - array_push($this->items, array( - 'item_id' => $itemId, - 'item_num' => $itemNum - )); + $itemMeta = Item::get($itemId); + if (!in_array( + array( + Item::RANDOM_BOX_TYPE, + ), $itemMeta['type'])){ + array_push($this->items, array( + 'item_id' => $itemId, + 'item_num' => $itemNum + )); + } + } public function toDto() From fe6a3076bebe3e2a1f56ed5f8d598a361ec70889 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 6 Apr 2023 20:52:21 +0800 Subject: [PATCH 06/15] 1 --- webapp/services/AwardService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/services/AwardService.php b/webapp/services/AwardService.php index ed099262..4b4cffed 100644 --- a/webapp/services/AwardService.php +++ b/webapp/services/AwardService.php @@ -18,9 +18,9 @@ class AwardService extends BaseService { } $itemMeta = Item::get($itemId); if (!in_array( - array( - Item::RANDOM_BOX_TYPE, - ), $itemMeta['type'])){ + $itemMeta['type'],array( + Item::RANDOM_BOX_TYPE, + ))){ array_push($this->items, array( 'item_id' => $itemId, 'item_num' => $itemNum From e15d77a187fb14e4eb688bccc30e68a8e2474926 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 11:13:22 +0800 Subject: [PATCH 07/15] 1 --- doc/_common.py | 92 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 14 deletions(-) diff --git a/doc/_common.py b/doc/_common.py index cbd5814f..f3a0208a 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -883,10 +883,11 @@ class BattleCegReward(object): def __init__(self): self.fields = [ - ['uuid', '', '唯一id'], - ['curr_ceg', 0, '当前ceg数量'], - ['obtain_ceg', 0, '实际获得ceg数量'], - ['ceg_uplimit', 0, 'ceg数量上限'], + ['hero_uniid', '', '唯一id'], + ['id', '', 'id'], + ['gold_uplimit', 0, '当前ceg数量'], + ['obtain_gold', 0, '实际获得ceg数量'], + ['curr_gold', 0, 'ceg数量上限'], ] class BattleItemReward(object): @@ -897,16 +898,6 @@ class BattleItemReward(object): ['item_num', 0, '道具数量'], ] -class BattleReward(object): - - def __init__(self): - self.fields = [ - ['hero', BattleCegReward(), '英雄奖励'], - ['weapon1', BattleCegReward(), '武器1奖励'], - ['weapon2', BattleCegReward(), '武器2奖励'], - ['!items', [BattleItemReward()], '碎片奖励'], - ['lvInfo', [['oldLv',0,'老等级'],['newLv',0,'新等级']], '等级信息'], - ] class BattleRankScore(object): @@ -1099,3 +1090,76 @@ class TeamReportTeam(object): ['team_id', 0, '队伍id'], ['!members', [['account_id', '', '账号id']], '枪械属性'], ] + +class BattleSettlement(object): + + def __init__(self): + self.fields = [ + ['version', 0, '版本'], + ['battle_uuid', 0, '本次战斗唯一id'], + ['team_id', 0, '队伍id'], + ['room_uuid', 0, '房间唯一id'], + ['room_mode', 0, '0:pvp 1: pve'], + ['team_mode', 0, '0:个人 1:组队(保留)'], + ['game_over', 0, '游戏是否结束'], + ['victory', 0, '是否胜利(pvp:吃鸡 pve:是否通关)'], + ['watchable', 0, '是否可观战,小胡那的接口写死0(看历史不可观战)'], + ['map_id', 0, '地图id'], + ['settlement_status', 0, '0: 结算中(读取个人结算数据) 1:已结算(请求小胡接口)'], + ['pvp_settlement_type', 0, '結算類型0:個人 1:組隊(保留)'], + ['pvp_settlement_color', 0, '0:灰 1:黃'], + ['pvp_team_rank', 0, '队伍排名'], + ['pvp_total_human_num', 0, '房间总人数'], + ['pvp_alive_human_num', 0, '房间剩余存活人数'], + ['pvp_total_team_num', 0, '本次战斗队伍总数'], + ['pvp_match_mode', 0, '比赛模式 0: pvp 1:排位赛'], + ['pve_settlement_color', 0, '0:灰 1:黃'], + ['pve_wave', 0, 'pve波次'], + ['pve_max_wave', 0, 'pve总波次'], + ['pve_instance_id', 0, 'pve副本id'], + ['!members', [BattleSettlementMembersInfo()], '队伍成员信息'], + ] + +class BattleSettlementMembersInfo(object): + + def __init__(self): + self.fields = [ + ['account_id', 0, '账号id(真人才有account_id)'], + ['name', '', '玩家名字'], + ['head', 0, '头像id'], + ['head_frame', 0, '头像框'], + ['sex', 0, '性别'], + ['hero_uniid', 0, '英雄uniid'], + ['hero_id', 0, '英雄itemId'], + ['dead', 0, '是否已死亡'], + ['is_mvp', 0, '是否mvp'], + ['old_rank', 0, '老段位'], + ['new_rank', 0, '新段位'], + ['old_score', 0, '老段位积分'], + ['new_score', 0, '新段位积分'], + ['pvp_kill', 0, 'pvp击杀敌人数'], + ['pvp_damage', 0, 'pvp伤害总量'], + ['pvp_assist', 0, 'pvp助攻'], + ['pvp_survia_time', 0, 'pvp存活时间(毫秒)'], + ['pvp_recover', 0, 'pvp治疗总量'], + ['pvp_rescue', 0, 'pvp救援'], + ['pvp_personal_rank', 0, '个人排名'], + ['pve_order', 0, 'pve波次'], + ['pve_score', 0, 'pve分数'], + ['pve_star', 0, 'pve星'], + ['pve_damage', 0, 'pve伤害总量'], + ['pve_revive', 0, 'pve复活次数'], + ['pve_survia_time', 0, 'pvp存活时间(毫秒)'], + ['pve_wave', 0, 'pve波次'], + ['pve_max_wave', 0, 'pve总波次'], + ['pve_boss_killed', 0, 'pve副本boos是否被击杀'], + ['reward', BattleReward(), 'reward'], + ] + +class BattleReward(object): + + def __init__(self): + self.fields = [ + ['hero', BattleCegReward(), '英雄奖励'], + ['!items', [BattleItemReward()], '碎片奖励'], + ] \ No newline at end of file From 873b5e831ded3b9f7f7215a797532d6df297a57f Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 11:16:15 +0800 Subject: [PATCH 08/15] 1 --- doc/Battle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Battle.py b/doc/Battle.py index 4a14f6f8..c5b2ead7 100644 --- a/doc/Battle.py +++ b/doc/Battle.py @@ -47,7 +47,7 @@ class Battle(object): ], 'response': [ _common.RspHead(), - ['info', [], '战绩详情'], + ['!info', [_common.BattleSettlement()], '战绩详情'], ] }, ] From 4155d71b3c1bcf1481bcf4826b38c5d97f375d23 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 11:17:06 +0800 Subject: [PATCH 09/15] 1 --- doc/Battle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Battle.py b/doc/Battle.py index c5b2ead7..0bf2731a 100644 --- a/doc/Battle.py +++ b/doc/Battle.py @@ -47,7 +47,7 @@ class Battle(object): ], 'response': [ _common.RspHead(), - ['!info', [_common.BattleSettlement()], '战绩详情'], + ['info', _common.BattleSettlement(), '战绩详情'], ] }, ] From 6fcc9936b079f3b36bf788b88fd47cd967ed7a4b Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 13:43:36 +0800 Subject: [PATCH 10/15] 1 --- webapp/services/TameBattleDataService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/services/TameBattleDataService.php b/webapp/services/TameBattleDataService.php index 1ccc17ff..1d5266de 100644 --- a/webapp/services/TameBattleDataService.php +++ b/webapp/services/TameBattleDataService.php @@ -129,6 +129,7 @@ class TameBattleDataService extends BaseService { case self::MATCH_MODE_RANK: { //排位赛 + $this->updatePvpData(); $this->updateRankData(); $this->updateScore(); $this->settlementReward(); From 3b14400af6f9c4274192c7e0f96198ca9fa384c6 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 15:05:12 +0800 Subject: [PATCH 11/15] 1 --- webapp/controller/UserController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 7796e135..5ace20d6 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -49,7 +49,7 @@ class UserController extends BaseAuthedController { $userInfo = $this->_safeGetOrmUserInfo(); if (!$userInfo) { $this->createNewUserV2($userName); - $this->_addFreeItem2(); //送 50 Test_CEG + $this->_addFreeItem(); //送 50 Test_CEG $userInfo = $this->_getOrmUserInfo(); $this->_setV(TN_RANK_STATUS, 0, 1); } From fdaf16e172b09634599cbf9c8a7d78866083ade7 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 15:16:27 +0800 Subject: [PATCH 12/15] 2 --- .../controller/FragmentController.class.php | 22 +++++-------------- webapp/controller/UserController.class.php | 17 -------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/webapp/controller/FragmentController.class.php b/webapp/controller/FragmentController.class.php index 658ea969..531a8f16 100644 --- a/webapp/controller/FragmentController.class.php +++ b/webapp/controller/FragmentController.class.php @@ -39,24 +39,13 @@ class FragmentController extends BaseAuthedController switch ($type) { case 1: { -// $itemMetaList = mt\Item::getMetaListByType(mt\Item::HERO_TYPE); -// $hero = array(); -// foreach ($itemMetaList as $meta){ -// array_push($hero,$meta['id']); -// } + $itemMetaList = mt\Item::getMetaListByType(mt\Item::HERO_TYPE); + $hero = array(); + foreach ($itemMetaList as $meta){ + array_push($hero,$meta['id']); + } $meta = mt\Parameter::getByName('jigsaw_merge_h_price'); $mint = $meta ? $meta['param_value'] : 100; - $hero = array( - 30100, - 30500, - 30600, - 30700, - 30900, - 31000, - 30200, - 30300, - 30400, - ); $this->_rspData(array( 'list' => $hero, 'mint' => $mint @@ -70,7 +59,6 @@ class FragmentController extends BaseAuthedController foreach ($itemMetaList as $meta){ array_push($gun,$meta['id']); } -// $mint = strval(\services\FormulaService::Weapon_Parts_Synthetic_Cost()); $meta = mt\Parameter::getByName('jigsaw_merge_w_price'); $mint = $meta ? $meta['param_value'] : 20; $this->_rspData(array( diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 5ace20d6..618880fc 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -130,17 +130,6 @@ class UserController extends BaseAuthedController { } private function _addFreeItem(){ -// $chipMeta = \mt\Item::getMetaListByType(\mt\Item::CHIP_TYPE); -// foreach ($chipMeta as $row){ -// Chip::addChip($row); -// } -// -// foreach (mt\Parameter::getListValue('creator_hero_id') as $heroId) { -// $heroMeta = mt\Item::get($heroId); -// if ($heroMeta) { -// Hero::addHero($heroMeta); -// } -// } $addItems =array(); foreach (mt\Parameter::getListValue('creator_present_items') as $itemsStr) { list($itemId, $itemNum) = explode(':', $itemsStr); @@ -152,12 +141,6 @@ class UserController extends BaseAuthedController { )); } } -// array_push($addItems, -// array( -// 'item_id' => V_ITEM_GOLD, -// 'item_num' => 50 -// )); - $awardService = new services\AwardService(); $propertyChgService = new services\PropertyChgService(); $this->_addItems($addItems, $awardService, $propertyChgService); From bc1e6147602e5e8eb095d0bf2286d2df53d90af5 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 16:48:24 +0800 Subject: [PATCH 13/15] 1 --- webapp/mt/Skill.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/mt/Skill.php b/webapp/mt/Skill.php index e047f198..574cd996 100644 --- a/webapp/mt/Skill.php +++ b/webapp/mt/Skill.php @@ -6,7 +6,7 @@ use phpcommon; class Skill { - const DEFAULT_SKILL = 10101; + const DEFAULT_SKILL = 10401; public static function get($id) { return getXVal(self::getMetaList(), $id); From 1750ddcd2266244c2f496876205a9d89f7e9d032 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 17:11:48 +0800 Subject: [PATCH 14/15] 1 --- webapp/controller/ShopController.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 11bbacd5..b12f81aa 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -14,6 +14,7 @@ require_once('models/HeroSkin.php'); require_once('models/Gun.php'); require_once('models/GunSkin.php'); require_once('models/ShopBuyRecord.php'); +require_once('models/Chip.php'); require_once('services/AwardService.php'); require_once('services/PropertyChgService.php'); @@ -26,6 +27,7 @@ use models\HeroSkin; use models\Gun; use models\GunSkin; use models\ShopBuyRecord; +use models\Chip; class ShopController extends BaseAuthedController { @@ -712,6 +714,11 @@ class ShopController extends BaseAuthedController $propertyChgService->addGunSkinChg(); } break; + case mt\Item::CHIP_TYPE: { + Chip::addChip($itemMeta); + $propertyChgService->addChip(); + } + break; default: { Bag::addItem($itemMeta['id'], 1); $propertyChgService->addBagChg(); From 24bcbc0b2c3a596ab13aeee27391b3bcd5615f96 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 7 Apr 2023 17:26:27 +0800 Subject: [PATCH 15/15] 1 --- webapp/controller/GunController.class.php | 16 ++++++++-------- webapp/controller/HeroController.class.php | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/webapp/controller/GunController.class.php b/webapp/controller/GunController.class.php index 256065d5..f6ef10f5 100644 --- a/webapp/controller/GunController.class.php +++ b/webapp/controller/GunController.class.php @@ -159,10 +159,10 @@ class GunController extends BaseAuthedController { 'item_id' => V_ITEM_GOLD, 'item_num' => $nextLevelMeta['gold'] ), - array( - 'item_id' => V_ITEM_DIAMOND, - 'item_num' => $nextLevelMeta['diamond'] - ), +// array( +// 'item_id' => V_ITEM_DIAMOND, +// 'item_num' => $nextLevelMeta['diamond'] +// ), ); $newGunDb = $gunDb; @@ -220,10 +220,10 @@ class GunController extends BaseAuthedController { 'item_id' => V_ITEM_GOLD, 'item_num' => $nextLevelMeta['gold'] ), - array( - 'item_id' => V_ITEM_DIAMOND, - 'item_num' => $nextLevelMeta['diamond'] - ), +// array( +// 'item_id' => V_ITEM_DIAMOND, +// 'item_num' => $nextLevelMeta['diamond'] +// ), ); $lackItem = null; if (!$this->_hasEnoughItems($costItems, $lackItem)) { diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index 8235bec1..7ca27bb9 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -131,10 +131,10 @@ class HeroController extends BaseAuthedController { 'item_id' => V_ITEM_GOLD, 'item_num' => $nextLevelMeta['gold'] ), - array( - 'item_id' => V_ITEM_DIAMOND, - 'item_num' => $nextLevelMeta['diamond'] - ) +// array( +// 'item_id' => V_ITEM_DIAMOND, +// 'item_num' => $nextLevelMeta['diamond'] +// ) ); $heroDto = Hero::toDto($heroDb); @@ -222,10 +222,10 @@ class HeroController extends BaseAuthedController { 'item_id' => V_ITEM_GOLD, 'item_num' => $nextLevelMeta['gold'] ), - array( - 'item_id' => V_ITEM_DIAMOND, - 'item_num' => $nextLevelMeta['diamond'] - ) +// array( +// 'item_id' => V_ITEM_DIAMOND, +// 'item_num' => $nextLevelMeta['diamond'] +// ) ); $lackItem = null; if (!$this->_hasEnoughItems($costItems, $lackItem)) {