game2006api/webapp/models/LuckySymbol.php
aozhiwei a7f9f5cedf 1
2024-10-15 16:43:06 +08:00

61 lines
1.5 KiB
PHP

<?php
namespace models;
require_once('mt/Item.php');
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(),
)
);
return empty($row) ? false : $row['in_use_item'] > 0;
}
public static function decLuckySymbol()
{
SqlHelper::update
(myself()->_getSelfMysql(),
't_lucky_symbol',
array(
'account_id' => myself()->_getAccountId(),
),
array(
'in_use_num' => 0,
'modifytime' => myself()->_getNowTime(),
)
);
}
public static function addLuckySymbol()
{
SqlHelper::upsert
(myself()->_getSelfMysql(),
't_lucky_symbol',
array(
'account_id' => myself()->_getAccountId(),
),
array(
'in_use_num' => function () { return "item_num + 1";},
'modifytime' => myself()->_getNowTime(),
),
array(
'account_id' => myself()->_getAccountId(),
'in_use_num' => function () { return "1";},
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
}