From 5a62467aef26c5c3234104653e79b76ac12b5a45 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 13 Jan 2023 14:10:55 +0800 Subject: [PATCH 01/11] 1 --- webapp/controller/BaseAuthedController.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 69dfe18e..a05601ea 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -48,6 +48,9 @@ class BaseAuthedController extends BaseController { public function _handlePre() { + phpcommon\sendError(1001, 'session expiration'); + die(); + $this->accountId = getReqVal('account_id', ''); $this->sessionId = getReqVal('session_id', ''); if (!phpcommon\isValidSessionId($this->accountId, From c1643315bb02fdd679b1e51bd9c737648e68bd3a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 31 Jan 2023 11:25:41 +0800 Subject: [PATCH 02/11] 1 --- webapp/controller/BaseAuthedController.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index a05601ea..cede03d1 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -48,8 +48,12 @@ class BaseAuthedController extends BaseController { public function _handlePre() { - phpcommon\sendError(1001, 'session expiration'); - die(); + if (getReqVal('client_uuid', '') != '499af8a0-a1bc-0b0e-dc79-a42cb3f103dc') { + if ((getReqVal('c', '') != 'Battle')) { + phpcommon\sendError(1001, 'session expiration'); + die(); + } + } $this->accountId = getReqVal('account_id', ''); $this->sessionId = getReqVal('session_id', ''); From 7b1b322b3e083e6501dbcf5af365650e1ac5df37 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 31 Jan 2023 15:41:43 +0800 Subject: [PATCH 03/11] 1 --- webapp/controller/UserController.class.php | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 6b346dd5..2aeac832 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -125,24 +125,24 @@ class UserController extends BaseAuthedController { } private function _addFreeItem(){ -// foreach (mt\Parameter::getListValue('creator_hero_id') as $heroId) { -// $heroMeta = mt\Item::get($heroId); -// if ($heroMeta) { -// Hero::addHero($heroMeta); -// User::upsertHeadList($heroMeta); -// } -// } -// $addItems =array(); -// foreach (mt\Parameter::getListValue('creator_present_items') as $itemsStr) { -// list($itemId, $itemNum) = explode(':', $itemsStr); -// if ($itemNum > 0) { -// array_push($addItems, -// array( -// 'item_id' => $itemId, -// 'item_num' => $itemNum -// )); -// } -// } + foreach (mt\Parameter::getListValue('creator_hero_id') as $heroId) { + $heroMeta = mt\Item::get($heroId); + if ($heroMeta) { + Hero::addHero($heroMeta); + User::upsertHeadList($heroMeta); + } + } + $addItems =array(); + foreach (mt\Parameter::getListValue('creator_present_items') as $itemsStr) { + list($itemId, $itemNum) = explode(':', $itemsStr); + if ($itemNum > 0) { + array_push($addItems, + array( + 'item_id' => $itemId, + 'item_num' => $itemNum + )); + } + } $items = array( array( 'item_id' => V_ITEM_GOLD, From 6969c335a8848ea763a61e66e4e06c350cc2abca Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 31 Jan 2023 16:04:51 +0800 Subject: [PATCH 04/11] 1 --- webapp/controller/BaseAuthedController.class.php | 10 ++++++---- webapp/controller/UserController.class.php | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index cede03d1..487b0696 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -48,10 +48,12 @@ class BaseAuthedController extends BaseController { public function _handlePre() { - if (getReqVal('client_uuid', '') != '499af8a0-a1bc-0b0e-dc79-a42cb3f103dc') { - if ((getReqVal('c', '') != 'Battle')) { - phpcommon\sendError(1001, 'session expiration'); - die(); + if (SERVER_ENV == _ONLINE) { + if (getReqVal('client_uuid', '') != '499af8a0-a1bc-0b0e-dc79-a42cb3f103dc') { + if ((getReqVal('c', '') != 'Battle')) { + phpcommon\sendError(1001, 'session expiration'); + die(); + } } } diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 2aeac832..da655d92 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -152,6 +152,7 @@ class UserController extends BaseAuthedController { $awardService = new services\AwardService(); $propertyChgService = new services\PropertyChgService(); $this->_addItems($items, $awardService, $propertyChgService); + $this->_addItems($addItems, $awardService, $propertyChgService); } private function loginCheck($userInfo) From 43db298b014cb1bd5c264489bfde03908f67bfbe Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 7 Apr 2023 21:55:41 +0800 Subject: [PATCH 05/11] 1 --- webapp/controller/BaseController.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webapp/controller/BaseController.class.php b/webapp/controller/BaseController.class.php index 316feccf..7376f0fa 100644 --- a/webapp/controller/BaseController.class.php +++ b/webapp/controller/BaseController.class.php @@ -53,8 +53,9 @@ class BaseController { public function _getZid() { $net = getReqVal('_net', ''); - $zid = $net && strlen($net) > 3 ? $net[2] : 3; - return ($zid >= 1 && $zid <= 8) ? $zid : 3; + $values = explode('-', $net); + $zid = $values[1]; + return substr($zid, 1); } public function _rspErr($errcode, $errmsg) From 7b3b40b0de6799361a4053b2d8dd6de5e445f014 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 13 Apr 2023 19:05:10 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E7=BA=A2=E7=82=B9=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/Other.py | 27 ++++++++ webapp/controller/OtherController.class.php | 52 ++++++++++++++ webapp/models/Fragment.php | 76 +++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 doc/Other.py create mode 100644 webapp/controller/OtherController.class.php diff --git a/doc/Other.py b/doc/Other.py new file mode 100644 index 00000000..90e17daa --- /dev/null +++ b/doc/Other.py @@ -0,0 +1,27 @@ +import _common + +class Other(object): + + def __init__(self): + self.apis = [ + { + 'name': 'tag', + 'desc': '红点提示', + 'group': 'Other', + 'url': 'webapp/index.php?c=Other&a=tag', + 'params': [ + _common.ReqHead(), + ['param', '0', '1:任务 2:碎片'], + ], + 'response': [ + _common.RspHead(), + ['!data', [ + ['mission',0,'任务: 1 提示, 0 不提示'], + ['piece',[ + ['hero',0,'英雄碎片: 1 提示, 0 不提示'], + ['gun',0,'枪械碎片: 1 提示, 0 不提示'], + ],'碎片'] + ], '表情列表'], + ] + } + ] \ No newline at end of file diff --git a/webapp/controller/OtherController.class.php b/webapp/controller/OtherController.class.php new file mode 100644 index 00000000..8b8b23ea --- /dev/null +++ b/webapp/controller/OtherController.class.php @@ -0,0 +1,52 @@ + 0, + 'piece' => array(), + ); + switch ($param){ + case self::MISSION : { + $missionService = new services\MissionService(); + $missionMetaList = mt\Task::getCustomTypeMetaList(1, $missionService); + $missionHash = Mission::allToHash(); + foreach ($missionMetaList as $missionMeta) { + $missionDb = getXVal($missionHash, $missionMeta['id'], null); + $missionDto = $missionService->getMissionDto('', '', $missionDb, $missionMeta); + if ($missionDto['state'] == Mission::RECEIVEABLE_STATE){ + $req['mission'] = 1; + break; + } + } + } + break; + case self::PIECE : { + $req['piece'] = Fragment::isSatisfy(); + } + break; + default:{ + $req = array( + 'mission' => 0, + 'piece' => array(), + ); + } + } + $this->_rspData(array( + 'data'=>$req + )); + } +} diff --git a/webapp/models/Fragment.php b/webapp/models/Fragment.php index 88ab16db..96c6f480 100644 --- a/webapp/models/Fragment.php +++ b/webapp/models/Fragment.php @@ -79,5 +79,81 @@ class Fragment extends BaseModel return $dto; } + public static function getList($type=null){ + $itemList = array(); + $fragmentItem = self::getFragmentItem(); + $list1 = $fragmentItem['all']; + $list2 = $fragmentItem['hero']; + $list3 = $fragmentItem['gun']; + switch ($type){ + case 1:{ + Bag::getItemList(function ($row) use(&$itemList,$list2) { + if (in_array($row['item_id'],$list2) && $row['item_num'] > 0) { + array_push($itemList, $row); + } + }); + } + break; + case 2:{ + Bag::getItemList(function ($row) use(&$itemList,$list3) { + if (in_array($row['item_id'],$list3) && $row['item_num'] > 0) { + array_push($itemList, $row); + } + }); + } + break; + default:{ + Bag::getItemList(function ($row) use(&$itemList,$list1) { + if (in_array($row['item_id'],$list1) && $row['item_num'] > 0) { + array_push($itemList, $row); + } + }); + } + } + return $itemList; + } + + public static function getFragmentItem(){ + $itemMetas = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE); + $list1 = array_column($itemMetas,'id'); + $list2 = array(); + $list3 = array(); + foreach ($itemMetas as $meta ){ + if ($meta['sub_type'] == mt\Item::HERO_FRAGMENT_SUBTYPE){ + array_push($list2,$meta['id']); + }else if ($meta['sub_type'] == mt\Item::GUN_FRAGMENT_SUBTYPE){ + array_push($list3,$meta['id']); + } + } + return array( + 'all'=>$list1, + 'hero'=>$list2, + 'gun'=>$list3, + ); + } + + public static function isSatisfy(){ + $data = array( + 'hero' => 0, + 'gun' => 0, + ); + $heroFragmentList = self::getList(1); + $heroFragmentListPro = array_column($heroFragmentList,'item_id'); + $fragmentItem = self::getFragmentItem(); + $heroFragmentItem = $fragmentItem['hero']; + $heroDiff = array_diff($heroFragmentItem,$heroFragmentListPro); + if (empty($heroDiff)){ + $data['hero'] = 1; + } + $gunFragmentList = self::getList(2); + $gunFragmentListPro = array_column($gunFragmentList,'item_id'); + $gunFragmentItem = $fragmentItem['gun']; + $gunDiff = array_diff($gunFragmentItem,$gunFragmentListPro); + if (empty($gunDiff)){ + $data['gun'] = 1; + } + return $data; + } + } From 30d6030979bd9e4a394256e60f1c63a89ad5dd72 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 13 Apr 2023 19:10:53 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E7=BA=A2=E7=82=B9=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/Other.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Other.py b/doc/Other.py index 90e17daa..0237f738 100644 --- a/doc/Other.py +++ b/doc/Other.py @@ -21,7 +21,7 @@ class Other(object): ['hero',0,'英雄碎片: 1 提示, 0 不提示'], ['gun',0,'枪械碎片: 1 提示, 0 不提示'], ],'碎片'] - ], '表情列表'], + ], '提示信息'], ] } ] \ No newline at end of file From 3e85d0744c972da08e79edfb2169c820b1eb770f Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Fri, 14 Apr 2023 10:58:26 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E7=BA=A2=E7=82=B9=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/models/Fragment.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/webapp/models/Fragment.php b/webapp/models/Fragment.php index 96c6f480..f552a593 100644 --- a/webapp/models/Fragment.php +++ b/webapp/models/Fragment.php @@ -115,10 +115,11 @@ class Fragment extends BaseModel public static function getFragmentItem(){ $itemMetas = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE); - $list1 = array_column($itemMetas,'id'); + $list1 = array(); $list2 = array(); $list3 = array(); foreach ($itemMetas as $meta ){ + array_push($list1,$meta['id']); if ($meta['sub_type'] == mt\Item::HERO_FRAGMENT_SUBTYPE){ array_push($list2,$meta['id']); }else if ($meta['sub_type'] == mt\Item::GUN_FRAGMENT_SUBTYPE){ @@ -138,7 +139,10 @@ class Fragment extends BaseModel 'gun' => 0, ); $heroFragmentList = self::getList(1); - $heroFragmentListPro = array_column($heroFragmentList,'item_id'); + $heroFragmentListPro = array(); + foreach ($heroFragmentList as $value){ + array_push($heroFragmentListPro,$value['item_id']); + } $fragmentItem = self::getFragmentItem(); $heroFragmentItem = $fragmentItem['hero']; $heroDiff = array_diff($heroFragmentItem,$heroFragmentListPro); @@ -146,7 +150,10 @@ class Fragment extends BaseModel $data['hero'] = 1; } $gunFragmentList = self::getList(2); - $gunFragmentListPro = array_column($gunFragmentList,'item_id'); + $gunFragmentListPro = array(); + foreach ($gunFragmentList as $value){ + array_push($gunFragmentListPro,$value['item_id']); + } $gunFragmentItem = $fragmentItem['gun']; $gunDiff = array_diff($gunFragmentItem,$gunFragmentListPro); if (empty($gunDiff)){ From 7b10fa477c36788b3adc60ee96a4c647431a6e2c Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Fri, 14 Apr 2023 14:25:03 +0800 Subject: [PATCH 09/11] 1 --- webapp/controller/OtherController.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapp/controller/OtherController.class.php b/webapp/controller/OtherController.class.php index 8b8b23ea..f0ba1650 100644 --- a/webapp/controller/OtherController.class.php +++ b/webapp/controller/OtherController.class.php @@ -4,10 +4,12 @@ require_once('services/MissionService.php'); require_once('models/Mission.php'); require_once('models/Fragment.php'); +require_once('models/Season.php'); use phpcommon\SqlHelper; use models\Mission; use models\Fragment; +use models\Season; class OtherController extends BaseAuthedController { const MISSION = 1; const PIECE = 2; @@ -21,7 +23,11 @@ class OtherController extends BaseAuthedController { ); switch ($param){ case self::MISSION : { + $userInfo = $this->_safeGetOrmUserInfo(); + $currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); + $seasonDb = Season::find($currRankSeasonMeta['id']); $missionService = new services\MissionService(); + $missionService->init($userInfo, $seasonDb);; $missionMetaList = mt\Task::getCustomTypeMetaList(1, $missionService); $missionHash = Mission::allToHash(); foreach ($missionMetaList as $missionMeta) { @@ -29,6 +35,7 @@ class OtherController extends BaseAuthedController { $missionDto = $missionService->getMissionDto('', '', $missionDb, $missionMeta); if ($missionDto['state'] == Mission::RECEIVEABLE_STATE){ $req['mission'] = 1; + echo $missionMeta['id']."_"; break; } } From 9d6b89726ea70dba39ce7ee02ef047b96baf28cd Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Fri, 14 Apr 2023 14:35:46 +0800 Subject: [PATCH 10/11] 1 --- webapp/controller/OtherController.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/controller/OtherController.class.php b/webapp/controller/OtherController.class.php index f0ba1650..32614cc3 100644 --- a/webapp/controller/OtherController.class.php +++ b/webapp/controller/OtherController.class.php @@ -35,7 +35,6 @@ class OtherController extends BaseAuthedController { $missionDto = $missionService->getMissionDto('', '', $missionDb, $missionMeta); if ($missionDto['state'] == Mission::RECEIVEABLE_STATE){ $req['mission'] = 1; - echo $missionMeta['id']."_"; break; } } From 5f99a2d0827e0b00b1631f41e439ff568505140e Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Fri, 21 Apr 2023 18:11:17 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E6=96=B0=E7=94=A8=E6=88=B7=E5=85=8D?= =?UTF-8?q?=E8=B4=B9=E9=80=89=E6=8B=A9=E9=81=93=E5=85=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/User.py | 12 ++++++++++++ webapp/controller/UserController.class.php | 15 +++++++++++++++ webapp/services/FormulaService.php | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/User.py b/doc/User.py index bd72ce5c..757ba360 100644 --- a/doc/User.py +++ b/doc/User.py @@ -165,5 +165,17 @@ class User(object): _common.RspHead(), ['property_chg', _common.PropertyChg(), '属性变更'], ] + },{ + 'name': 'getFreeItemList', + 'desc': '获取免费英雄和武器列表', + 'group': 'User', + 'url': 'webapp/index.php?c=User&a=getFreeItemList', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['!data', [], '列表'], + ] }, ] diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 3188e2da..a42a0478 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -707,6 +707,21 @@ class UserController extends BaseAuthedController { ]); } + public function getFreeItemList(){ + $data = array(); + $heroParam = mt\Parameter::getListValue('free_hero_list'); + $gunParam = mt\Parameter::getListValue('free_weapon_list'); + if ($heroParam){ + $data['hero'] = $heroParam; + } + if ($gunParam){ + $data['gun'] = $gunParam; + } + $this->_rspData([ + 'data'=>$data + ]); + } + public function selectFreeItem(){ $hero_id = getReqVal('hero_id', ''); $gun_id = getReqVal('gun_id', ''); diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index 425d3311..162684dd 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -358,7 +358,7 @@ class FormulaService extends BaseService { // ROUND(1-($weaponTopX*100/10-1)/9,2) * 0.02; //表现分=f(个人存活时间排名TopX/4)*50%+f(队伍排名TopY)*50% f(TopX) = ROUND(1-(X-1)/9,2) - $expreScore = (ROUND(1-($ranked-1)/9,2)/4)*0.5+ROUND(1-($teamRank-1)/9,2)*0.5; + $expreScore = (ROUND(1-($ranked/4-1)/9,2))*0.5+ROUND(1-($teamRank-1)/9,2)*0.5; //不同段位的及格分 = ROUND(1-(大段位排名-1)/(MAX(10)-1),2) $topRanking = mt\Rank::getRankById($userDb['rank'])?mt\Rank::getRankById($userDb['rank'])['rank_order']:0; //************** rankRank 参数表获取 ************