game2005api/webapp/models/GunTalent.php
aozhiwei 42d1f3dff1 1
2021-11-29 16:30:35 +08:00

59 lines
1.5 KiB
PHP

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