1
This commit is contained in:
parent
75cd1341bf
commit
8134287775
@ -125,6 +125,7 @@ CREATE TABLE `t_nft` (
|
|||||||
`token_state` int(11) NOT NULL DEFAULT '0' COMMENT '0:正常状态 1:出售中 2:出租中',
|
`token_state` int(11) NOT NULL DEFAULT '0' COMMENT '0:正常状态 1:出售中 2:出租中',
|
||||||
`game_id` int(11) NOT NULL DEFAULT '0' COMMENT 'game id',
|
`game_id` int(11) NOT NULL DEFAULT '0' COMMENT 'game id',
|
||||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||||
|
`rand_attr` mediumblob COMMENT '随机属性',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
namespace models;
|
namespace models;
|
||||||
|
|
||||||
|
require_once('mt/Attr.php');
|
||||||
require_once('mt/Item.php');
|
require_once('mt/Item.php');
|
||||||
|
require_once('mt/GunLevel.php');
|
||||||
|
require_once('mt/GunQuality.php');
|
||||||
|
|
||||||
use mt;
|
use mt;
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
@ -128,6 +131,34 @@ class Nft extends BaseModel {
|
|||||||
{
|
{
|
||||||
$nft['info']['level'] = 1;
|
$nft['info']['level'] = 1;
|
||||||
$nft['info']['quality'] = 1;
|
$nft['info']['quality'] = 1;
|
||||||
|
$randAttr = array();
|
||||||
|
if (is_null($nft['rand_attr'])) {
|
||||||
|
$initQualityMeta = mt\GunQuality::getByQuality(1);
|
||||||
|
if ($initQualityMeta) {
|
||||||
|
$randAttr = mt\GunQuality::getRandAttr($initQualityMeta);
|
||||||
|
}
|
||||||
|
SqlHelper::update(
|
||||||
|
myself()->_getMarketMysql(),
|
||||||
|
't_nft',
|
||||||
|
array(
|
||||||
|
'token_id' => $nft['token_id']
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'rand_attr' => json_encode($randAttr)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
foreach($randAttr as &$attr) {
|
||||||
|
$attrMeta = mt\Attr::get($attr['attr_id']);
|
||||||
|
if ($attrMeta) {
|
||||||
|
$attr['name'] = $attrMeta['attr_ename'];
|
||||||
|
} else {
|
||||||
|
$attr['name'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$nft['info']['attr'] = $randAttr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Nft::CHIP_TYPE:
|
case Nft::CHIP_TYPE:
|
||||||
|
24
webapp/mt/Attr.php
Normal file
24
webapp/mt/Attr.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace mt;
|
||||||
|
|
||||||
|
use phpcommon;
|
||||||
|
|
||||||
|
class Attr {
|
||||||
|
|
||||||
|
public static function get($id)
|
||||||
|
{
|
||||||
|
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function getMetaList()
|
||||||
|
{
|
||||||
|
if (!self::$metaList) {
|
||||||
|
self::$metaList = getMetaTable('attr@attr.php');
|
||||||
|
}
|
||||||
|
return self::$metaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static $metaList;
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user