diff --git a/doc/Gun.py b/doc/Gun.py index c26fe19..d4988ef 100644 --- a/doc/Gun.py +++ b/doc/Gun.py @@ -19,4 +19,17 @@ class Gun(object): ['!skin_list', [_common.GunSkin()], '枪械皮肤列表'] ] }, + { + 'name': 'talentList', + 'desc': '获取枪械天赋列表', + 'group': 'Gun', + 'url': 'webapp/index.php?c=Gun&a=talentList', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['!talent_list', [_common.GunTalent()], '枪械天赋列表'] + ] + }, ] diff --git a/doc/_common.py b/doc/_common.py index c669274..2c740a0 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -25,6 +25,15 @@ class GunSkin(object): ['try_expire_at', 0, '试用到期时间(utc时间)'], ] +class GunTalent(object): + + def __init__(self): + self.fields = [ + ['type_id', 0, '枪支类型'], + ['talent_id', 0, '天赋'], + ['talent_lv', 0, '天赋等级'], + ] + class UserInfo(object): def __init__(self): diff --git a/webapp/controller/GunController.class.php b/webapp/controller/GunController.class.php index 16b77ff..baeae30 100644 --- a/webapp/controller/GunController.class.php +++ b/webapp/controller/GunController.class.php @@ -1,13 +1,15 @@ _getSelfMysql(), + 't_gun_talent', + array( + 'accountid' => $this->_getAccountId() + ), + function ($row) use(&$talentList) { + array_push($talentList, GunTalent::toDto($row)); + } + ); + $this->_rspData(array( + 'talent_list' => $talentList + )); + } + } diff --git a/webapp/models/GunTalent.php b/webapp/models/GunTalent.php new file mode 100644 index 0000000..340888e --- /dev/null +++ b/webapp/models/GunTalent.php @@ -0,0 +1,33 @@ +_getSelfMysql(), + 't_gun_talent', + array( + 'accountid' => myself()->_getAccountId(), + 'type_id' => $typeId, + 'type_id' => $row['type_id'], + ) + ); + return $row; + } + + public static function toDto($row) + { + return array( + 'type_id' => $row['type_id'], + 'talent_id' => $row['talent_id'], + 'talent_lv' => $row['talent_lv'], + ); + } + +}