game2006api/webapp/models/LuckySymbol.php
aozhiwei ebc1cb94f2 1
2024-10-16 14:17:40 +08:00

60 lines
1.5 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class LuckySymbol extends BaseModel {
public static function hasLuckySymbol()
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_lucky_symbol',
array(
'account_id' => myself()->_getAccountId(),
)
);
$has = empty($row) ? false : $row['in_use_num'] > 0;
return $has ? 1 : 0;
}
public static function dec()
{
SqlHelper::update
(myself()->_getSelfMysql(),
't_lucky_symbol',
array(
'account_id' => myself()->_getAccountId(),
),
array(
'in_use_num' => 0,
'modifytime' => myself()->_getNowTime(),
)
);
}
public static function add()
{
SqlHelper::upsert
(myself()->_getSelfMysql(),
't_lucky_symbol',
array(
'account_id' => myself()->_getAccountId(),
),
array(
'in_use_num' => function () { return "in_use_num + 1";},
'modifytime' => myself()->_getNowTime(),
),
array(
'account_id' => myself()->_getAccountId(),
'in_use_num' => 1,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
}