From b4eda8b18b84b895378239ca3c985390afa7f950 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 24 Dec 2021 11:17:30 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 1 + webapp/models/Battle.php | 2 +- webapp/models/Hero.php | 2 +- webapp/services/BattleDataService.php | 12 ++++++++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 088570a2..0a7758d1 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -238,6 +238,7 @@ CREATE TABLE `t_battle` ( `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', `battle_data` mediumblob COMMENT 'battle_data', + `kills_modifytime` 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`), diff --git a/webapp/models/Battle.php b/webapp/models/Battle.php index b015b1cf..7d9cfa20 100644 --- a/webapp/models/Battle.php +++ b/webapp/models/Battle.php @@ -43,7 +43,7 @@ class Battle extends BaseModel { public static function update($fieldsKv) { - SqlHelper::upsert + SqlHelper::update (myself()->_getSelfMysql(), 't_battle', array( diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 25f4d6e3..78886d83 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -105,7 +105,7 @@ class Hero extends BaseModel { public static function update($heroId, $fieldsKv) { - SqlHelper::upsert + SqlHelper::update (myself()->_getSelfMysql(), 't_hero', array( diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index b3d7803e..8d73a9b4 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -6,17 +6,19 @@ require_once('mt/Item.php'); require_once('mt/Equip.php'); require_once('mt/Season.php'); require_once('mt/Rank.php'); -require_once('mt/Param.php'); +require_once('mt/Parameter.php'); require_once('models/Season.php'); require_once('models/Battle.php'); require_once('models/Bag.php'); +require_once('models/Hero.php'); use mt; use phpcommon\SqlHelper; use models\Season; use models\Battle; use models\Bag; +use models\Hero; class BattleDataService extends BaseService { @@ -24,13 +26,17 @@ class BattleDataService extends BaseService { public function updateBattleData() { + error_log(json_encode($_REQUEST)); + error_log('updateBattleData1'); if (!$this->decCost()) { return; } + error_log('updateBattleData2'); $this->currSeasonMeta = mt\Season::getCurrentSeason(); if (!$this->currSeasonMeta) { return; } + error_log('updateBattleData3'); $this->seasonDb = Season::find($this->currSeasonMeta['id']); if (!$this->seasonDb) { Season::add($this->currSeasonMeta['id']); @@ -39,6 +45,7 @@ class BattleDataService extends BaseService { if (!$this->seasonDb) { return; } + error_log('updateBattleData4'); $this->updateScore(); $hisBattleData = Battle::getMyBattleData(); if (!isset($hisBattleData)) { @@ -299,7 +306,7 @@ class BattleDataService extends BaseService { return false; } $costTili = mt\Parameter::getVal('cost_fatigue', 0); - if ($heroDB['tili'] < $costTili) { + if ($heroDb['hero_tili'] < $costTili) { return false; } Hero::update($heroDb['hero_id'], array( @@ -313,6 +320,7 @@ class BattleDataService extends BaseService { private function addItems() { $tmpStrs1 = explode('|', getReqVal('items', '')); + error_log('addItems ' . getReqVal('items', '')); foreach ($tmpStrs1 as $tmpStr) { $tmpStrs2 = explode(':', $tmpStr); if (count($tmpStrs2) >= 2) {