1
This commit is contained in:
commit
6ef16b7a76
@ -463,8 +463,8 @@ class SeasonReward(object):
|
||||
|
||||
def __init__(self):
|
||||
self.fields = [
|
||||
['reward_id', 0, '奖励的item id'],
|
||||
['reward_num', 0, '奖励的数量'],
|
||||
['item_id', 0, '奖励的item id'],
|
||||
['item_num', 0, '奖励的数量'],
|
||||
|
||||
]
|
||||
|
||||
@ -483,7 +483,9 @@ class SeasonRank(object):
|
||||
['score', 0, '积分'],
|
||||
['history_best_score', 0, '历史最高积分'],
|
||||
['rank_num', 0, '赛季排位场次'],
|
||||
['rank_sort', 0, '赛季序列排行'],
|
||||
['rank_sort', 0, '赛季排行'],
|
||||
['rewardCEC', 0, 'CEC奖励'],
|
||||
['ring_item_id', 0, '奖励戒子 item id,0为无奖励'],
|
||||
]
|
||||
|
||||
|
||||
|
@ -739,13 +739,13 @@ CREATE TABLE `t_user_season_ring` (
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_season_history`
|
||||
-- Table structure for table `t_season_ranking`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_season_history`;
|
||||
DROP TABLE IF EXISTS `t_season_ranking`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_season_history` (
|
||||
CREATE TABLE `t_season_ranking` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel',
|
||||
@ -759,3 +759,21 @@ CREATE TABLE `t_season_history` (
|
||||
UNIQUE KEY `account_id_season` (`account_id`, `season`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `t_parachute`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_parachute`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_parachute` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -9,6 +9,8 @@ require_once('models/Hero.php');
|
||||
require_once('models/HeroSkin.php');
|
||||
require_once('models/GunSkin.php');
|
||||
require_once('models/User.php');
|
||||
require_once('models/Nft.php');
|
||||
require_once('models/Parachute.php');
|
||||
require_once('mt/Parameter.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
@ -19,6 +21,8 @@ use models\Gun;
|
||||
use models\HeroSkin;
|
||||
use models\GunSkin;
|
||||
use models\User;
|
||||
use models\Nft;
|
||||
use models\Parachute;
|
||||
|
||||
class BaseAuthedController extends BaseController {
|
||||
|
||||
@ -342,6 +346,18 @@ class BaseAuthedController extends BaseController {
|
||||
$propertyService->addBagChg();
|
||||
}
|
||||
break;
|
||||
case mt\Item::RING_TYPE:
|
||||
{
|
||||
Nft::addNft($itemMeta);
|
||||
$propertyService->addUserChg();
|
||||
}
|
||||
break;
|
||||
case mt\Item::PARACHUTE_TYPE:
|
||||
{
|
||||
Parachute::addParachute($itemMeta);
|
||||
$propertyService->addUserChg();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
$this->_addLog('additems', 'invalid_item', array(
|
||||
|
15
webapp/controller/ParachuteController.class.php
Normal file
15
webapp/controller/ParachuteController.class.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
require_once('models/Parachute.php');
|
||||
|
||||
use models\Parachute;
|
||||
|
||||
class ParachuteController extends BaseAuthedController
|
||||
{
|
||||
public function parachuteList(){
|
||||
$list = Parachute::getMyParachute();
|
||||
$this->_rspData(array(
|
||||
'data' => $list
|
||||
));
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
require_once('models/User.php');
|
||||
require_once('models/Season.php');
|
||||
require_once('models/SeasonHistory.php');
|
||||
require_once('models/SeasonRanking.php');
|
||||
|
||||
require_once('mt/RankActivity.php');
|
||||
require_once('mt/RankSeason.php');
|
||||
@ -15,7 +15,7 @@ use phpcommon\SqlHelper;
|
||||
|
||||
use models\User;
|
||||
use models\Season;
|
||||
use models\SeasonHistory;
|
||||
use models\SeasonRanking;
|
||||
|
||||
class RankingController extends BaseAuthedController {
|
||||
private $starshine = 2800;
|
||||
@ -108,7 +108,6 @@ class RankingController extends BaseAuthedController {
|
||||
|
||||
public function getOpenList()
|
||||
{
|
||||
$this->calcCECSeasonAward(2);die;
|
||||
$this->_rspData(array(
|
||||
'list' => mt\RankActivity::getOpenList()
|
||||
));
|
||||
@ -147,6 +146,9 @@ class RankingController extends BaseAuthedController {
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addUserChg();
|
||||
$propertyChgService->addBagChg();
|
||||
$propertyChgService->addParachute();
|
||||
$cec = $this->calcCECSeasonAward($currSeasonMeta['id']-1);
|
||||
$award = array_merge($award,$cec);
|
||||
if ($award){
|
||||
$this->_addItems($award,$awardService,$propertyChgService);
|
||||
}
|
||||
@ -269,57 +271,58 @@ class RankingController extends BaseAuthedController {
|
||||
}
|
||||
|
||||
private function calcCECSeasonAward($seasonId){
|
||||
// $users = User::allUser();
|
||||
|
||||
$data = SeasonHistory::getDataBySeasonId($seasonId);
|
||||
$data = SeasonRanking::getDataBySeasonId($seasonId);
|
||||
$rewardParamMeta = \mt\Parameter::getByName('rank_ring_reward');
|
||||
$rewardParamMetaValue = $rewardParamMeta ? $rewardParamMeta['param_value'] : '';
|
||||
$rewardList = explode('|',$rewardParamMetaValue);
|
||||
$award = array();
|
||||
if (count($data)>0){
|
||||
$rankList = array();
|
||||
$ringList = array();
|
||||
$KingCount = 0;
|
||||
$users = User::orderBy($data);
|
||||
foreach ($users as $k=>$user){
|
||||
$user['rank_sort'] = $k+1;
|
||||
if ($user['score'] >= $this->starshine){
|
||||
foreach ($data as &$value){
|
||||
if ($value['score'] >= $this->starshine){
|
||||
$KingCount += 1;
|
||||
$user['echelonTopX'] = \services\FormulaService::echelonTopX($user['rank_sort']);
|
||||
// $r = $this->_getRedis($this->TopXunid.$user['echelonTopX']);
|
||||
// $TopX_List = $this->readRankingList($r,$this->TopXunid.$user['echelonTopX']);
|
||||
// array_push($TopX_List,$user);
|
||||
// $this->saveRankingList($r,$this->TopXunid.$user['echelonTopX'],$TopX_List);
|
||||
if ( ! isset( ${$this->TopXunid.$user['echelonTopX']} )){
|
||||
${$this->TopXunid.$user['echelonTopX']} =array();
|
||||
$value['echelonTopX'] = \services\FormulaService::echelonTopX($value['ranking']);
|
||||
switch ($value['ranking']){
|
||||
case 1:$value['ring_item_id'] = $rewardList[0];break;
|
||||
case 2:$value['ring_item_id'] = $rewardList[1];break;
|
||||
case 3:$value['ring_item_id'] = $rewardList[2];break;
|
||||
default : $value['ring_item_id'] = 0;
|
||||
}
|
||||
array_push(${$this->TopXunid.$user['echelonTopX']},$user);
|
||||
}
|
||||
switch ($user['rank_sort']){
|
||||
case 1:$user['ring_item_id'] = $rewardList[0];array_push($ringList,$user);break;
|
||||
case 2:$user['ring_item_id'] = $rewardList[1];array_push($ringList,$user);break;
|
||||
case 3:$user['ring_item_id'] = $rewardList[2];array_push($ringList,$user);break;
|
||||
default : $user['ring_item_id'] = 0;
|
||||
}
|
||||
array_push($rankList,$user);
|
||||
}
|
||||
//当月排位赛最大分配金额
|
||||
$maxSum = \services\FormulaService::calcCECMaxSum();
|
||||
//排位赛预计分配额
|
||||
$expected_CEC_Sum = 0;
|
||||
foreach ($rankList as $k=>$value){
|
||||
// $r = $this->_getRedis($this->TopXunid.($value['echelonTopX']+1));
|
||||
// $TopX_List = $this->readRankingList($r,$this->TopXunid.($value['echelonTopX']+1));
|
||||
// $XX = $TopX_List ? $TopX_List[0]["rank_sort"]:10001;
|
||||
$TopX_List = ${$this->TopXunid.($value['echelonTopX']+1)};
|
||||
$XX = $TopX_List ? $TopX_List[0]["rank_sort"]:10001;
|
||||
$rankList[$k]['XX'] = $XX;
|
||||
$rankList[$k]['standardTopX'] = \services\FormulaService::standardTopX($value['rank_sort'],$XX);
|
||||
$expected_CEC_Sum += \services\FormulaService::calcCECTopXSum($value['rank_sort'],$KingCount,$XX);
|
||||
foreach ($data as &$value){
|
||||
if ($value['score'] >= $this->starshine){
|
||||
$value['standardTopX'] = \services\FormulaService::standardTopX($value['ranking'],$value['echelonTopX']);
|
||||
$expected_CEC_Sum += \services\FormulaService::calcCECTopXSum($value['ranking'],$value['echelonTopX'],$KingCount);
|
||||
}
|
||||
}
|
||||
//排位赛金额%
|
||||
$rankAmountPre = min($maxSum/($expected_CEC_Sum+1),1); //MIN(当月排位赛最大分配额/(排位赛预计分配额+1),1)
|
||||
$rankAmountPre = min($maxSum/($expected_CEC_Sum+1),1);
|
||||
|
||||
foreach ($data as $val){
|
||||
if ($val['account_id'] == myself()->_getAccountId() &&
|
||||
$value['score'] >= $this->starshine &&
|
||||
$value['ranking'] <= 10000){
|
||||
// $award['CEC'] = $value['standardTopX']*$rankAmountPre;
|
||||
// $award['ring_item_id'] = $value['ring_item_id'];
|
||||
array_push($award,array(
|
||||
'item_id' => V_ITEM_DIAMOND,
|
||||
'item_num' => $value['standardTopX']*$rankAmountPre
|
||||
));
|
||||
if ($value['ring_item_id']){
|
||||
array_push($award,array(
|
||||
'item_id' => $value['ring_item_id'],
|
||||
'item_num' => 1
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print_r($expected_CEC_Sum);
|
||||
return $award;
|
||||
}
|
||||
|
||||
private function readRankingList($r,$rankUnid)
|
||||
|
@ -73,11 +73,6 @@ class SeasonController extends BaseAuthedController {
|
||||
|
||||
public function infoNew()
|
||||
{
|
||||
// $r = $this->_getRedis($this->TopXunid.'4');
|
||||
// $TopX_List = $this->readRankingList($r,$this->TopXunid.'5');
|
||||
// $XX = $TopX_List ? $TopX_List[0]["rank_sort"]:10001;
|
||||
// print_r($XX);
|
||||
// die;
|
||||
$rankMeta = mt\Rank::getRankById($this->userInfo['rank']);
|
||||
$nextRankMeta = mt\Rank::getNextRankById($this->userInfo['rank']);
|
||||
if (!$nextRankMeta){
|
||||
@ -105,7 +100,7 @@ class SeasonController extends BaseAuthedController {
|
||||
array_push($list,$v);
|
||||
}
|
||||
}
|
||||
$info['season_rank'] = $rankList;
|
||||
$info['season_rank'] = $list;
|
||||
$this->_rspData(['info'=>$info]);
|
||||
}
|
||||
|
||||
@ -276,11 +271,7 @@ class SeasonController extends BaseAuthedController {
|
||||
$userDto['rank_sort'] = $k+1;
|
||||
if ($userDto['score'] >= $this->starshine){
|
||||
$KingCount += 1;
|
||||
$userDto['echelonTopX'] = $this->echelonTopX($userDto['rank_sort']);
|
||||
$r = $this->_getRedis($this->TopXunid.$userDto['echelonTopX']);
|
||||
$TopX_List = $this->readRankingList($r,$this->TopXunid.$userDto['echelonTopX']);
|
||||
array_push($TopX_List,$userDto);
|
||||
$this->saveRankingList($r,$this->TopXunid.$userDto['echelonTopX'],$TopX_List);
|
||||
$userDto['echelonTopX'] = \services\FormulaService::echelonTopX($userDto['rank_sort']);
|
||||
}
|
||||
switch ($userDto['rank_sort']){
|
||||
case 1:$userDto['ring_item_id'] = $rewardList[0];break;
|
||||
@ -292,7 +283,7 @@ class SeasonController extends BaseAuthedController {
|
||||
}
|
||||
|
||||
//当月排位赛最大分配金额
|
||||
$maxSum = $this->calcCECMaxSum();
|
||||
$maxSum = \services\FormulaService::calcCECMaxSum();
|
||||
//排位赛参与分配人数
|
||||
// $PeopleCapita = $this->calcPeopleCapita($KingCount);
|
||||
//排位赛人数%
|
||||
@ -300,18 +291,17 @@ class SeasonController extends BaseAuthedController {
|
||||
//排位赛预计分配额
|
||||
$expected_CEC_Sum = 0;
|
||||
foreach ($rankList as $k=>$value){
|
||||
$r = $this->_getRedis($this->TopXunid.($value['echelonTopX']+1));
|
||||
$TopX_List = $this->readRankingList($r,$this->TopXunid.($value['echelonTopX']+1));
|
||||
$XX = $TopX_List ? $TopX_List[0]["rank_sort"]:10001;
|
||||
$rankList[$k]['standardTopX'] = $this->standardTopX($value['rank_sort'],$XX);
|
||||
$expected_CEC_Sum += $this->calcCECTopXSum($value['rank_sort'],$KingCount,$XX);
|
||||
if ($value['score'] >= $this->starshine){
|
||||
$rankList[$k]['standardTopX'] = \services\FormulaService::standardTopX($value['rank_sort'],$value['echelonTopX']);
|
||||
$expected_CEC_Sum += \services\FormulaService::calcCECTopXSum($value['rank_sort'],$value['echelonTopX'],$KingCount);
|
||||
}
|
||||
}
|
||||
//排位赛金额%
|
||||
$rankAmountPre = min($maxSum/($expected_CEC_Sum+1),1); //MIN(当月排位赛最大分配额/(排位赛预计分配额+1),1)
|
||||
|
||||
foreach ($rankList as $k=>$value){
|
||||
// $rankList[$k]['rewardCEC'] = $value['standardTopX']*$rankAmountPre;
|
||||
if ($value['score'] >= $this->starshine){
|
||||
if ($value['score'] >= $this->starshine &&
|
||||
$value['rank_sort'] <= 10000 ){
|
||||
$rankList[$k]['rewardCEC'] = $value['standardTopX']*$rankAmountPre;
|
||||
}else{
|
||||
$rankList[$k]['rewardCEC'] = 0;
|
||||
@ -321,71 +311,6 @@ class SeasonController extends BaseAuthedController {
|
||||
return $rankList;
|
||||
}
|
||||
|
||||
//排位赛最大分配金额
|
||||
private function calcCECMaxSum(){
|
||||
//当月排位赛最大分配金额=ROUND(40000000/(12*(1+0.7^1+0.7^2+0.7^3+0.7^4+0.7^5+0.7^6+0.7^7))*0.7^(CEILING(月份数/12-0.01,1)-1),0)*70%
|
||||
$month = date('m',$this->_getNowTime());
|
||||
return round(40000000/(12*(1+pow(0.7,1)+pow(0.7,2)+pow(0.7,3)+pow(0.7,4)
|
||||
+pow(0.7,5)+pow(0.7,6)+pow(0.7,7)))*pow(0.7,ceil($month/12-0.01)-1),0)*0.7;
|
||||
}
|
||||
//排位赛参与分配人数
|
||||
private function calcPeopleCapita($kingCount){
|
||||
//MIN(当月王者及以上用户数,ROUND(LOG10(当月王者及以上用户数+2)^3*1.5,1)*100)
|
||||
return min($kingCount,round(pow(log10($kingCount+2),3)*1.5,1)*100);
|
||||
}
|
||||
//排位赛人数%
|
||||
private function calcPeopleCapitaPer($kingCount){
|
||||
//MIN(ROUND(0.31*MIN(当月王者及以上用户数,ROUND(LOG10(当月王者及以上用户数+1)^3*1.5,2)*100)^0.226,2),2)
|
||||
return min(round(0.31*pow(min($kingCount,round(pow(log10($kingCount+1),3)*1.5,2)*100),0.226),2),2);
|
||||
}
|
||||
//TopX梯队
|
||||
private function echelonTopX($top){
|
||||
//TopX梯队=SIGN(TopX<=3)*1+SIGN(TopX>3)*SIGN(TopX<=10)*2+SIGN(TopX>10)*SIGN(TopX<=50)*3
|
||||
//+SIGN(TopX>50)*SIGN(TopX<=100)*4+SIGN(TopX>100)*SIGN(TopX<=500)*5+SIGN(TopX>500)*SIGN(TopX<=1000)*6
|
||||
//+SIGN(TopX>1000)*SIGN(TopX<=2000)*7+SIGN(TopX>2000)*SIGN(TopX<=5000)*8
|
||||
//+SIGN(TopX>5000)*SIGN(TopX<=10000)*9+SIGN(TopX>10000)*10
|
||||
return ($top<=3?1:0)*1+($top>3?1:0)*($top<=10?1:0)*2+($top>10?1:0)*($top<=50?1:0)*3
|
||||
+($top>50?1:0)*($top<=100?1:0)*4+($top>100?1:0)*($top<=500?1:0)*5+($top>500?1:0)*($top<=1000?1:0)*6
|
||||
+($top>1000?1:0)*($top<=2000?1:0)*7+($top>2000?1:0)*($top<=5000?1:0)*8
|
||||
+($top>5000?1:0)*($top<=10000?1:0)*9+($top>10000?1:0)*10;
|
||||
}
|
||||
//TopX开始值
|
||||
private function startTopX($top){
|
||||
//TopX开始值=SIGN(TopX梯队=1)*1+SIGN(TopX梯队=2)*4+SIGN(TopX梯队=3)*11+SIGN(TopX梯队=4)*51
|
||||
//+SIGN(TopX梯队=5)*101+SIGN(TopX梯队=6)*501+SIGN(TopX梯队=7)*1001
|
||||
//+SIGN(TopX梯队=8)*2001+SIGN(TopX梯队=9)*5001+SIGN(TopX梯队=10)*10001
|
||||
return ($this->echelonTopX($top)==1?1:0)*1+($this->echelonTopX($top)==2?1:0)*4+($this->echelonTopX($top)==3?1:0)*11+($this->echelonTopX($top)==4?1:0)*51
|
||||
+($this->echelonTopX($top)==5?1:0)*101+($this->echelonTopX($top)==6?1:0)*501+($this->echelonTopX($top)==7?1:0)*1001
|
||||
+($this->echelonTopX($top)==8?1:0)*2001+($this->echelonTopX($top)==9?1:0)*5001+($this->echelonTopX($top)==10?1:0)*10001;
|
||||
}
|
||||
//TopX梯队最高值
|
||||
private function maxTopX($top){
|
||||
//TopX梯队最高值=ROUND(2000*0.6^(TopX梯队-1)*0.9^(TopX梯队-1),0)
|
||||
return round(2000*pow(0.6,$this->echelonTopX($top)-1)*pow(0.9,$this->echelonTopX($top)-1),0);
|
||||
|
||||
}
|
||||
//TopX梯队最低值
|
||||
private function minTopX($top){
|
||||
//TopX梯队最低值=ROUND(2000*0.6^(TopX梯队)*0.9^(TopX梯队-1),0)
|
||||
return round(2000*pow(0.6,$this->echelonTopX($top))*pow(0.9,$this->echelonTopX($top)-1),0);
|
||||
}
|
||||
//TopX排位赛标准分配额
|
||||
private function standardTopX($top,$XX){
|
||||
//TopX排位赛标准分配额=MAX(ROUND(TopX梯队最高值-(TopX梯队最高值-TopX梯队最低值)/(TopX梯队开始值(TopX梯队+1)-TopX梯队开始值-1)*(TopX-TopX梯队开始值),2),TopX梯队最低值)
|
||||
return max(round($this->maxTopX($top)-($this->maxTopX($top)-$this->minTopX($top))/($XX-$this->startTopX($top)-1)*($top-$this->startTopX($top)),2),$this->minTopX($top));
|
||||
}
|
||||
//TopX排位赛预计分配额
|
||||
private function calcCECTopXSum($top,$kingCount,$XX){
|
||||
//TopX排位赛标准分配额*排位赛人数%
|
||||
return $this->standardTopX($top,$XX)*$this->calcPeopleCapitaPer($kingCount);
|
||||
|
||||
}
|
||||
//排位赛金额%
|
||||
private function rankAmountPre(){
|
||||
//MIN(当月排位赛最大分配额/(排位赛预计分配额+1),1)
|
||||
}
|
||||
|
||||
|
||||
private function readRankingList($r,$rankUnid)
|
||||
{
|
||||
$list = $r->get(RANKING_KEY.$rankUnid);
|
||||
|
@ -21,6 +21,7 @@ class Nft extends BaseModel {
|
||||
const CHIP_TYPE = 3; //芯片
|
||||
const BLIND_BOX_TYPE = 4;
|
||||
const FRAGMENT_TYPE = 5; //碎片
|
||||
const RING_TYPE = 19; //碎片
|
||||
|
||||
const GENESIS_TAG = 1;
|
||||
|
||||
@ -58,6 +59,11 @@ class Nft extends BaseModel {
|
||||
{
|
||||
return self::FRAGMENT_TYPE;
|
||||
}
|
||||
break;
|
||||
case mt\Item::RING_TYPE:
|
||||
{
|
||||
return self::RING_TYPE;
|
||||
}
|
||||
}
|
||||
return self::NONE_TYPE;
|
||||
}
|
||||
|
40
webapp/models/Parachute.php
Normal file
40
webapp/models/Parachute.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace models;
|
||||
require_once('mt/Item.php');
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
class Parachute extends BaseModel
|
||||
{
|
||||
public static function getMyParachute(){
|
||||
return SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_parachute',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
)
|
||||
);
|
||||
}
|
||||
public static function addParachute($itemMeta){
|
||||
if ($itemMeta){
|
||||
if ($itemMeta['type'] == mt\Item::PARACHUTE_TYPE){
|
||||
SqlHelper::insert(
|
||||
myself()->_getSelfMysql(),
|
||||
't_parachute',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'item_id' => $itemMeta['id'],
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
class SeasonHistory extends BaseModel
|
||||
{
|
||||
public static function save($data){
|
||||
SqlHelper::upsert(
|
||||
myself()->_getSelfMysql(),
|
||||
't_season_history',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'season' => $data['season'],
|
||||
),
|
||||
array(),
|
||||
$data
|
||||
);
|
||||
}
|
||||
|
||||
public static function getDataBySeasonId($seasonId){
|
||||
return SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_season_history',
|
||||
array(
|
||||
'season' => $seasonId,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
20
webapp/models/SeasonRanking.php
Normal file
20
webapp/models/SeasonRanking.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
class SeasonRanking extends BaseModel
|
||||
{
|
||||
public static function getDataBySeasonId($seasonId){
|
||||
return SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_season_ranking',
|
||||
array(
|
||||
'season' => $seasonId,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -25,6 +25,8 @@ class Item {
|
||||
12 盲盒
|
||||
13 芯片
|
||||
15 碎片透明箱子
|
||||
16 降落伞皮肤
|
||||
19 赛季戒指
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -89,6 +91,8 @@ class Item {
|
||||
const BLIND_BOX_TYPE = 12;
|
||||
const CHIP_TYPE = 13;
|
||||
const FRAGMENT_BOX_TYPE = 15;
|
||||
const PARACHUTE_TYPE = 16;
|
||||
const RING_TYPE = 19;
|
||||
|
||||
const FUNC_RENAME_CARD_SUBTYPE = 1;
|
||||
const MATERIAL_CHIP_SUBTYPE = 3;
|
||||
|
@ -817,34 +817,38 @@ class FormulaService extends BaseService {
|
||||
+($top>5000?1:0)*($top<=10000?1:0)*9+($top>10000?1:0)*10;
|
||||
}
|
||||
//TopX开始值
|
||||
private static function startTopX($top){
|
||||
public static function startTopX($topTd){
|
||||
//TopX开始值=SIGN(TopX梯队=1)*1+SIGN(TopX梯队=2)*4+SIGN(TopX梯队=3)*11+SIGN(TopX梯队=4)*51
|
||||
//+SIGN(TopX梯队=5)*101+SIGN(TopX梯队=6)*501+SIGN(TopX梯队=7)*1001
|
||||
//+SIGN(TopX梯队=8)*2001+SIGN(TopX梯队=9)*5001+SIGN(TopX梯队=10)*10001
|
||||
return (self::echelonTopX($top)==1?1:0)*1+(self::echelonTopX($top)==2?1:0)*4+(self::echelonTopX($top)==3?1:0)*11+(self::echelonTopX($top)==4?1:0)*51
|
||||
+(self::echelonTopX($top)==5?1:0)*101+(self::echelonTopX($top)==6?1:0)*501+(self::echelonTopX($top)==7?1:0)*1001
|
||||
+(self::echelonTopX($top)==8?1:0)*2001+(self::echelonTopX($top)==9?1:0)*5001+(self::echelonTopX($top)==10?1:0)*10001;
|
||||
return ($topTd==1?1:0)*1+($topTd==2?1:0)*4+($topTd==3?1:0)*11+($topTd==4?1:0)*51
|
||||
+($topTd==5?1:0)*101+($topTd==6?1:0)*501+($topTd==7?1:0)*1001
|
||||
+($topTd==8?1:0)*2001+($topTd==9?1:0)*5001+($topTd==10?1:0)*10001;
|
||||
// return (self::echelonTopX($top)==1?1:0)*1+(self::echelonTopX($top)==2?1:0)*4+(self::echelonTopX($top)==3?1:0)*11+(self::echelonTopX($top)==4?1:0)*51
|
||||
// +(self::echelonTopX($top)==5?1:0)*101+(self::echelonTopX($top)==6?1:0)*501+(self::echelonTopX($top)==7?1:0)*1001
|
||||
// +(self::echelonTopX($top)==8?1:0)*2001+(self::echelonTopX($top)==9?1:0)*5001+(self::echelonTopX($top)==10?1:0)*10001;
|
||||
}
|
||||
//TopX梯队最高值
|
||||
private static function maxTopX($top){
|
||||
private static function maxTopX($topTd){
|
||||
//TopX梯队最高值=ROUND(2000*0.6^(TopX梯队-1)*0.9^(TopX梯队-1),0)
|
||||
return round(2000*pow(0.6,self::echelonTopX($top)-1)*pow(0.9,self::echelonTopX($top)-1),0);
|
||||
return round(2000*pow(0.6,$topTd-1)*pow(0.9,$topTd-1),0);
|
||||
|
||||
}
|
||||
//TopX梯队最低值
|
||||
private static function minTopX($top){
|
||||
private static function minTopX($topTd){
|
||||
//TopX梯队最低值=ROUND(2000*0.6^(TopX梯队)*0.9^(TopX梯队-1),0)
|
||||
return round(2000*pow(0.6,self::echelonTopX($top))*pow(0.9,self::echelonTopX($top)-1),0);
|
||||
return round(2000*pow(0.6,$topTd)*pow(0.9,$topTd-1),0);
|
||||
}
|
||||
//TopX排位赛标准分配额
|
||||
public static function standardTopX($top,$XX){
|
||||
public static function standardTopX($top,$topTd){
|
||||
//TopX排位赛标准分配额=MAX(ROUND(TopX梯队最高值-(TopX梯队最高值-TopX梯队最低值)/(TopX梯队开始值(TopX梯队+1)-TopX梯队开始值-1)*(TopX-TopX梯队开始值),2),TopX梯队最低值)
|
||||
return max(round(self::maxTopX($top)-(self::maxTopX($top)-self::minTopX($top))/($XX-self::startTopX($top)-1)*($top-self::startTopX($top)),2),self::minTopX($top));
|
||||
$XX = self::startTopX($topTd+1)?self::startTopX($topTd+1):10001;
|
||||
return max(round(self::maxTopX($topTd)-(self::maxTopX($topTd)-self::minTopX($topTd))/($XX-self::startTopX($topTd)-1)*($top-self::startTopX($topTd)),2),self::minTopX($topTd));
|
||||
}
|
||||
//TopX排位赛预计分配额
|
||||
public static function calcCECTopXSum($top,$kingCount,$XX){
|
||||
public static function calcCECTopXSum($top,$topTd,$kingCount){
|
||||
//TopX排位赛标准分配额*排位赛人数%
|
||||
return self::standardTopX($top,$XX)*self::calcPeopleCapitaPer($kingCount);
|
||||
return self::standardTopX($top,$topTd)*self::calcPeopleCapitaPer($kingCount);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,11 @@ class PropertyChgService extends BaseService {
|
||||
$this->internalAddChg('fragment');
|
||||
}
|
||||
|
||||
public function addParachute()
|
||||
{
|
||||
$this->internalAddChg('parachute');
|
||||
}
|
||||
|
||||
public function toDto()
|
||||
{
|
||||
$data = array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user