game2006api/webapp/models/MidData.php
aozhiwei 112e52ec9d 1
2024-08-01 12:48:25 +08:00

48 lines
1.1 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class MidData extends BaseModel {
public static function getData($type)
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_middata',
array(
'account_id' => myself()->_getAccountId(),
'type' => $type,
)
);
return $row ? json_decode($row['data'], true) : null;
}
public static function setData($type, $data)
{
SqlHelper::upsert
(myself()->_getSelfMysql(),
't_middata',
array(
'account_id' => myself()->_getAccountId(),
'type' => $type
),
array(
'data' => $data,
'modifytime' => myself()->_getNowTime()
),
array(
'account_id' => myself()->_getAccountId(),
'type' => $type,
'data' => $data,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}
}