1
This commit is contained in:
parent
20df5fea91
commit
ae2f4264c1
16
doc/Emoji.py
16
doc/Emoji.py
@ -15,7 +15,7 @@ class Emoji(object):
|
|||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['!data', [_common.Emoji()], '表情列表'],
|
['!data', [_common.Emoji()], '表情列表'],
|
||||||
['use_emoji', [], '已选择的表情列表'],
|
['!use_emoji', [UsedEmoji()], '已选择的表情列表'],
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
'name': 'setEmoji',
|
'name': 'setEmoji',
|
||||||
@ -24,7 +24,8 @@ class Emoji(object):
|
|||||||
'url': 'webapp/index.php?c=Emoji&a=setEmoji',
|
'url': 'webapp/index.php?c=Emoji&a=setEmoji',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['item_id', '0', 'item_id'],
|
['item_id', '0', '表情itemid'],
|
||||||
|
['slot_id', '0', '卡槽id'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
@ -36,10 +37,19 @@ class Emoji(object):
|
|||||||
'url': 'webapp/index.php?c=Emoji&a=cancel',
|
'url': 'webapp/index.php?c=Emoji&a=cancel',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['item_id', '0', 'item_id'],
|
['slot_id', '0', '卡槽id'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class UsedEmoji(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['item_id', 0, '表情itemid 0:未选择'],
|
||||||
|
['slot_id', 0, '卡槽id'],
|
||||||
|
]
|
@ -13,7 +13,8 @@ class Ranking(object):
|
|||||||
'url': 'webapp/index.php?c=Ranking&a=rankingList',
|
'url': 'webapp/index.php?c=Ranking&a=rankingList',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['type', 0, ' 1:场次榜 2:吃鸡榜 3:mvp榜 4:前三名榜 5:击杀榜']
|
['class', 0, ' 1:总榜 2:日榜 3:周榜 '],
|
||||||
|
['type', 0, ' 1:场次榜 2:吃鸡榜 3:mvp榜 4:前三名榜 5:击杀榜'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
15
sql/gamedb2006_migrate_240129_01.sql
Normal file
15
sql/gamedb2006_migrate_240129_01.sql
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
alter table t_rank_battle add column `mode` int(11) NOT NULL DEFAULT '0' COMMENT '1:4v4 2:pvp ';
|
||||||
|
alter table t_rank_battle add column `class` int(11) NOT NULL DEFAULT '0' COMMENT '1:总榜 2:日榜 3:周榜';
|
||||||
|
alter table t_rank_battle add column `writetime` int(11) NOT NULL DEFAULT '0' COMMENT '记录时间';
|
||||||
|
alter table t_rank_battle add UNIQUE KEY `account_mode_class_type_writetime` (`account_id`,`mode`,`class`,`type`,`writetime`);
|
||||||
|
alter table t_rank_battle drop index account_id_type;
|
||||||
|
|
||||||
|
|
||||||
|
alter table t_user_use_emoji add column `used` mediumblob COMMENT '使用的表情';
|
||||||
|
alter table t_user_use_emoji drop column value;
|
||||||
|
|
||||||
|
insert into version (version) values(2024012901);
|
||||||
|
|
||||||
|
commit;
|
@ -19,9 +19,12 @@ class EmojiController extends BaseAuthedController
|
|||||||
public function getEmojiList(){
|
public function getEmojiList(){
|
||||||
$list = Emoji::emojiList();
|
$list = Emoji::emojiList();
|
||||||
$uses = Emoji::getUseEmoji();
|
$uses = Emoji::getUseEmoji();
|
||||||
|
$temp = array_map(function ($val){
|
||||||
|
return $val['item_id'];
|
||||||
|
},$uses);
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($list as $val){
|
foreach ($list as $val){
|
||||||
if(in_array($val,$uses)){
|
if(in_array($val, $temp)){
|
||||||
array_push($data,
|
array_push($data,
|
||||||
array(
|
array(
|
||||||
'item_id'=>$val,
|
'item_id'=>$val,
|
||||||
@ -45,41 +48,54 @@ class EmojiController extends BaseAuthedController
|
|||||||
|
|
||||||
public function setEmoji(){
|
public function setEmoji(){
|
||||||
$itemId = getReqVal('item_id', '');
|
$itemId = getReqVal('item_id', '');
|
||||||
|
$slotId = getReqVal('slot_id', 0);
|
||||||
if(! in_array($itemId,Emoji::emojiList())){
|
if(! in_array($itemId,Emoji::emojiList())){
|
||||||
$this->_rspErr(1, 'item_id parameter error');
|
$this->_rspErr(1, 'item_id parameter error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if($slotId < 1 || $slotId > 6){
|
||||||
|
$this->_rspErr(1, 'slot_id parameter error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
$uses = Emoji::getUseEmoji();
|
$uses = Emoji::getUseEmoji();
|
||||||
if(in_array($itemId,$uses)){
|
$temp = array_map(function ($val){
|
||||||
|
return $val['item_id'];
|
||||||
|
},$uses);
|
||||||
|
if(in_array($itemId,$temp)){
|
||||||
$this->_rspErr(1, 'The emoji has been used');
|
$this->_rspErr(1, 'The emoji has been used');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(count($uses) >= kMaxEmojiNum){
|
if ($uses){
|
||||||
$this->_rspErr(1, 'To maximize');
|
foreach ($uses as &$val){
|
||||||
return;
|
if ($val['slot_id'] == $slotId){
|
||||||
|
$val['item_id'] = $itemId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
array_push($uses,array(
|
||||||
|
'item_id' => $itemId,
|
||||||
|
"slot_id" => $slotId
|
||||||
|
));
|
||||||
}
|
}
|
||||||
array_push($uses,$itemId);
|
|
||||||
Emoji::updateEmoji( implode('|',$uses) );
|
Emoji::updateEmoji( json_encode($uses));
|
||||||
$this->_rspOk();
|
$this->_rspOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cancel(){
|
public function cancel(){
|
||||||
$itemId = getReqVal('item_id', '');
|
$slotId = getReqVal('slot_id', 0);
|
||||||
if(! in_array($itemId,Emoji::emojiList())){
|
if($slotId < 1 || $slotId > 6){
|
||||||
$this->_rspErr(1, 'item_id parameter error');
|
$this->_rspErr(1, 'slot_id parameter error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$uses = Emoji::getUseEmoji();
|
$uses = Emoji::getUseEmoji();
|
||||||
if(! in_array($itemId,$uses)){
|
|
||||||
$this->_rspErr(1, 'The emoji is not used');
|
foreach ($uses as &$val){
|
||||||
return;
|
if ($val['slot_id'] == $slotId){
|
||||||
}
|
$val['item_id'] = 0;
|
||||||
foreach ($uses as $k=>$v){
|
|
||||||
if ($itemId == $v){
|
|
||||||
unset($uses[$k]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Emoji::updateEmoji(implode('|',$uses));
|
Emoji::updateEmoji(json_encode($uses));
|
||||||
$this->_rspOk();
|
$this->_rspOk();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -56,13 +56,23 @@ class RankingController extends BaseAuthedController {
|
|||||||
public function rankingList()
|
public function rankingList()
|
||||||
{
|
{
|
||||||
$userInfo = $this->_getOrmUserInfo();
|
$userInfo = $this->_getOrmUserInfo();
|
||||||
|
$mode = getReqVal('mode', 0);
|
||||||
|
$class = getReqVal('class', 0);
|
||||||
$type = getReqVal('type', 0);
|
$type = getReqVal('type', 0);
|
||||||
|
|
||||||
|
if (! RankBattle::inspectMode($mode)){
|
||||||
|
$this->_rspErr(1, 'mode param error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (! RankBattle::inspectClass($class)){
|
||||||
|
$this->_rspErr(1, 'class param error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (! RankBattle::inspectType($type)){
|
if (! RankBattle::inspectType($type)){
|
||||||
$this->_rspErr(1, 'type param error');
|
$this->_rspErr(1, 'type param error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$list = RankBattle::getTopLimit($type,100);
|
$list = RankBattle::getTopLimit($mode,$class,$type,100);
|
||||||
|
|
||||||
$rankingList = array();
|
$rankingList = array();
|
||||||
$ranked = 1;
|
$ranked = 1;
|
||||||
@ -90,7 +100,7 @@ class RankingController extends BaseAuthedController {
|
|||||||
$myRanked['modifytime'] = $row['modifytime'];
|
$myRanked['modifytime'] = $row['modifytime'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$lists = RankBattle::getTopLimit($type,10000,array('account_id'));
|
$lists = RankBattle::getTopLimit($mode,$class,$type,10000,array('account_id'));
|
||||||
if (count($lists) > 0){
|
if (count($lists) > 0){
|
||||||
foreach ($lists as $k=>$row){
|
foreach ($lists as $k=>$row){
|
||||||
if ($userInfo['account_id'] == $row['account_id']){
|
if ($userInfo['account_id'] == $row['account_id']){
|
||||||
|
@ -8,7 +8,32 @@ use phpcommon\SqlHelper;
|
|||||||
class Emoji extends BaseModel
|
class Emoji extends BaseModel
|
||||||
{
|
{
|
||||||
private static function defaultUseEmoji(){
|
private static function defaultUseEmoji(){
|
||||||
return array(200001, 200002, 200003, 200004, 200005, 200006);
|
return array(
|
||||||
|
array(
|
||||||
|
'item_id' => 200001,
|
||||||
|
"slot_id" => 1
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'item_id' => 200002,
|
||||||
|
"slot_id" => 2
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'item_id' => 200003,
|
||||||
|
"slot_id" => 3
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'item_id' => 200004,
|
||||||
|
"slot_id" => 4
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'item_id' => 200005,
|
||||||
|
"slot_id" => 5
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'item_id' => 200006,
|
||||||
|
"slot_id" => 6
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function defaultEmoji(){
|
private static function defaultEmoji(){
|
||||||
@ -35,14 +60,13 @@ class Emoji extends BaseModel
|
|||||||
'account_id'=> myself()->_getAccountId()
|
'account_id'=> myself()->_getAccountId()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$value = array();
|
|
||||||
if ($row){
|
if ($row){
|
||||||
$value = $row['value'] ? explode('|',$row['value']) : array() ;
|
$useEmojiList = emptyReplace(json_decode($row['used'], true), array());
|
||||||
}else{
|
}else{
|
||||||
$value= self::defaultUseEmoji();
|
$useEmojiList= self::defaultUseEmoji();
|
||||||
self::updateEmoji(implode('|',$value));
|
self::updateEmoji(json_encode($useEmojiList));
|
||||||
}
|
}
|
||||||
return $value;
|
return $useEmojiList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function updateEmoji($fields){
|
public static function updateEmoji($fields){
|
||||||
@ -53,12 +77,12 @@ class Emoji extends BaseModel
|
|||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'value' => $fields,
|
'used' => $fields,
|
||||||
'modifytime' => myself()->_getNowTime(),
|
'modifytime' => myself()->_getNowTime(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'value' => $fields,
|
'used' => $fields,
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime(),
|
'modifytime' => myself()->_getNowTime(),
|
||||||
)
|
)
|
||||||
|
@ -14,6 +14,23 @@ class RankBattle extends BaseModel
|
|||||||
const TOP_THREE_TIMES = 4;
|
const TOP_THREE_TIMES = 4;
|
||||||
const KILL_TIMES = 5;
|
const KILL_TIMES = 5;
|
||||||
|
|
||||||
|
const OVERALL_CHARTS = 1;
|
||||||
|
const DAILY_CHARTS = 2;
|
||||||
|
const WEEKLY_CHARTS = 3;
|
||||||
|
|
||||||
|
const MOBA_DATA = 1;
|
||||||
|
const PVP_DATA = 2;
|
||||||
|
|
||||||
|
public static function inspectMode($mode){
|
||||||
|
if (!in_array($mode,array(
|
||||||
|
self::MOBA_DATA,
|
||||||
|
self::PVP_DATA,
|
||||||
|
))){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static function inspectType($type){
|
public static function inspectType($type){
|
||||||
if (!in_array($type,array(
|
if (!in_array($type,array(
|
||||||
self::GAME_TIMES,
|
self::GAME_TIMES,
|
||||||
@ -27,9 +44,20 @@ class RankBattle extends BaseModel
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function inspectClass($class){
|
||||||
|
if (!in_array($class,array(
|
||||||
|
self::OVERALL_CHARTS,
|
||||||
|
self::DAILY_CHARTS,
|
||||||
|
self::WEEKLY_CHARTS,
|
||||||
|
))){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getTopLimit($type,$limit,$fieldKv=null){
|
|
||||||
if (!self::inspectType($type)){
|
public static function getTopLimit($mode, $class, $type, $limit, $fieldKv=null){
|
||||||
|
if (!self::inspectType($type) || self::inspectClass($class)){
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
if (!$fieldKv){
|
if (!$fieldKv){
|
||||||
@ -37,11 +65,43 @@ class RankBattle extends BaseModel
|
|||||||
}else{
|
}else{
|
||||||
$field = implode(',',$fieldKv);
|
$field = implode(',',$fieldKv);
|
||||||
}
|
}
|
||||||
|
$sql = '';
|
||||||
|
$whereKv = array();
|
||||||
|
switch ($class) {
|
||||||
|
case self::OVERALL_CHARTS : {
|
||||||
|
$sql = "select {$field} from t_rank_battle where mode=:mode and class =:class and type=:type order by value desc,modifytime asc limit {$limit} ";
|
||||||
|
$whereKv = array(
|
||||||
|
"mode" => $mode,
|
||||||
|
"class" => self::OVERALL_CHARTS,
|
||||||
|
"type" => $type,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case self::DAILY_CHARTS : {
|
||||||
|
$sql = "select {$field} from t_rank_battle where mode=:mode and class =:class and type=:type and writetime=:writetime order by value desc,modifytime asc limit {$limit} ";
|
||||||
|
$whereKv = array(
|
||||||
|
"mode" => $mode,
|
||||||
|
"class" => self::DAILY_CHARTS,
|
||||||
|
"type" => $type,
|
||||||
|
"writetime" => myself()->_getNowDaySeconds(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case self::WEEKLY_CHARTS : {
|
||||||
|
$sql = "select {$field} from t_rank_battle where mode=:mode and class =:class and type=:type and writetime=:writetime order by value desc,modifytime asc limit {$limit} ";
|
||||||
|
$whereKv = array(
|
||||||
|
"mode" => $mode,
|
||||||
|
"class" => self::DAILY_CHARTS,
|
||||||
|
"type" => $type,
|
||||||
|
"writetime" => myself()->_getMondaySeconds(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "select {$field} from t_rank_battle where type=:type order by value desc,modifytime asc limit {$limit} ";
|
// $sql = "select {$field} from t_rank_battle where type=:type order by value desc,modifytime asc limit {$limit} ";
|
||||||
$whereKv = array(
|
// $whereKv = array(
|
||||||
"type" => $type,
|
// "type" => $type,
|
||||||
);
|
// );
|
||||||
$rows = myself()->_getSelfMysql()->execQuery($sql,$whereKv);
|
$rows = myself()->_getSelfMysql()->execQuery($sql,$whereKv);
|
||||||
|
|
||||||
if (!$rows){
|
if (!$rows){
|
||||||
@ -65,7 +125,7 @@ class RankBattle extends BaseModel
|
|||||||
return $row ? $row : null;
|
return $row ? $row : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function upsert($account,$type,$val){
|
public static function upsert($account,$mode,$type,$val){
|
||||||
if (!$account){
|
if (!$account){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -74,7 +134,39 @@ class RankBattle extends BaseModel
|
|||||||
't_rank_battle',
|
't_rank_battle',
|
||||||
array(
|
array(
|
||||||
'account_id' => $account,
|
'account_id' => $account,
|
||||||
|
'mode' => $mode,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
|
'class' => self::OVERALL_CHARTS,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'value' => function () use($val) {
|
||||||
|
return "value + ${val}";
|
||||||
|
},
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
'writetime' => myself()->_getNowTime(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'account_id' => $account,
|
||||||
|
'channel' => phpcommon\extractChannel($account),
|
||||||
|
'class' => self::OVERALL_CHARTS,
|
||||||
|
'mode' => $mode,
|
||||||
|
'type' => $type,
|
||||||
|
'value' => $val,
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
'writetime' => myself()->_getNowTime(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
SqlHelper::upsert
|
||||||
|
(myself()->_getSelfMysql(),
|
||||||
|
't_rank_battle',
|
||||||
|
array(
|
||||||
|
'account_id' => $account,
|
||||||
|
'mode' => $mode,
|
||||||
|
'type' => $type,
|
||||||
|
'class' => self::DAILY_CHARTS,
|
||||||
|
'writetime' => myself()->_getNowDaySeconds(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'value' => function () use($val) {
|
'value' => function () use($val) {
|
||||||
@ -85,10 +177,42 @@ class RankBattle extends BaseModel
|
|||||||
array(
|
array(
|
||||||
'account_id' => $account,
|
'account_id' => $account,
|
||||||
'channel' => phpcommon\extractChannel($account),
|
'channel' => phpcommon\extractChannel($account),
|
||||||
|
'class' => self::DAILY_CHARTS,
|
||||||
|
'mode' => $mode,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'value' => $val,
|
'value' => $val,
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime()
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
'writetime' => myself()->_getNowDaySeconds(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
SqlHelper::upsert
|
||||||
|
(myself()->_getSelfMysql(),
|
||||||
|
't_rank_battle',
|
||||||
|
array(
|
||||||
|
'account_id' => $account,
|
||||||
|
'mode' => $mode,
|
||||||
|
'type' => $type,
|
||||||
|
'class' => self::WEEKLY_CHARTS,
|
||||||
|
'writetime' => myself()->_getMondaySeconds(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'value' => function () use($val) {
|
||||||
|
return "value + ${val}";
|
||||||
|
},
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'account_id' => $account,
|
||||||
|
'channel' => phpcommon\extractChannel($account),
|
||||||
|
'class' => self::WEEKLY_CHARTS,
|
||||||
|
'mode' => $mode,
|
||||||
|
'type' => $type,
|
||||||
|
'value' => $val,
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
'writetime' => myself()->_getMondaySeconds(),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,8 @@ class TameBattleDataService extends BaseService {
|
|||||||
|
|
||||||
//记录战斗有效行为
|
//记录战斗有效行为
|
||||||
$this->_updateBattleData();
|
$this->_updateBattleData();
|
||||||
|
//记录战斗数据的排行榜
|
||||||
|
$this->recordBattleRanking();
|
||||||
switch ($matchMode) {
|
switch ($matchMode) {
|
||||||
//PVP模式
|
//PVP模式
|
||||||
case self::ROOM_MODE_PVP:
|
case self::ROOM_MODE_PVP:
|
||||||
@ -127,11 +128,6 @@ class TameBattleDataService extends BaseService {
|
|||||||
default:{}
|
default:{}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//记录战斗数据的排行榜
|
|
||||||
$this->recordBattleRanking();
|
|
||||||
// //结算用户star数量
|
|
||||||
// $this->rewardStarNum();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//PVE模式
|
//PVE模式
|
||||||
@ -159,61 +155,57 @@ class TameBattleDataService extends BaseService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// //每局战斗结算star数量
|
|
||||||
// private function rewardStarNum(){
|
|
||||||
// $paramMeta = mt\Parameter::getByName('star_get_num');
|
|
||||||
// if ($paramMeta){
|
|
||||||
// $star_get_num = getXVal($paramMeta,'param_value', 0);
|
|
||||||
// $num_arr = explode('|',$star_get_num);
|
|
||||||
// $rank = getXVal($this->battleInfo,'pvp_personal_rank', 0);
|
|
||||||
// if ($rank>count($num_arr) || $rank<1){
|
|
||||||
// $finalNum = 0;
|
|
||||||
// }else{
|
|
||||||
// $finalNum = $this->calFinalStarNum($num_arr[$rank-1]);
|
|
||||||
// }
|
|
||||||
// $items = array(
|
|
||||||
// array(
|
|
||||||
// 'item_id'=>V_ITEM_STAR,
|
|
||||||
// 'item_num'=>$finalNum
|
|
||||||
// )
|
|
||||||
// );print_r($items);
|
|
||||||
// $propertyChgService = new services\PropertyChgService();
|
|
||||||
// $awardService = new services\AwardService();
|
|
||||||
//// myself()->_addItems($items, $awardService,$propertyChgService);
|
|
||||||
// myself()->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$finalNum);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//记录战斗数据的排行榜
|
//记录战斗数据的排行榜
|
||||||
private function recordBattleRanking(){
|
private function recordBattleRanking(){
|
||||||
$account = getXVal($this->battleInfo,'account_id', 0);
|
$account = getXVal($this->battleInfo,'account_id', 0);
|
||||||
//游戏场次 (存活30S算有效场次)
|
$room_mode = getXVal($this->allInfo,'room_mode', 0);
|
||||||
if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 > 30 &&
|
switch ($room_mode){
|
||||||
getXVal($this->battleInfo,'abandon_battle', 0) == 0){
|
case self::ROOM_MODE_PVP : {
|
||||||
RankBattle::upsert($account,RankBattle::GAME_TIMES,1);
|
//游戏场次 (存活30S算有效场次)
|
||||||
}
|
if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 > 30 &&
|
||||||
//吃鸡数 //pvp_team_rank
|
getXVal($this->battleInfo,'abandon_battle', 0) == 0){
|
||||||
if (getXVal($this->allInfo,'pvp_team_rank', 0) == 1){
|
RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::GAME_TIMES,1);
|
||||||
RankBattle::upsert($account,RankBattle::WIN_TIMES,1);
|
}
|
||||||
|
//吃鸡数 //pvp_team_rank
|
||||||
|
// print_r(getXVal($this->battleInfo,'pvp_kill', 0));die;
|
||||||
|
if (getXVal($this->allInfo,'pvp_team_rank', 0) == 1){
|
||||||
|
RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::WIN_TIMES,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//mvp
|
||||||
|
if (getXVal($this->battleInfo,'is_mvp', 0) == 1){
|
||||||
|
RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::MVP_TIMES,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//前三
|
||||||
|
if (getXVal($this->allInfo,'pvp_team_rank', 0) <= 3){
|
||||||
|
RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::TOP_THREE_TIMES,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//击杀
|
||||||
|
if (getXVal($this->battleInfo,'pvp_kill', 0) > 0){
|
||||||
|
RankBattle::upsert($account,RankBattle::PVP_DATA,RankBattle::KILL_TIMES,getXVal($this->battleInfo,'pvp_kill', 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case self::ROOM_MODE_MOBA : {
|
||||||
|
//游戏场次 (存活30S算有效场次)
|
||||||
|
if (! getXVal($this->battleInfo,'is_run_away', 0)){
|
||||||
|
RankBattle::upsert($account,RankBattle::MOBA_DATA,RankBattle::GAME_TIMES,1);
|
||||||
|
}
|
||||||
|
//胜利数
|
||||||
|
if (getXVal($this->allInfo,'victory', 0)){
|
||||||
|
RankBattle::upsert($account,RankBattle::MOBA_DATA,RankBattle::WIN_TIMES,1);
|
||||||
|
}
|
||||||
|
//击杀
|
||||||
|
if (getXVal($this->battleInfo,'kills', 0) > 0){
|
||||||
|
RankBattle::upsert($account,RankBattle::MOBA_DATA,RankBattle::KILL_TIMES,getXVal($this->battleInfo,'kills', 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//mvp
|
|
||||||
if (getXVal($this->battleInfo,'is_mvp', 0) == 1){
|
|
||||||
RankBattle::upsert($account,RankBattle::MVP_TIMES,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//前三
|
|
||||||
if (getXVal($this->allInfo,'pvp_team_rank', 0) <= 3){
|
|
||||||
RankBattle::upsert($account,RankBattle::TOP_THREE_TIMES,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//击杀
|
|
||||||
if (getXVal($this->battleInfo,'pvp_kill', 0) > 0){
|
|
||||||
myself()->_incV(TN_TOTAL_KILLS_NUM, 0, getXVal($this->battleInfo,'pvp_kill', 0));
|
|
||||||
RankBattle::upsert($account,RankBattle::KILL_TIMES,getXVal($this->battleInfo,'pvp_kill', 0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updatePveData()
|
private function updatePveData()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user