aozhiwei 831779bbd5 1
2021-12-15 10:48:14 +08:00

44 lines
1.1 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class Battle extends BaseModel {
public static function getMyBattleData()
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_battle',
array(
'account_id' => myself()->_getAccountId(),
)
);
return $row ? json_decode($row['battle_data'], true) : array();
}
public static function add($battleData)
{
SqlHelper::upsert
(myself()->_getSelfMysql(),
't_battle',
array(
'account_id' => myself()->_getAccountId(),
),
array(
'battle_data' => $battleData,
'modifytime' => myself()->_getNowTime(),
),
array(
'account_id' => myself()->_getAccountId(),
'battle_data' => $battleData,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}
}