This commit is contained in:
aozhiwei 2021-12-24 11:17:30 +08:00
parent f37d62cfe9
commit b4eda8b18b
4 changed files with 13 additions and 4 deletions

View File

@ -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`),

View File

@ -43,7 +43,7 @@ class Battle extends BaseModel {
public static function update($fieldsKv)
{
SqlHelper::upsert
SqlHelper::update
(myself()->_getSelfMysql(),
't_battle',
array(

View File

@ -105,7 +105,7 @@ class Hero extends BaseModel {
public static function update($heroId, $fieldsKv)
{
SqlHelper::upsert
SqlHelper::update
(myself()->_getSelfMysql(),
't_hero',
array(

View File

@ -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) {