-- zhaoyu
-- 交易市场功能

CREATE TABLE IF NOT EXISTS `market_goods` (
  `id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '交易Id',
  `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '出售玩家Id',
  `goods_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品唯一Id',
  `goods_type_id` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品类型Id',
  `num` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品数量',
  `lev` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品等级',
  `color` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品品质',
  `price` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '现竞价',
  `sell_type` int(11) UNSIGNED NOT NULL DEFAULT '1' COMMENT '上架类型：1:世界上架2:帮派上架',
  `guild_id` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '公会Id',
  `time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '上架时间戳',
  `off_time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '下架时间戳',
  `is_to_world` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '公会上架流拍是否上架世界：0:否1:是',
  `is_offer` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否已有人出价：0:否1:是',
  `extra_attr` varchar(255) NOT NULL DEFAULT '[]' COMMENT '物品额外特殊属性',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='交易市场出售的商品信息';


CREATE TABLE IF NOT EXISTS `market_bid_info` (
  `id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '交易Id',
  `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '出价玩家Id',
  `price` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '竞价',
  `time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '最后一次出价时间戳',
  PRIMARY KEY (`id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='交易市场-玩家竞拍出价';

CREATE TABLE IF NOT EXISTS `market_like_info` (
  `id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '交易Id',
  `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '玩家角色Id',
  `time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '关注时间戳',
  PRIMARY KEY (`id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='交易市场-玩家竞拍关注';

CREATE TABLE IF NOT EXISTS `market_deal_log` (
  `id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '交易Id',
  `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '出售玩家Id',
  `get_role_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '获得玩家Id',
  `goods_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品唯一Id',
  `goods_type_id` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品类型Id',
  `num` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品数量',
  `lev` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品等级',
  `color` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品品质',
  `price` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '成交价格',
  `sell_type` int(11) UNSIGNED NOT NULL DEFAULT '1' COMMENT '上架类型：1:世界上架2:帮派上架',
  `guild_id` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '公会Id',
  `time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '上架时间戳',
  `deal_time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '成交时间戳',
  `deal_type` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '成交类型:0:竞价1:一口价',
  `log_type` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '成交记录大类',
  `extra_attr` varchar(255) NOT NULL DEFAULT '[]' COMMENT '物品额外特殊属性',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='交易市场成交记录';



CREATE TABLE IF NOT EXISTS `log_market_operation` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  `market_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '交易Id',
  `role_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '出售玩家Id',
  `get_role_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '获得玩家Id',
  `goods_type_id` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品类型Id',
  `num` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品数量',
  `lev` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品等级',
  `color` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '物品品质',
  `price` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '成交价格',
  `sell_type` int(11) UNSIGNED NOT NULL DEFAULT '1' COMMENT '上架类型：1:世界上架2:帮派上架',
  `guild_id` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '公会Id',
  `time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '上架时间戳',
  `log_time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '日志时间戳',
  `deal_type` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '成交类型:0:竞价1:一口价',
  `operation_type` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '操作类型:1:上架2:下架3:成交',
  `extra_attr` varchar(255) NOT NULL DEFAULT '[]' COMMENT '物品额外特殊属性',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='交易市场日志';
