This commit is contained in:
aozhiwei 2022-11-09 23:05:32 +08:00
commit af0458a1d1
16 changed files with 558 additions and 65 deletions

View File

@ -91,10 +91,10 @@ class Gun(object):
]
},
{
'name': 'upgradeQuality',
'name': 'upgradeQualityOld',
'desc': '升阶',
'group': 'Gun',
'url': 'webapp/index.php?c=Gun&a=upgradeQuality',
'url': 'webapp/index.php?c=Gun&a=upgradeQualityOld',
'params': [
_common.ReqHead(),
['gun_uniid', 0, '枪械唯一id'],
@ -106,6 +106,21 @@ class Gun(object):
['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',
'desc': '升阶',
@ -123,6 +138,21 @@ class Gun(object):
['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',
'desc': '获取升级、升阶后的武器',
@ -154,4 +184,17 @@ class Gun(object):
['!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()], '升阶中的枪械列表'],
]
},
]

View File

@ -111,6 +111,36 @@ class Hero(object):
'desc': '升阶',
'group': 'Hero',
'url': 'webapp/index.php?c=Hero&a=upgradeQuality',
'params': [
_common.ReqHead(),
['trans_id', 0, 'transId'],
['token_id1', 0, '英雄token'],
['token_id2', 0, '耗材英雄token'],
],
'response': [
_common.RspHead(),
]
},
{
'name': 'receiveUpgradeQuality',
'desc': '领取升阶',
'group': 'Hero',
'url': 'webapp/index.php?c=Hero&a=receiveUpgradeQuality',
'params': [
_common.ReqHead(),
['trans_id', 0, 'transId'],
['token_id', 0, '英雄token'],
],
'response': [
_common.RspHead(),
['property_chg', _common.PropertyChg(), '属性变更'],
]
},
{
'name': 'upgradeQualityOld',
'desc': '升阶',
'group': 'Hero',
'url': 'webapp/index.php?c=Hero&a=upgradeQualityOld',
'params': [
_common.ReqHead(),
['hero_uniid', 0, '英雄唯一id'],

View File

@ -278,8 +278,20 @@ class QualityingHero(object):
def __init__(self):
self.fields = [
['info', Hero(), '英雄信息'],
['countdown', 0, '倒计时'],
['trans_id', 0, 'transId'],
['state', 0, '0升阶中1可领取'],
['heroInfo', 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):

View File

@ -782,6 +782,7 @@ CREATE TABLE `t_transaction` (
`item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
`client_confirmed` int(11) NOT NULL DEFAULT '0' COMMENT 'client_confirmed',
`client_result` mediumblob COMMENT 'client_result',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
@ -832,3 +833,23 @@ CREATE TABLE `t_nft_up_event` (
UNIQUE KEY `trans_id` (`trans_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `t_nft_up_receive`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_nft_up_receive` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id',
`token_id1` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id1',
`token_id2` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id2',
`state` int(11) NOT NULL DEFAULT '0' COMMENT '0进阶中,1可领取',
`token_type` int(11) NOT NULL DEFAULT '0' COMMENT '1英雄,2枪械',
`from_data` int(11) NOT NULL DEFAULT '0' COMMENT '0本地,1链',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `trans_id` (`trans_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@ -58,6 +58,12 @@ class BaseController {
public function _rspErr($errcode, $errmsg)
{
if (SERVER_ENV != _ONLINE) {
error_log(json_encode(array(
'errcode' => $errcode,
'errmsg' => $errmsg,
)));
}
echo json_encode(array(
'errcode' => $errcode,
'errmsg' => $errmsg,

View File

@ -164,6 +164,25 @@ class BlockChainController extends BaseAuthedController {
myself()->_rspErr(1, 'token paramater error');
return;
}
//CEG扣除
{
$costItems = array(
array(
'item_id' => V_ITEM_GOLD,
'item_num' => \services\FormulaService::Hero_Advanced_CEG_Expend($nft1['quality']+1)
),
// array(
// 'item_id' => V_ITEM_DIAMOND,
// 'item_num' => \services\FormulaService::Hero_Advanced_CEC_Expend($nft1['quality']+1)
// )
);
$lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return;
}
$this->_decItems($costItems);
}
$this->internalBcCall(
array(
'c' => 'BcService',
@ -193,6 +212,27 @@ class BlockChainController extends BaseAuthedController {
myself()->_rspErr(1, 'token paramater error');
return;
}
//CEG扣除
{
$costItems = array(
array(
'item_id' => V_ITEM_GOLD,
'item_num' => \services\FormulaService::Weapon_Advanced_CEG_Expend($nft1['quality']+1)
),
// array(
// 'item_id' => V_ITEM_DIAMOND,
// 'item_num' => \services\FormulaService::Weapon_Advanced_CEC_Expend($nft1['quality']+1)
// )
);
$lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return;
}
$this->_decItems($costItems);
}
$this->internalBcCall(
array(
'c' => 'BcService',
@ -342,7 +382,7 @@ class BlockChainController extends BaseAuthedController {
myself()->_rspErr(101, 'token_ids paramater error');
return;
}
$tokenType = Nft::GUN_TYPE;
$tokenType = Nft::EQUIP_TYPE;
} else {
myself()->_rspErr(101, 'token_ids paramater error');
return;
@ -356,6 +396,37 @@ class BlockChainController extends BaseAuthedController {
myself()->_getNowTime(),
myself()->_getOpenId()
);
//CEG扣除
{
if ($tokenType == Nft::HERO_TYPE){
$costItems = array(
array(
'item_id' => V_ITEM_GOLD,
'item_num' => 100
),
);
$lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return;
}
$this->_decItems($costItems);
}
if ($tokenType == Nft::EQUIP_TYPE){
$costItems = array(
array(
'item_id' => V_ITEM_GOLD,
'item_num' => 30
),
);
$lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return;
}
$this->_decItems($costItems);
}
}
$params = array(
'c' => 'BcService',
@ -519,18 +590,14 @@ class BlockChainController extends BaseAuthedController {
case 1:
{
$heroDb = Hero::findByTokenId($tokenId);
foreach ($chipIds as $chipId) {
$chipDb = Chip::findByTokenId($chipId);
if (!$chipDb) {
myself()->_rspErr(101, 'chip_ids paramater error');
return;
}
}
if (!$heroDb) {
myself()->_rspErr(101, 'token_id paramater error');
return;
}
// //CEG扣除
// {
// Chip::getChipByTokenId($chipIds);
// }
$this->internalBcCall(
array(
'c' => 'BcService',
@ -557,13 +624,6 @@ class BlockChainController extends BaseAuthedController {
case 2:
{
$gunDb = Gun::findByTokenId($tokenId);
foreach ($chipIds as $chipId) {
$chipDb = Chip::findByTokenId($chipId);
if (!$chipDb) {
myself()->_rspErr(101, 'chip_ids paramater error');
return;
}
}
if (!$gunDb) {
myself()->_rspErr(101, 'token_id paramater error');
return;

View File

@ -14,6 +14,7 @@ require_once('models/Hero.php');
require_once('models/Gun.php');
require_once('models/Chip.php');
require_once('models/DynData.php');
require_once('models/NftUpReceive.php');
require_once('phpcommon/bchelper.php');
@ -27,6 +28,7 @@ use models\Hero;
use models\Gun;
use models\Chip;
use models\DynData;
use models\NftUpReceive;
class CallbackController extends BaseController {
private $accountId;
@ -150,8 +152,9 @@ class CallbackController extends BaseController {
public function heroUpgradeQuality(){
$transId = getReqVal('trans_id', '0');
$tokenId = getReqVal('token_id', '0');
if (!$transId || !$tokenId){
$tokenId1 = getReqVal('token_id1', '0');
$tokenId2 = getReqVal('token_id2', '0');
if (!$transId || !$tokenId1){
myself()->_rspErr(1, 'param error');
return;
}
@ -163,7 +166,7 @@ class CallbackController extends BaseController {
myself()->_getMysql($this->accountId),
't_hero',
array(
'token_id' => $tokenId,
'token_id' => $tokenId1,
)
);
if ( !$heroDb ){
@ -172,7 +175,7 @@ class CallbackController extends BaseController {
}
$nextQualityMeta = mt\HeroQuality::getByQuality($heroDb['quality']+1);
if (! $nextQualityMeta){
$this->_rspErr(1, 'quality is full');
myself()->_rspOk();
return;
}
@ -184,27 +187,35 @@ class CallbackController extends BaseController {
( myself()->_getMysql($this->accountId),
't_hero',
array(
'token_id' => $tokenId,
'token_id' => $tokenId1,
),
array(
'hero_tili' => $heroDb['hero_tili']+($nextHeroTili-$heroTili),
'skill_points' => $heroDb['skill_points'] + $nextQualityMeta['skill_point'],
'quality' => $heroDb['quality']+1,
'advanced_count' => $heroDb['advanced_count'] + 1,
'lock_type' => 0,
'unlock_time' => 0,
// 'lock_type' => 0,
// 'unlock_time' => 0,
'labour' => 0,
)
);
NftUpEvent::add($this->accountId,
array(
'trans_id' => $transId,
'token_id' => $tokenId,
'token_id' => $tokenId1,
'value' => 1,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
$param = array(
'trans_id'=>$transId,
'token_id1'=>$tokenId1,
'token_id2'=>$tokenId2,
'token_type'=>1,
);
NftUpReceive::upsert($this->accountId,$param);
if ($heroDb['quality'] + 1 > $this->_getDynDataV(TN_HERO_MAX_QUALITY, 0)) {
$this->_setDynDataV(TN_HERO_MAX_QUALITY, 0, $heroDb['quality'] + 1);
}
@ -215,8 +226,9 @@ class CallbackController extends BaseController {
public function gunUpgradeQuality(){
$transId = getReqVal('trans_id', '0');
$tokenId = getReqVal('token_id', '0');
if (!$transId || !$tokenId){
$tokenId1 = getReqVal('token_id1', '0');
$tokenId2 = getReqVal('token_id2', '0');
if (!$transId || !$tokenId1){
myself()->_rspErr(1, 'param error');
return;
}
@ -228,7 +240,7 @@ class CallbackController extends BaseController {
myself()->_getMysql($this->accountId),
't_gun',
array(
'token_id' => $tokenId,
'token_id' => $tokenId1,
)
);
if ( !$gunDb ){
@ -237,7 +249,7 @@ class CallbackController extends BaseController {
}
$nextQualityMeta = mt\GunQuality::getByQuality($gunDb['quality']+1);
if (!$nextQualityMeta) {
$this->_rspErr(1, 'quality is full');
myself()->_rspOk();
return;
}
$gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($gunDb['quality']);
@ -249,25 +261,32 @@ class CallbackController extends BaseController {
(myself()->_getMysql($this->accountId),
't_gun',
array(
'token_id' => $tokenId,
'token_id' => $tokenId1,
),
array(
'durability' => $gunDb['durability']+($nextDurability-$durability),
'quality' => $gunDb['quality']+1,
'lock_type' => 0,
'unlock_time' => 0,
// 'lock_type' => 0,
// 'unlock_time' => 0,
'labour' => 0,
)
);
NftUpEvent::add($this->accountId,
array(
'trans_id' => $transId,
'token_id' => $tokenId,
'token_id' => $tokenId1,
'value' => 1,
'createtime' => 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)) {
$this->_setDynDataV(TN_GUN_MAX_QUALITY, 0, $gunDb['quality'] + 1);
}

View File

@ -11,6 +11,7 @@ require_once('models/User.php');
require_once('models/Gun.php');
require_once('models/Bag.php');
require_once('models/Chip.php');
require_once('models/NftUpReceive.php');
require_once('services/AwardService.php');
require_once('services/PropertyChgService.php');
@ -24,6 +25,7 @@ use models\User;
use models\Gun;
use models\Bag;
use models\Chip;
use models\NftUpReceive;
use services\LogService;
class GunController extends BaseAuthedController {
@ -267,7 +269,7 @@ class GunController extends BaseAuthedController {
));
}
public function upgradeQuality()
public function upgradeQualityOld()
{
$costGunUniId = getReqVal('cost_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(){
$type = getReqVal('type', 0);
@ -682,4 +725,58 @@ 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,
)
);
$newGunDb = Gun::findByTokenId2($tokenId);
$newGun = Gun::toDto($newGunDb);
$newGunDb['quality'] -= 1;
$oldGun = Gun::toDto($newGunDb);
NftUpReceive::setAccountIdNull(myself()->_getAccountId(),$transId);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addGunChg();
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
'new_gun' =>$newGun,
'old_gun'=>$oldGun
));
}
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
));
}
}

View File

@ -15,6 +15,7 @@ require_once('models/Hero.php');
require_once('models/Bag.php');
require_once('models/HeroSkin.php');
require_once('models/Chip.php');
require_once('models/NftUpReceive.php');
require_once('services/AwardService.php');
require_once('services/PropertyChgService.php');
@ -28,6 +29,7 @@ use models\Hero;
use models\Bag;
use models\HeroSkin;
use models\Chip;
use models\NftUpReceive;
use services\LogService;
class HeroController extends BaseAuthedController {
@ -205,22 +207,46 @@ class HeroController extends BaseAuthedController {
public function getUpgradeQualityList()
{
$infos = array();
for ($i = 0; $i < kMaxHeroUpQualityNum; ++$i) {
$heroUniId = $this->_getV(TN_HERO_QUALITY_UP, $i);
$info = null;
if ($heroUniId) {
$heroDb = Hero::find($heroUniId);
if ($heroDb) {
$heroDto = Hero::toDto($heroDb);
$info = array(
'info' => $heroDto,
'countdown' => $heroDto['unlock_lefttime']
);
// $infos = array();
// for ($i = 0; $i < kMaxHeroUpQualityNum; ++$i) {
// $heroUniId = $this->_getV(TN_HERO_QUALITY_UP, $i);
// $info = null;
// if ($heroUniId) {
// $heroDb = Hero::find($heroUniId);
// if ($heroDb) {
// $heroDto = Hero::toDto($heroDb);
// $info = array(
// 'info' => $heroDto,
// 'countdown' => $heroDto['unlock_lefttime']
// );
// }
// }
// array_push($infos, $info);
// }
// $this->_rspData(array(
// 'infos' => $infos
// ));
$list = NftUpReceive::all(myself()->_getAccountId(),1);
$infos = array();
foreach ($list as $value){
if ($this->_getNowTime() - $value['createtime'] < 24*3600 && !$value['from_data'] || $value['from_data'] ){
$hero = Hero::findByTokenId2($value['token_id1']);
$costHero = Hero::findByTokenId2($value['token_id2']);
$heroDto = null;
$costHeroDto = null;
if ($hero && $costHero){
$heroDto = Hero::toDto($hero);
$costHeroDto = Hero::toDto($costHero);
}
$info = array(
'trans_id'=>$value['trans_id'],
'state'=>$value['state'],
'heroInfo'=>$heroDto,
'costHeroInfo'=>$costHeroDto,
);
array_push($infos,$info);
}
array_push($infos, $info);
}
}
$this->_rspData(array(
'infos' => $infos
));
@ -617,7 +643,7 @@ class HeroController extends BaseAuthedController {
));
}
public function upgradeQuality()
public function upgradeQualityOld()
{
$costHeroUniId = getReqVal('cost_hero_uniid', 0);
$heroUniId = getReqVal('hero_uniid', 0);
@ -821,5 +847,72 @@ class HeroController 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;
}
Hero::updateByTokenId($tokenId1,
array(
'lock_type' => Hero::QUALITY_LOCK,
'unlock_time' => $this->_getNowTime() + 3600 * 24,
)
);
Hero::updateByTokenId($tokenId2,
array(
'lock_type' => Hero::COST_LOCK,
'unlock_time' => $this->_getNowTime() + 3600 * 24,
)
);
NftUpReceive::add(
myself()->_getAccountId(),
array(
'account_id' => myself()->_getAccountId(),
'trans_id' => $transId,
'token_id1' => $tokenId1,
'token_id2' => $tokenId2,
'state' => 0,
'token_type' => 1,
'from_data' => 0,
'createtime' => $this->_getNowTime(),
'modifytime' => $this->_getNowTime()
)
);
myself()->_rspOk();
}
public function receiveUpgradeQuality(){
$transId = getReqVal('trans_id', '');
$tokenId = getReqVal('token_id', '');
if (!$tokenId || !$transId){
$this->_rspErr(1, ' error param');
return;
}
Hero::updateByTokenId($tokenId,
array(
'lock_type' => Hero::NO_LOCK,
'unlock_time' => 0,
)
);
$newHeroDb = Hero::findByTokenId2($tokenId);
$newHero = Hero::toDto($newHeroDb);
$newHeroDb['quality'] -= 1;
$oldHero = Hero::toDto($newHeroDb);
NftUpReceive::setAccountIdNull(myself()->_getAccountId(),$transId);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg();
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
'new_hero' =>$newHero,
'old_hero'=>$oldHero
));
}
}

View File

@ -11,6 +11,7 @@ require_once('models/User.php');
require_once('models/Hero.php');
require_once('models/Bag.php');
require_once('models/HeroSkin.php');
require_once('models/Gun.php');
require_once('models/GunSkin.php');
require_once('models/ShopBuyRecord.php');
@ -22,6 +23,7 @@ use models\User;
use models\Bag;
use models\Hero;
use models\HeroSkin;
use models\Gun;
use models\GunSkin;
use models\ShopBuyRecord;
@ -668,6 +670,12 @@ class ShopController extends BaseAuthedController {
$propertyChgService->addHeroSkinChg();
}
break;
case mt\Item::GUN_TYPE:
{
Gun::addGun($itemMeta);
$propertyChgService->addGunChg();
}
break;
case mt\Item::GUN_SKIN_TYPE:
{
GunSkin::addSkin($itemMeta);

View File

@ -67,6 +67,18 @@ class Gun extends BaseModel {
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)
{
return self::internalFind($accountId, $gunUniId);
@ -261,9 +273,6 @@ class Gun extends BaseModel {
$dto['pvp_ceg_uplimit'] = strval( round(FormulaService::getWeaponPvpDailyCegUpLimit($dto),2) );
$dto['pve_ceg_uplimit'] = strval( round(FormulaService::getWeaponPveDailyCegUpLimit($dto),2) );
$dto['mission_ceg_uplimit'] = strval( round(FormulaService::getWeaponMissionDailyCegUpLimit($dto),2) );
error_log(json_encode(array(
'data____info'=>$dto
))) ;
return $dto;
}

View File

@ -63,6 +63,18 @@ class Hero extends BaseModel {
return $row;
}
public static function findByTokenId2($tokenId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getMysql($tokenId),
't_hero',
array(
'token_id' => $tokenId,
)
);
return $row;
}
private static function internalFind($accountId, $heroUniId)
{
$row = SqlHelper::ormSelectOne(
@ -174,14 +186,14 @@ class Hero extends BaseModel {
$lockType = 0;
$unlockTime = 0;
/*if ($row['lock_type'] != 0 && $row['unlock_time'] - myself()->_getNowTime() > 0) {
$lockType = $row['lock_type'];
$unlockTime = $row['unlock_time'];
}*/
{
if ($row['lock_type'] != 0 && $row['unlock_time'] - myself()->_getNowTime() > 0) {
$lockType = $row['lock_type'];
$unlockTime = $row['unlock_time'];
}
// {
// $lockType = $row['lock_type'];
// $unlockTime = $row['unlock_time'];
// }
$qualityMeta = mt\HeroQuality::getByQuality($row['quality']);
$todayGetGold = $row['today_get_gold'];

View File

@ -0,0 +1,81 @@
<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class NftUpReceive extends BaseModel
{
public static function find($accountId,$transId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getMysql($accountId),
't_nft_up_receive',
array(
'trans_id' => $transId,
)
);
return $row;
}
public static function add($accountId,$fieldKv){
return SqlHelper::insert(
myself()->_getMysql($accountId),
't_nft_up_receive',
$fieldKv
);
}
public static function all($accountId,$tokenType)
{
$row = SqlHelper::ormSelect(
myself()->_getMysql($accountId),
't_nft_up_receive',
array(
'account_id' => $accountId,
'token_type' => $tokenType,
)
);
return $row;
}
public static function upsert($accountId,$data){
SqlHelper::upsert(
myself()->_getMysql($accountId),
't_nft_up_receive',
array(
'trans_id' => $data['trans_id']
),
array(
'state' => 1,
'modifytime' => myself()->_getNowTime()
),
array(
'account_id' => $accountId,
'trans_id' => $data['trans_id'],
'token_id1' => $data['token_id1'],
'token_id2' => $data['token_id2'],
'state' => 1,
'token_type' => $data['token_type'],
'from_data' => 1,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}
public static function setAccountIdNull($accountId,$transId){
SqlHelper::update(
myself()->_getMysql($accountId),
't_nft_up_receive',
array(
'trans_id' => $transId,
),
array(
'account_id' => '',
)
);
}
}

View File

@ -26,7 +26,8 @@ class Transaction extends BaseModel {
myself()->_getSelfMysql(),
't_transaction',
array(
'account_id' => myself()->_getAccountId()
'account_id' => myself()->_getAccountId(),
'client_confirmed' => 1
)
);
return $rows;
@ -143,6 +144,7 @@ class Transaction extends BaseModel {
),
array(
'client_result' => $result,
'client_confirmed' => 1,
'modifytime' => myself()->_getNowTime()
)
);

View File

@ -302,7 +302,7 @@ class Item {
array_push($heros, $tokenId);
}
if (in_array($tokenId, $gunItemIds)) {
array_push($gun, $tokenId);
array_push($guns, $tokenId);
}
switch ($tokenId) {
case 110100:
@ -312,7 +312,7 @@ class Item {
break;
case 110200:
{
array_push($gunHeros, $tokenId);
array_push($specGuns, $tokenId);
}
break;
default:

View File

@ -181,9 +181,9 @@ class LogService extends BaseService
'nft_unique_id' => $old_nft['idx'], //NFT idx
'nft_token_id' => $old_nft['token_id']?$old_nft['token_id']:null, //NFT token ID
'nft_item_id' => $old_nft['item_id']?$old_nft['item_id']:null, //NFT item ID
'nft_quality' => $old_nft['quality'] ? $old_nft['quality'] : null, //NFT品阶
'nft_quality' => isset($old_nft['quality']) ? $old_nft['quality'] : null, //NFT品阶
'nft_level' => $old_nft['level'] ? $old_nft['level'] : null, //NFT等级
'nft_quality2' => $new_nft['quality'] ? $new_nft['quality'] : null, //NFT品阶2
'nft_quality2' => isset($new_nft['quality']) ? $new_nft['quality'] : null, //NFT品阶2
'nft_level2' => $new_nft['level'] ? $new_nft['level'] : null, //NFT等级2
'nft_info' => json_encode($old_nft),
'new_nft' => json_encode($new_nft)