记录有ceg产出的nft
This commit is contained in:
parent
52b7050c87
commit
df90ff750b
@ -599,12 +599,14 @@ DROP TABLE IF EXISTS `t_nft_active`;
|
||||
CREATE TABLE `t_nft_active` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`uniid` varchar(255) NOT NULL DEFAULT '' COMMENT 'nft uniid',
|
||||
`token_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'token id',
|
||||
`daytime` int(11) NOT NULL DEFAULT '0' COMMENT '今天0点时间',
|
||||
`token_type` int(11) NOT NULL DEFAULT '0' COMMENT 'nft类型 1:英雄 2:枪支 3:芯片 5:碎片箱子',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `token_id` (`token_id`),
|
||||
UNIQUE KEY `token_id_daytime` (`token_id`, `daytime`,`token_type`),
|
||||
KEY `account_id_token_type` (`account_id`,`token_type`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -8,6 +8,7 @@ define('V_ITEM_GOLD', 10001); //金币
|
||||
define('V_ITEM_DIAMOND', 10002); //钻石
|
||||
define('V_ITEM_EXP', 10003); //经验
|
||||
define('V_ITEM_ACTIVE', 10004); //活跃度
|
||||
define('V_ITEM_BCEG', 10010); //BCEG
|
||||
|
||||
define('TN_BEGIN', 8001);
|
||||
define('TN_ACTIVE', 8002);
|
||||
|
@ -193,7 +193,7 @@ class BaseAuthedController extends BaseController {
|
||||
|
||||
public function _isVirtualItem($itemId)
|
||||
{
|
||||
return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE));
|
||||
return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE,V_ITEM_BCEG));
|
||||
}
|
||||
|
||||
public function _addVirtualItem($itemId, $itemNum)
|
||||
@ -220,8 +220,13 @@ class BaseAuthedController extends BaseController {
|
||||
));
|
||||
}
|
||||
break;
|
||||
case V_ITEM_EXP:
|
||||
case V_ITEM_BCEG:
|
||||
{
|
||||
$this->_updateUserInfo(array(
|
||||
'bceg' => function () use($itemNum) {
|
||||
return "bceg + ${itemNum}";
|
||||
}
|
||||
));
|
||||
}
|
||||
break;
|
||||
case V_ITEM_ACTIVE:
|
||||
|
@ -179,6 +179,7 @@ class Gun extends BaseModel {
|
||||
$gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($row['quality']);
|
||||
$dto = array(
|
||||
'idx' => $row['idx'],
|
||||
'token_id' => $row['token_id'],
|
||||
'gun_uniid' => $row['idx'],
|
||||
'gun_id' => $row['gun_id'],
|
||||
'gun_lv' => $row['gun_lv'],
|
||||
|
40
webapp/models/NftActive.php
Normal file
40
webapp/models/NftActive.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace models;
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
class NftActive extends BaseModel
|
||||
{
|
||||
public static function upsert($data){
|
||||
if ($data['token_id']){
|
||||
$where = array(
|
||||
'token_id' =>$data['token_id'],
|
||||
);
|
||||
}else{
|
||||
$where = array(
|
||||
'uniid' =>$data['uniid'],
|
||||
);
|
||||
}
|
||||
|
||||
SqlHelper::upsert
|
||||
(myself()->_getSelfMysql(),
|
||||
't_nft_active',
|
||||
$where,
|
||||
array(
|
||||
),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'uniid' =>$data['uniid'],
|
||||
'token_id' =>$data['token_id']?$data['token_id']:'',
|
||||
'daytime' =>strtotime(date('Y-m-d',myself()->_getNowTime())),
|
||||
'token_type' =>$data['token_type'],
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -39,6 +39,7 @@ class User extends BaseModel {
|
||||
'history_best_rank' => $row['history_best_rank'],
|
||||
'score' => $row['score'],
|
||||
'history_best_score' => $row['history_best_score'],
|
||||
'bceg' => cegFormat($row['bceg']),
|
||||
'gold' => cegFormat($row['gold']),
|
||||
'diamond' => cecFormat($row['diamond']),
|
||||
'hero_id' => $row['hero_id'],
|
||||
@ -71,6 +72,7 @@ class User extends BaseModel {
|
||||
'history_best_rank' => $row['history_best_rank'],
|
||||
'score' => $row['score'],
|
||||
'history_best_score' => $row['history_best_score'],
|
||||
'bceg' => cegFormat($row['bceg']),
|
||||
'gold' => cegFormat($row['gold']),
|
||||
'diamond' => cecFormat($row['diamond']),
|
||||
'hero_id' => $row['hero_id'],
|
||||
|
@ -21,9 +21,12 @@ require_once('models/Battle.php');
|
||||
require_once('models/Bag.php');
|
||||
require_once('models/Hero.php');
|
||||
require_once('models/Gun.php');
|
||||
require_once('models/Chip.php');
|
||||
require_once('models/Nft.php');
|
||||
require_once('models/FragmentPool.php');
|
||||
require_once('models/RealtimeData.php');
|
||||
require_once('models/BattleHistory.php');
|
||||
require_once('models/NftActive.php');
|
||||
|
||||
require_once('services/RankActivityService.php');
|
||||
require_once('services/FormulaService.php');
|
||||
@ -32,6 +35,9 @@ require_once('services/PropertyChgService.php');
|
||||
require_once('services/LogService.php');
|
||||
|
||||
|
||||
use models\Chip;
|
||||
use models\Nft;
|
||||
use models\NftActive;
|
||||
use mt;
|
||||
use services;
|
||||
use phpcommon\SqlHelper;
|
||||
@ -140,8 +146,10 @@ class BattleDataService extends BaseService {
|
||||
$this->weapon2Dto['pve_ceg_uplimit'] : $this->weapon2Dto['pvp_ceg_uplimit'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//录入战斗记录
|
||||
$this->saveBattleHistory();
|
||||
// $this->saveBattleHistory();
|
||||
|
||||
switch ($matchMode) {
|
||||
case self::MATCH_MODE_PVP:
|
||||
@ -839,12 +847,82 @@ class BattleDataService extends BaseService {
|
||||
'new_weaponPvpCeg1' => $weaponPvpCeg1,
|
||||
'new_weaponPvpCeg2' => $weaponPvpCeg2,
|
||||
)));
|
||||
$gold = $heroPvpCeg + $weaponPvpCeg1 + $weaponPvpCeg2;
|
||||
$gold = $heroPvpCeg + $weaponPvpCeg1 + $weaponPvpCeg2;print_r($heroPvpCeg);
|
||||
if ($heroPvpCeg>0){
|
||||
$this->_addNftActive($this->heroDto,1);
|
||||
}
|
||||
if ($weaponPvpCeg1>0){
|
||||
$this->_addNftActive($this->weapon1Dto,2);
|
||||
}
|
||||
if ($weaponPvpCeg2>0){
|
||||
|
||||
$this->_addNftActive($this->weapon2Dto,2);
|
||||
}
|
||||
if ($gold > 0) {
|
||||
myself()->_addVirtualItem(V_ITEM_GOLD, $gold);
|
||||
}
|
||||
}
|
||||
|
||||
private function _addNftActive($nftDb,$type){
|
||||
if (!$nftDb){
|
||||
return ;
|
||||
}
|
||||
switch ($type){
|
||||
case Nft::HERO_TYPE:
|
||||
{
|
||||
$data = array(
|
||||
'uniid' => $nftDb['hero_uniid'],
|
||||
'token_id' => $nftDb['token_id'],
|
||||
'token_type' => Nft::HERO_TYPE,
|
||||
);
|
||||
NftActive::upsert($data);
|
||||
if ($nftDb['chip_ids']){
|
||||
$chip_ids = explode("|",$nftDb['chip_ids']);
|
||||
if (count($chip_ids)>0){
|
||||
foreach ($chip_ids as $chip_id){
|
||||
$chipDb = Chip::getChipByIdx($chip_id);
|
||||
self::_addNftActive($chipDb,Nft::CHIP_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Nft::EQUIP_TYPE:
|
||||
{
|
||||
$data = array(
|
||||
'uniid' => $nftDb['gun_uniid'],
|
||||
'token_id' => $nftDb['token_id'],
|
||||
'token_type' => Nft::EQUIP_TYPE,
|
||||
);
|
||||
NftActive::upsert($data);
|
||||
if ($nftDb['chip_ids']){
|
||||
$chip_ids = explode("|",$nftDb['chip_ids']);
|
||||
if (count($chip_ids)>0){
|
||||
foreach ($chip_ids as $chip_id){
|
||||
$chipDb = Chip::getChipByIdx($chip_id);
|
||||
self::_addNftActive($chipDb,Nft::CHIP_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Nft::CHIP_TYPE:
|
||||
{
|
||||
$data = array(
|
||||
'uniid' => $nftDb['idx'],
|
||||
'token_id' => $nftDb['token_id'],
|
||||
'token_type' => Nft::CHIP_TYPE,
|
||||
);
|
||||
NftActive::upsert($data);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function rewardCegPve()
|
||||
{
|
||||
$log_param = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user