-- ****************************************************************** -- 表 kku_mex_transactions 的创建SQL -- 对应的Model: App\Module\Mex\Models\MexTransaction -- 警告: 此文件由系统自动生成,禁止修改! -- ****************************************************************** CREATE TABLE `kku_mex_transactions` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '成交记录ID,主键', `buy_order_id` bigint(20) DEFAULT NULL COMMENT '买单ID,关联mex_orders表', `sell_order_id` bigint(20) DEFAULT NULL COMMENT '卖单ID,关联mex_orders表', `buyer_id` bigint(20) NOT NULL COMMENT '买方用户ID', `seller_id` bigint(20) NOT NULL COMMENT '卖方用户ID', `item_id` int(11) NOT NULL COMMENT '商品ID,关联物品表', `currency_type` int(11) NOT NULL DEFAULT '2' COMMENT '币种类型,关联FUND_CURRENCY_TYPE枚举,默认2为钻石', `quantity` int(11) NOT NULL COMMENT '成交数量', `price` decimal(25,9) NOT NULL COMMENT '成交价格', `total_amount` decimal(25,9) NOT NULL COMMENT '成交总金额', `transaction_type` enum('USER_SELL','USER_BUY','ADMIN_INJECT','ADMIN_RECYCLE') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '交易类型:USER_SELL用户卖出,USER_BUY用户买入,ADMIN_INJECT管理员注入,ADMIN_RECYCLE管理员回收', `is_admin_operation` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否管理员操作:0否,1是', `admin_user_id` bigint(20) DEFAULT NULL COMMENT '管理员用户ID(管理员操作时使用)', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '成交时间', PRIMARY KEY (`id`) USING BTREE, KEY `idx_buy_order_id` (`buy_order_id`) USING BTREE, KEY `idx_sell_order_id` (`sell_order_id`) USING BTREE, KEY `idx_buyer_id` (`buyer_id`) USING BTREE, KEY `idx_seller_id` (`seller_id`) USING BTREE, KEY `idx_item_id` (`item_id`) USING BTREE, KEY `idx_transaction_type` (`transaction_type`) USING BTREE, KEY `idx_created_at` (`created_at`) USING BTREE, KEY `idx_is_admin_operation` (`is_admin_operation`) USING BTREE, KEY `idx_currency_type` (`currency_type`) USING BTREE COMMENT '币种类型索引' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='农贸市场成交记录表';