GunUpgradeQuality
This commit is contained in:
parent
0d6e944fc3
commit
c9d93ac20d
47
doc/Gun.py
47
doc/Gun.py
@ -91,10 +91,10 @@ class Gun(object):
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'upgradeQuality',
|
'name': 'upgradeQualityOld',
|
||||||
'desc': '升阶',
|
'desc': '升阶',
|
||||||
'group': 'Gun',
|
'group': 'Gun',
|
||||||
'url': 'webapp/index.php?c=Gun&a=upgradeQuality',
|
'url': 'webapp/index.php?c=Gun&a=upgradeQualityOld',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['gun_uniid', 0, '枪械唯一id'],
|
['gun_uniid', 0, '枪械唯一id'],
|
||||||
@ -106,6 +106,21 @@ class Gun(object):
|
|||||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'upgradeQuality',
|
||||||
|
'desc': '升阶',
|
||||||
|
'group': 'Gun',
|
||||||
|
'url': 'webapp/index.php?c=Gun&a=upgradeQuality',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['trans_id', 0, 'transId'],
|
||||||
|
['token_id1', 0, '枪械token'],
|
||||||
|
['token_id2', 0, '耗材枪械token'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name': 'upgradeQualityPreview',
|
'name': 'upgradeQualityPreview',
|
||||||
'desc': '升阶',
|
'desc': '升阶',
|
||||||
@ -123,6 +138,21 @@ class Gun(object):
|
|||||||
['cost', _common.Cost(), '所需费用'],
|
['cost', _common.Cost(), '所需费用'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'receiveUpgradeQuality',
|
||||||
|
'desc': '获取升阶后的武器',
|
||||||
|
'group': 'Gun',
|
||||||
|
'url': 'webapp/index.php?c=Gun&a=receiveUpgradeQuality',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
['trans_id', 0, 'transId'],
|
||||||
|
['token_id', 0, '枪械token'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name': 'receive',
|
'name': 'receive',
|
||||||
'desc': '获取升级、升阶后的武器',
|
'desc': '获取升级、升阶后的武器',
|
||||||
@ -154,4 +184,17 @@ class Gun(object):
|
|||||||
['!data', [_common.Gun()], '枪械信息']
|
['!data', [_common.Gun()], '枪械信息']
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'getUpgradeQualityList',
|
||||||
|
'desc': '获取升阶中的枪械列表',
|
||||||
|
'group': 'Hero',
|
||||||
|
'url': 'webapp/index.php?c=Hero&a=getUpgradeQualityList',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['!infos', [_common.QualityingGun()], '升阶中的枪械列表'],
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
@ -133,6 +133,7 @@ class Hero(object):
|
|||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -284,6 +284,16 @@ class QualityingHero(object):
|
|||||||
['costHeroInfo', Hero(), '材料英雄信息'],
|
['costHeroInfo', Hero(), '材料英雄信息'],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class QualityingGun(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['trans_id', 0, 'transId'],
|
||||||
|
['state', 0, '0升阶中,1可领取'],
|
||||||
|
['gunInfo', Gun(), '升阶枪械信息'],
|
||||||
|
['costGunInfo', Gun(), '材料枪械信息'],
|
||||||
|
]
|
||||||
|
|
||||||
class HeroSkin(object):
|
class HeroSkin(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -226,8 +226,9 @@ class CallbackController extends BaseController {
|
|||||||
|
|
||||||
public function gunUpgradeQuality(){
|
public function gunUpgradeQuality(){
|
||||||
$transId = getReqVal('trans_id', '0');
|
$transId = getReqVal('trans_id', '0');
|
||||||
$tokenId = getReqVal('token_id', '0');
|
$tokenId1 = getReqVal('token_id1', '0');
|
||||||
if (!$transId || !$tokenId){
|
$tokenId2 = getReqVal('token_id2', '0');
|
||||||
|
if (!$transId || !$tokenId1){
|
||||||
myself()->_rspErr(1, 'param error');
|
myself()->_rspErr(1, 'param error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -239,7 +240,7 @@ class CallbackController extends BaseController {
|
|||||||
myself()->_getMysql($this->accountId),
|
myself()->_getMysql($this->accountId),
|
||||||
't_gun',
|
't_gun',
|
||||||
array(
|
array(
|
||||||
'token_id' => $tokenId,
|
'token_id' => $tokenId1,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ( !$gunDb ){
|
if ( !$gunDb ){
|
||||||
@ -260,25 +261,32 @@ class CallbackController extends BaseController {
|
|||||||
(myself()->_getMysql($this->accountId),
|
(myself()->_getMysql($this->accountId),
|
||||||
't_gun',
|
't_gun',
|
||||||
array(
|
array(
|
||||||
'token_id' => $tokenId,
|
'token_id' => $tokenId1,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'durability' => $gunDb['durability']+($nextDurability-$durability),
|
'durability' => $gunDb['durability']+($nextDurability-$durability),
|
||||||
'quality' => $gunDb['quality']+1,
|
'quality' => $gunDb['quality']+1,
|
||||||
'lock_type' => 0,
|
// 'lock_type' => 0,
|
||||||
'unlock_time' => 0,
|
// 'unlock_time' => 0,
|
||||||
'labour' => 0,
|
'labour' => 0,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
NftUpEvent::add($this->accountId,
|
NftUpEvent::add($this->accountId,
|
||||||
array(
|
array(
|
||||||
'trans_id' => $transId,
|
'trans_id' => $transId,
|
||||||
'token_id' => $tokenId,
|
'token_id' => $tokenId1,
|
||||||
'value' => 1,
|
'value' => 1,
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime(),
|
'modifytime' => myself()->_getNowTime(),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$param = array(
|
||||||
|
'trans_id'=>$transId,
|
||||||
|
'token_id1'=>$tokenId1,
|
||||||
|
'token_id2'=>$tokenId2,
|
||||||
|
'token_type'=>2,
|
||||||
|
);
|
||||||
|
NftUpReceive::upsert($this->accountId,$param);
|
||||||
if ($gunDb['quality'] + 1 > $this->_getDynDataV(TN_GUN_MAX_QUALITY, 0)) {
|
if ($gunDb['quality'] + 1 > $this->_getDynDataV(TN_GUN_MAX_QUALITY, 0)) {
|
||||||
$this->_setDynDataV(TN_GUN_MAX_QUALITY, 0, $gunDb['quality'] + 1);
|
$this->_setDynDataV(TN_GUN_MAX_QUALITY, 0, $gunDb['quality'] + 1);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ require_once('models/User.php');
|
|||||||
require_once('models/Gun.php');
|
require_once('models/Gun.php');
|
||||||
require_once('models/Bag.php');
|
require_once('models/Bag.php');
|
||||||
require_once('models/Chip.php');
|
require_once('models/Chip.php');
|
||||||
|
require_once('models/NftUpReceive.php');
|
||||||
|
|
||||||
require_once('services/AwardService.php');
|
require_once('services/AwardService.php');
|
||||||
require_once('services/PropertyChgService.php');
|
require_once('services/PropertyChgService.php');
|
||||||
@ -24,6 +25,7 @@ use models\User;
|
|||||||
use models\Gun;
|
use models\Gun;
|
||||||
use models\Bag;
|
use models\Bag;
|
||||||
use models\Chip;
|
use models\Chip;
|
||||||
|
use models\NftUpReceive;
|
||||||
use services\LogService;
|
use services\LogService;
|
||||||
|
|
||||||
class GunController extends BaseAuthedController {
|
class GunController extends BaseAuthedController {
|
||||||
@ -267,7 +269,7 @@ class GunController extends BaseAuthedController {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgradeQuality()
|
public function upgradeQualityOld()
|
||||||
{
|
{
|
||||||
$costGunUniId = getReqVal('cost_gun_uniid', 0);
|
$costGunUniId = getReqVal('cost_gun_uniid', 0);
|
||||||
$gunUniId = getReqVal('gun_uniid', 0);
|
$gunUniId = getReqVal('gun_uniid', 0);
|
||||||
@ -464,6 +466,47 @@ class GunController extends BaseAuthedController {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function upgradeQuality(){
|
||||||
|
$tokenId1 = getReqVal('token_id1', '');
|
||||||
|
$tokenId2 = getReqVal('token_id2', '');
|
||||||
|
$transId = getReqVal('trans_id', '');
|
||||||
|
if (!$tokenId1 || !$tokenId2 || !$transId){
|
||||||
|
$this->_rspErr(1, ' error param');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (NftUpReceive::find(myself()->_getAccountId(),$transId)){
|
||||||
|
$this->_rspErr(1, ' error param trans_id ');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Gun::updateByTokenId($tokenId1,
|
||||||
|
array(
|
||||||
|
'lock_type' => Gun::QUALITY_LOCK,
|
||||||
|
'unlock_time' => $this->_getNowTime() + 20,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
Gun::updateByTokenId($tokenId2,
|
||||||
|
array(
|
||||||
|
'lock_type' => Gun::COST_LOCK,
|
||||||
|
'unlock_time' => $this->_getNowTime() + 20,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
NftUpReceive::add(
|
||||||
|
myself()->_getAccountId(),
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'trans_id' => $transId,
|
||||||
|
'token_id1' => $tokenId1,
|
||||||
|
'token_id2' => $tokenId2,
|
||||||
|
'state' => 0,
|
||||||
|
'token_type' => 2,
|
||||||
|
'from_data' => 0,
|
||||||
|
'createtime' => $this->_getNowTime(),
|
||||||
|
'modifytime' => $this->_getNowTime()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
myself()->_rspOk();
|
||||||
|
}
|
||||||
|
|
||||||
public function receive(){
|
public function receive(){
|
||||||
|
|
||||||
$type = getReqVal('type', 0);
|
$type = getReqVal('type', 0);
|
||||||
@ -682,4 +725,52 @@ class GunController extends BaseAuthedController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function receiveUpgradeQuality(){
|
||||||
|
$transId = getReqVal('trans_id', '');
|
||||||
|
$tokenId = getReqVal('token_id', '');
|
||||||
|
if (!$tokenId || !$transId){
|
||||||
|
$this->_rspErr(1, ' error param');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Gun::updateByTokenId($tokenId,
|
||||||
|
array(
|
||||||
|
'lock_type' => Gun::NO_LOCK,
|
||||||
|
'unlock_time' => 0,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
NftUpReceive::setAccountIdNull(myself()->_getAccountId(),$transId);
|
||||||
|
$propertyChgService = new services\PropertyChgService();
|
||||||
|
$propertyChgService->addGunChg();
|
||||||
|
$this->_rspData(array(
|
||||||
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUpgradeQualityList(){
|
||||||
|
$list = NftUpReceive::all(myself()->_getAccountId(),2);
|
||||||
|
$infos = array();
|
||||||
|
foreach ($list as $value){
|
||||||
|
if ($this->_getNowTime() - $value['createtime'] < 24*3600 && !$value['from_data'] || $value['from_data'] ){
|
||||||
|
$gun = Gun::findByTokenId2($value['token_id1']);
|
||||||
|
$costGun = Gun::findByTokenId2($value['token_id2']);
|
||||||
|
$gunDto = null;
|
||||||
|
$costGunDto = null;
|
||||||
|
if ($gun && $costGun){
|
||||||
|
$gunDto = Gun::toDto($gun);
|
||||||
|
$costGunDto = Gun::toDto($costGun);
|
||||||
|
}
|
||||||
|
$info = array(
|
||||||
|
'trans_id'=>$value['trans_id'],
|
||||||
|
'state'=>$value['state'],
|
||||||
|
'gunInfo'=>$gunDto,
|
||||||
|
'costGunInfo'=>$costGunDto,
|
||||||
|
);
|
||||||
|
array_push($infos,$info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_rspData(array(
|
||||||
|
'infos' => $infos
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ class HeroController extends BaseAuthedController {
|
|||||||
$list = NftUpReceive::all(myself()->_getAccountId(),1);
|
$list = NftUpReceive::all(myself()->_getAccountId(),1);
|
||||||
$infos = array();
|
$infos = array();
|
||||||
foreach ($list as $value){
|
foreach ($list as $value){
|
||||||
if ($this->_getNowTime() - $value['createtime'] < 24*3600 && !$value['from_data']){
|
if ($this->_getNowTime() - $value['createtime'] < 24*3600 && !$value['from_data'] || $value['from_data'] ){
|
||||||
$hero = Hero::findByTokenId2($value['token_id1']);
|
$hero = Hero::findByTokenId2($value['token_id1']);
|
||||||
$costHero = Hero::findByTokenId2($value['token_id2']);
|
$costHero = Hero::findByTokenId2($value['token_id2']);
|
||||||
$heroDto = null;
|
$heroDto = null;
|
||||||
@ -902,6 +902,10 @@ class HeroController extends BaseAuthedController {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
NftUpReceive::setAccountIdNull(myself()->_getAccountId(),$transId);
|
NftUpReceive::setAccountIdNull(myself()->_getAccountId(),$transId);
|
||||||
myself()->_rspOk();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
|
$propertyChgService->addHeroChg();
|
||||||
|
$this->_rspData(array(
|
||||||
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,18 @@ class Gun extends BaseModel {
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function findByTokenId2($tokenId)
|
||||||
|
{
|
||||||
|
$row = SqlHelper::ormSelectOne(
|
||||||
|
myself()->_getMysql($tokenId),
|
||||||
|
't_gun',
|
||||||
|
array(
|
||||||
|
'token_id' => $tokenId,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
public static function findByAccountId($accountId, $gunUniId)
|
public static function findByAccountId($accountId, $gunUniId)
|
||||||
{
|
{
|
||||||
return self::internalFind($accountId, $gunUniId);
|
return self::internalFind($accountId, $gunUniId);
|
||||||
|
@ -56,7 +56,7 @@ class NftUpReceive extends BaseModel
|
|||||||
'trans_id' => $data['trans_id'],
|
'trans_id' => $data['trans_id'],
|
||||||
'token_id1' => $data['token_id1'],
|
'token_id1' => $data['token_id1'],
|
||||||
'token_id2' => $data['token_id2'],
|
'token_id2' => $data['token_id2'],
|
||||||
'state' => 0,
|
'state' => 1,
|
||||||
'token_type' => $data['token_type'],
|
'token_type' => $data['token_type'],
|
||||||
'from_data' => 1,
|
'from_data' => 1,
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user