game2006api/webapp/models/GunTalent.php
aozhiwei 0548f58b7c 1
2021-12-01 16:07:38 +08:00

55 lines
1.3 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class GunTalent extends BaseModel {
public static function find($talentId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_gun_talent',
array(
'account_id' => myself()->_getAccountId(),
'talent_id' => $talentId
)
);
return $row;
}
public static function toDto($row)
{
return array(
'talent_id' => $row['talent_id'],
'talent_lv' => $row['talent_lv'],
);
}
public static function upgradeLv($talentId, $talentLv)
{
SqlHelper::upsert(
myself()->_getSelfMysql(),
't_gun_talent',
array(
'account_id' => myself()->_getAccountId(),
'talent_id' => $talentId
),
array(
'talent_lv' => $talentLv,
'modifytime' => myself()->_getNowTime()
),
array(
'account_id' => myself()->_getAccountId(),
'talent_id' => $talentId,
'talent_lv' => $talentLv,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}
}