1
This commit is contained in:
parent
3908a36e53
commit
6cafa8c40b
13
doc/Gun.py
13
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()], '枪械天赋列表']
|
||||
]
|
||||
},
|
||||
]
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
33
webapp/models/GunTalent.php
Normal file
33
webapp/models/GunTalent.php
Normal 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'],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user