Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb

This commit is contained in:
hujiabin 2022-09-19 17:20:48 +08:00
commit 6bedb6709e
4 changed files with 86 additions and 7 deletions

View File

@ -579,6 +579,9 @@ CREATE TABLE `t_game_log` (
-- Dump completed on 2015-08-19 18:51:22
--
-- Table structure for table `t_nft_active`
--
DROP TABLE IF EXISTS `t_nft_active`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
@ -596,4 +599,42 @@ CREATE TABLE `t_nft_active` (
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_fragment_pool`
--
DROP TABLE IF EXISTS `t_fragment_pool`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_fragment_pool` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`fragment_id` int(11) NOT NULL DEFAULT '0' COMMENT '碎片id',
`fragment_type` int(11) NOT NULL DEFAULT '0' COMMENT '碎片类型 0:英雄 1:武器',
`fragment_num` int(11) NOT NULL DEFAULT '0' COMMENT '碎片数量',
`alloc_time` int(11) NOT NULL DEFAULT '0' COMMENT '分配时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
KEY `alloc_time_fragment_type` (`alloc_time`, `fragment_type`),
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_realtime_data`
--
DROP TABLE IF EXISTS `t_realtime_data`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_realtime_data` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`name` varchar(60) NOT NULL DEFAULT '' COMMENT '参数名',
`value1` varchar(60) NOT NULL DEFAULT '' COMMENT '值1',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
-- Dump completed on 2015-08-19 18:51:22

View File

@ -7,4 +7,14 @@ use phpcommon\SqlHelper;
class FragmentPool extends BaseModel {
public static function dropHero()
{
}
public static function dropGun()
{
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class RealtimeData extends BaseModel {
//获取在线人数
public static function getOnline()
{
$onlineNum = self::internalGet('online_num');
return max(1, $onlineNum ? $onlineNum : 0);
}
private static function internalGet($name)
{
$row = SqlHelper::ormSelectOne
(myself()->_getMysql($targetId),
't_realtime_data',
array(
'name' => $name
)
);
return $row ? $row : '';
}
}

View File

@ -20,9 +20,11 @@ require_once('models/Battle.php');
require_once('models/Bag.php');
require_once('models/Hero.php');
require_once('models/Gun.php');
require_once('models/FragmentPool.php');
require_once('services/RankActivityService.php');
require_once('services/FormulaService.php');
require_once('services/RealtimeData.php');
use mt;
use phpcommon\SqlHelper;
@ -32,6 +34,7 @@ use models\Bag;
use models\Hero;
use models\Gun;
use services\FormulaService;
use services\RealtimeData;
class BattleDataService extends BaseService {
@ -492,7 +495,7 @@ class BattleDataService extends BaseService {
return;
}
$onlineNum = $this->getOnlineNumber();
$onlineNum = RealtimeData::getOnline();
$rankedTopX= getXVal($params, 'ranked_topx');
$meta = mt\FormulaPvp::getByRanked($rankedTopX);
@ -528,6 +531,7 @@ class BattleDataService extends BaseService {
return;
}
}
private function rewardFragmentPve()
@ -542,7 +546,7 @@ class BattleDataService extends BaseService {
return;
}
$onlineNum = $this->getOnlineNumber();
$onlineNum = RealtimeData::getOnline();
$instanceLevel = $this->pveGeminiMeta['gemini_lv'];
$instanceRank = $this->instanceRank;
$instanceRankRate = $this->getInstanceRankRate();
@ -658,11 +662,6 @@ class BattleDataService extends BaseService {
}
}
private function getOnlineNumber()
{
return max(1, 0);
}
private function randWeight($items)
{
$weights = array();