game2006api/webapp/models/Circuit.php
hujiabin 3ddb202c62 1
2024-09-18 16:41:00 +08:00

44 lines
1.2 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class Circuit extends BaseModel
{
public static function updateScore($season,$score){
SqlHelper::upsert(
myself()->_getSelfMysql(),
't_circuit_battle',
array(
'account_id' => myself()->_getAccountId(),
'season' => $season
),
array(
'cumulative_score' => $score,
'modifytime' => myself()->_getNowTime()
),
array(
'account_id' => myself()->_getAccountId(),
'season' => $season,
'cumulative_score' => $score,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}
public static function getMyScore($season){
$row = SqlHelper::ormSelectOne(
myself()->_getMysql(''),
't_circuit_battle',
array(
'account_id' => myself()->_getAccountId(),
'season' => $season
)
);
return $row ? $row['cumulative_score'] : 0;
}
}