65 lines
1.5 KiB
PHP
65 lines
1.5 KiB
PHP
<?php
|
|
|
|
|
|
namespace models;
|
|
require_once('services/NftService.php');
|
|
|
|
use mt;
|
|
use phpcommon\SqlHelper;
|
|
use phpcommon;
|
|
use services\FormulaService;
|
|
use services\NftService;
|
|
|
|
class UserSeasonRing extends BaseModel
|
|
{
|
|
public static function ringList($targetId)
|
|
{
|
|
$ringList = array();
|
|
self::getRingList($targetId,function ($row) use(&$ringList) {
|
|
array_push($ringList, $row['item_id']);
|
|
});
|
|
return $ringList;
|
|
}
|
|
|
|
public static function getRingList($targetId,$cb)
|
|
{
|
|
SqlHelper::ormSelect(
|
|
myself()->_getSelfMysql(),
|
|
't_user_season_ring',
|
|
array(
|
|
'account_id' => $targetId
|
|
),
|
|
function ($row) use($cb) {
|
|
$cb($row);
|
|
}
|
|
);
|
|
}
|
|
|
|
public static function addRing($itemMeta)
|
|
{
|
|
return self::internalAddHero(
|
|
myself()->_getSelfMysql(),
|
|
$itemMeta,
|
|
myself()->_getAccountId()
|
|
);
|
|
}
|
|
|
|
public static function internalAddHero($conn, $itemMeta, $accountId)
|
|
{
|
|
SqlHelper::upsert(
|
|
$conn,
|
|
't_user_season_ring',
|
|
array(
|
|
'account_id' => $accountId,
|
|
'item_id' => $itemMeta['id'],
|
|
),
|
|
array(),
|
|
array(
|
|
'account_id' => $accountId,
|
|
'item_id' => $itemMeta['id'],
|
|
'createtime' => myself()->_getNowTime(),
|
|
'modifytime' => myself()->_getNowTime()
|
|
)
|
|
);
|
|
}
|
|
} |