game2006api/webapp/models/NftUpReceive.php
2022-11-09 19:35:05 +08:00

81 lines
2.0 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class NftUpReceive extends BaseModel
{
public static function find($accountId,$transId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getMysql($accountId),
't_nft_up_receive',
array(
'trans_id' => $transId,
)
);
return $row;
}
public static function add($accountId,$fieldKv){
return SqlHelper::insert(
myself()->_getMysql($accountId),
't_nft_up_receive',
$fieldKv
);
}
public static function all($accountId,$tokenType)
{
$row = SqlHelper::ormSelect(
myself()->_getMysql($accountId),
't_nft_up_receive',
array(
'account_id' => $accountId,
'token_type' => $tokenType,
)
);
return $row;
}
public static function upsert($accountId,$data){
SqlHelper::upsert(
myself()->_getMysql($accountId),
't_nft_up_receive',
array(
'trans_id' => $data['trans_id']
),
array(
'state' => 1,
'modifytime' => myself()->_getNowTime()
),
array(
'account_id' => $accountId,
'trans_id' => $data['trans_id'],
'token_id1' => $data['token_id1'],
'token_id2' => $data['token_id2'],
'state' => 1,
'token_type' => $data['token_type'],
'from_data' => 1,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}
public static function setAccountIdNull($accountId,$transId){
SqlHelper::update(
myself()->_getMysql($accountId),
't_nft_up_receive',
array(
'trans_id' => $transId,
),
array(
'account_id' => '',
)
);
}
}