game2006api/webapp/models/Withdrawal.php
aozhiwei e793f51aa2 1
2022-03-28 13:47:57 +08:00

56 lines
1.4 KiB
PHP

<?php
namespace models;
require_once('phpcommon/bchelper.php');
use mt;
use phpcommon;
use phpcommon\SqlHelper;
class Withdrawal extends BaseModel {
public static function getTodayWithdrawalTimes($account)
{
$row = myself()->_getMarketMysql()->execQueryOne(
'SELECT COUNT(1) AS times FROM t_withdrawal WHERE account=:account AND createtime>=:now_dayseconds AND createtime:<=:now_dayseconds + 3600 * 24;',
array(
':account' => $account,
':now_dayseconds' => myself()->_getNowDaySeconds()
)
);
return $row ? $row['times'] : 0;
}
public static function add($account, $type, $netId, $amount)
{
SqlHelper::insert
(myself()->_getMarketMysql(),
't_withdrawal',
array(
'account' => $account,
'type' => $type,
'net_id' => $netId,
'amount' => $amount,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
$seqId = SqlHelper::getLastInsertId(myself()->_getMarketMysql());
return $seqId;
}
public static function get($seqId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_withdrawal',
array(
'idx' => $seqId,
)
);
return $row;
}
}