diff --git a/doc/Team.py b/doc/Team.py index 77d4abfc..8a92e948 100644 --- a/doc/Team.py +++ b/doc/Team.py @@ -15,7 +15,7 @@ class Team(object): _common.ReqHead(), ['node_id', 0, '节点id'], ['map_id', 0, '地图id'], - ['match_mode', 0, '0: 匹配赛模式 1: 排位赛 3: pve'], + ['match_mode', 0, '0: 匹配赛模式 1: 排位赛 2: pve'], ['pve_instance_id', 0, 'pve副本id'], ], 'response': [ diff --git a/doc/_common.py b/doc/_common.py index e2c08feb..9641ca5e 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -701,6 +701,7 @@ class Chip(object): ['strength', '', '前一天体力值'], ['strength_temporary', '', '升级成功所得出的总体力值'], ['mint', '', '所需mint费'], + ['belong_to_item_id', '', '所镶嵌的英雄或枪械的item id'], ] diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index 3e1ea77b..bc5ebfb4 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -94,9 +94,31 @@ class Chip extends BaseModel $row['rand_attr'] = $attrs; $row['today_get_gold'] = $todayGetGold; $row['last_get_gold_time'] = $lastGetGoldTime; + $row['belong_to_item_id'] = self::belongsToWhere($row); return $row; } + public static function belongsToWhere($row){ + if ($row['chip_type'] == 1){ + $heroDb = array(); + Hero::getHeroList(function ($hero) use ($row,&$heroDb) { + if ($hero['chip_ids'] && strstr($hero['chip_ids']."|",strval($row['idx']."|")) ){ + $heroDb = $hero; + } + }); + return $heroDb['hero_id']; + } + if ($row['chip_type'] == 2){ + $gunDb = array(); + Gun::getGunList(function ($gun) use($row,&$gunDb) { + if ($gun['chip_ids'] && strstr($gun['chip_ids']."|",strval($row['idx']."|")) ){ + $gunDb = $gun; + } + }); + return $gunDb['gun_id']; + } + } + public static function addChip($itemId, $tokenId) { return self::internalAddItem(