添加单人战报

This commit is contained in:
hujiabin 2023-06-08 20:13:20 +08:00
parent 3c44230ef9
commit a64d69e4ad
4 changed files with 84 additions and 23 deletions

View File

@ -45,7 +45,7 @@ CREATE TABLE `t_user` (
`bceg` double NOT NULL DEFAULT '0' COMMENT '中心化代币',
`gold` double NOT NULL DEFAULT '0' COMMENT '金币',
`diamond` double NOT NULL DEFAULT '0' COMMENT '钻石',
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '当前上阵英雄id',
`hero_id` bigint NOT NULL DEFAULT '0' COMMENT '当前上阵英雄id',
`first_fight` int(11) NOT NULL DEFAULT '0' COMMENT '是否首战',
`last_season_id` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次赛季id',
`activated` int(11) NOT NULL DEFAULT '0' COMMENT '是否已激活',
@ -1042,10 +1042,10 @@ DROP TABLE IF EXISTS `t_hero_preset`;
CREATE TABLE `t_hero_preset` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`hero_uid` int(11) NOT NULL DEFAULT 0 COMMENT 'hero uniid',
`hero_uid` bigint NOT NULL DEFAULT 0 COMMENT 'hero uniid',
`skill_id` int(11) NOT NULL DEFAULT 0 COMMENT '技能 item_id',
`weapon_uid1` int(11) NOT NULL DEFAULT 0 COMMENT 'gun uniid1',
`weapon_uid2` int(11) NOT NULL DEFAULT 0 COMMENT 'gun uniid2',
`weapon_uid1` bigint NOT NULL DEFAULT 0 COMMENT 'gun uniid1',
`weapon_uid2` bigint NOT NULL DEFAULT 0 COMMENT 'gun uniid2',
`chip_page` int(11) NOT NULL DEFAULT 0 COMMENT '芯片页id',
`createtime` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',

View File

@ -0,0 +1,33 @@
begin;
alter table t_user add column `star_num` int(11) NOT NULL DEFAULT '0' COMMENT '星星数(成长任务)';
ALTER TABLE t_user MODIFY COLUMN hero_id bigint NOT NULL DEFAULT '0' COMMENT '当前上阵英雄唯一id';
ALTER TABLE t_hero_preset MODIFY COLUMN hero_uid bigint NOT NULL DEFAULT '0' COMMENT 'hero uniid';
ALTER TABLE t_hero_preset MODIFY COLUMN weapon_uid1 bigint NOT NULL DEFAULT '0' COMMENT 'gun uniid1';
ALTER TABLE t_hero_preset MODIFY COLUMN weapon_uid2 bigint NOT NULL DEFAULT '0' COMMENT 'gun uniid2';
CREATE TABLE `t_mission_star` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`season_id` int(11) NOT NULL DEFAULT '0' COMMENT '成长任务赛季id',
`mission_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`),
UNIQUE KEY `account_season_mission_id` (`account_id`, `season_id`, `mission_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `t_user_sign_log` (
`idx` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`days` int(10) DEFAULT '0' COMMENT '累计签到天数',
`sign_time` int(10) DEFAULT NULL COMMENT '签到时间',
`is_receive` tinyint(4) DEFAULT '0' COMMENT '是否领取奖励',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
insert into version (version) values(2023060801);
commit;

View File

@ -113,6 +113,17 @@ class BattleController extends BaseAuthedController {
$this->_rspData($data);
}
public function personalReport(){
$userInfo = $this->_getOrmUserInfo();
if (!$userInfo) {
$this->_rspErr(1, 'Without this player1');
return;
}
// $ranked = getReqVal('pvp_personal_rank', 0);
$teamBattleDataService = new services\TameBattleDataService();
$teamBattleDataService->calStarNum();
}
public function teamReport()
{
$userInfo = $this->_getOrmUserInfo();

View File

@ -597,7 +597,7 @@ class TameBattleDataService extends BaseService {
{
//pvp奖励 gold
if ($userDb){
$this->calStarNum($temp['reward'],getXVal($info,'pvp_personal_rank', 0));
// $this->calStarNum($temp['reward'],getXVal($info,'pvp_personal_rank', 0));
$heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0));
if (!$heroDb){
break;
@ -628,23 +628,6 @@ class TameBattleDataService extends BaseService {
);
}
private function calStarNum(&$reward,$pvp_rank){
$paramMeta = mt\Parameter::getByName('star_get_num');
if ($paramMeta){
$star_get_num = getXVal($paramMeta,'param_value', 0);
$num_arr = explode('|',$star_get_num);
if ($pvp_rank>count($num_arr) || $pvp_rank<1){
$finalNum = 0;
}else{
$finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]);
}
array_push($reward['items'],array(
'item_id'=> V_ITEM_STAR,
'item_num'=>$finalNum,
));
}
}
private function rewardGoldPvp(&$reward,$heroDto,$userRank)
{
$heroPvpGold = FormulaService::calcHeroPvpGold($heroDto, $this->allInfo,$userRank);
@ -661,6 +644,34 @@ class TameBattleDataService extends BaseService {
}
}
public function calStarNum(){
$pvp_rank = getReqVal('pvp_personal_rank', 0);
$paramMeta = mt\Parameter::getByName('star_get_num');
if ($paramMeta){
$star_get_num = getXVal($paramMeta,'param_value', 0);
$num_arr = explode('|',$star_get_num);
if ($pvp_rank>count($num_arr) || $pvp_rank<1){
$finalNum = 0;
}else{
$finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]);
}
// array_push($reward['items'],array(
// 'item_id'=> V_ITEM_STAR,
// 'item_num'=>$finalNum,
// ));
$items = array(
array(
'item_id' => V_ITEM_STAR,
'item_num' => $finalNum
),
);
$propertyChgService = new services\PropertyChgService();
$awardService = new services\AwardService();
myself()->_addItems($items, $awardService,$propertyChgService);
}
}
private function calFinalStarNum($num){
$finalNum = 0;
if ($num <= 0) {
@ -689,7 +700,13 @@ class TameBattleDataService extends BaseService {
foreach ($data['members'] as $member){
if ($member['account_id'] == myself()->_getAccountId()){
if ($member['reward']['items']){
myself()->_addItems($member['reward']['items'], $awardService,$propertyChgService);
$items = array();
foreach ($member['reward']['items'] as $value){
if ($value['item_id'] != V_ITEM_STAR){
array_push($items,$value);
}
}
myself()->_addItems($items, $awardService,$propertyChgService);
}
if ($member['reward']['hero']['hero_uniid']){
Hero::update($member['reward']['hero']['hero_uniid'],