game2006api/webapp/models/FirstTopup.php
aozhiwei 1c93734ae0 1
2023-08-14 16:23:03 +08:00

65 lines
1.5 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class FirstTopup extends BaseModel {
public static function get()
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_first_topup',
array(
'account_id' => myself()->_getAccountId(),
)
);
return $row;
}
public static function add($accountId)
{
SqlHelper::upsert(
myself()->_getMysql($accountId),
't_first_topup',
array(
'account_id' => $accountId,
),
array(
),
array(
'account_id' => $accountId,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
public static function update($fieldsKv)
{
SqlHelper::update(
myself()->_getSelfMysql(),
't_first_topup',
array(
'account_id' => myself()->_getAccountId()
),
$fieldsKv
);
}
public static function adjustStatus(&$dbInfo)
{
$nowDaySeconds = myself()->_getNowDaySeconds();
$createDaySeconds = myself()->_getDaySeconds($dbInfo['createtime']);
for ($i = 1; $i <= 3; ++$i) {
if ($dbInfo['status' . $i] == 0) {
$dbInfo['status' . $i] = ($nowDaySeconds >= $createDaySeconds + 3600 * 24 * ($i - 1)) ? 1 : 0;
}
}
}
}