This commit is contained in:
aozhiwei 2021-11-26 19:50:36 +08:00
parent 3908a36e53
commit 6cafa8c40b
4 changed files with 76 additions and 1 deletions

View File

@ -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()], '枪械天赋列表']
]
},
]

View File

@ -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):

View File

@ -1,13 +1,15 @@
<?php
require_once('mt/NewShop.php');
require_once('mt/Shop.php');
require_once('mt/GunTalentLv.php');
require_once('mt/GunTalent.php');
require_once('models/GunSkin.php');
require_once('models/GunTalent.php');
use phpcommon\SqlHelper;
use models\GunSkin;
use models\GunTalent;
class GunController extends BaseAuthedController {
@ -29,4 +31,22 @@ class GunController extends BaseAuthedController {
));
}
public function talentList()
{
$talentList = array();
SqlHelper::ormSelect(
$this->_getSelfMysql(),
't_gun_talent',
array(
'accountid' => $this->_getAccountId()
),
function ($row) use(&$talentList) {
array_push($talentList, GunTalent::toDto($row));
}
);
$this->_rspData(array(
'talent_list' => $talentList
));
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class GunTalent extends BaseModel {
public static function find($typeId, $talentId)
{
$row = SqlHelper::ormSelectOne(
myself()->_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'],
);
}
}