Merge branch 'star' of git.kingsome.cn:server/game2006api into star
This commit is contained in:
commit
b7a620ad55
@ -71,4 +71,65 @@ CREATE TABLE `t_log` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_buy_record`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_buy_record`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_buy_record` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`blobdata` mediumblob COMMENT 'blobdata',
|
||||
`buyer_address` mediumblob COMMENT 'buyer_address',
|
||||
`order_id` varchar(60) COMMENT '订单id',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
KEY `order_id` (`order_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
DROP TABLE IF EXISTS `t_market_store`;
|
||||
CREATE TABLE `t_market_store` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`o_link` varchar(64) DEFAULT NULL COMMENT '关联的链上上架单号',
|
||||
`status` int(11) NOT NULL COMMENT '订单状态 0:出售中 1:已下架 2:已售出',
|
||||
`owner_address` varchar(60) NOT NULL COMMENT '当前拥有者',
|
||||
`token_id` varchar(80) DEFAULT NULL COMMENT 'token_id',
|
||||
`nft_token` varchar(64) DEFAULT NULL COMMENT 'nftToken',
|
||||
`token_type` int(11) NOT NULL COMMENT 'nft类型 1:英雄 2:枪支 3:芯片',
|
||||
`item_id` int(11) DEFAULT NULL COMMENT '特殊字段,用于标记中心化道具,用于交易金币',
|
||||
`amount` int(11) NOT NULL DEFAULT '1' COMMENT '堆叠数量',
|
||||
`createtime` int(11) NOT NULL COMMENT '创建时间(上架时间)',
|
||||
`modifytime` int(11) NOT NULL COMMENT '修改时间(更新价格等)',
|
||||
`s_currency` varchar(255) NOT NULL COMMENT '出售时选择的币种地址',
|
||||
`s_price` varchar(64) NOT NULL COMMENT '出售价格',
|
||||
`c_name` varchar(32) NOT NULL COMMENT '缓存-名称',
|
||||
`c_job` int(11) NOT NULL COMMENT '缓存-职业',
|
||||
`c_type` int(11) NOT NULL COMMENT '缓存-碎片类型',
|
||||
`c_lv` int(11) NOT NULL COMMENT '缓存-级别',
|
||||
`c_quality` int(11) NOT NULL COMMENT '缓存-品阶',
|
||||
`c_durability` float NOT NULL COMMENT '缓存-能量',
|
||||
`c_id` int(11) NOT NULL COMMENT '缓存-id',
|
||||
PRIMARY KEY (`idx`) USING BTREE,
|
||||
UNIQUE KEY `idx` (`idx`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `t_market_transaction_record`;
|
||||
CREATE TABLE `t_market_transaction_record` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`createtime` int(11) NOT NULL COMMENT '交易成功时间',
|
||||
`orderid` bigint(20) NOT NULL COMMENT 'market 订单id',
|
||||
`o_link` varchar(64) NOT NULL COMMENT '合约订单id',
|
||||
`seller` varchar(64) NOT NULL COMMENT '卖家',
|
||||
`buyer` varchar(64) NOT NULL COMMENT '买家',
|
||||
`tokenid` int(64) NOT NULL COMMENT 'tokenid',
|
||||
`item_id` int(11) DEFAULT NULL COMMENT '如果有,说明是中心化道具交易',
|
||||
`amount` int(11) NOT NULL COMMENT '堆叠数量',
|
||||
`name` varchar(64) NOT NULL COMMENT '商品名称',
|
||||
`type` int(11) NOT NULL COMMENT '商品类型',
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
@ -1287,4 +1287,4 @@ CREATE TABLE `t_web2_order` (
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `order_id` (`order_id`) USING HASH,
|
||||
KEY `out_order_id` (`out_order_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8;
|
@ -32,7 +32,7 @@ CREATE TABLE `t_web2_order` (
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `order_id` (`order_id`) USING HASH,
|
||||
KEY `out_order_id` (`out_order_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8;
|
||||
|
||||
insert into version (version) values(2023071001);
|
||||
|
||||
|
@ -335,35 +335,29 @@ class ShopController extends BaseAuthedController
|
||||
|
||||
SqlHelper::update($conn, 't_shop_buy_order', array('idx' => $order_id), array('status' => $buyStatus));
|
||||
|
||||
$row = mt\ShopGoods::get($id);
|
||||
if ($row) {
|
||||
$desired_token_type = $row['token_type'];
|
||||
$check_token_type = splitStr1($desired_token_type);
|
||||
// $token_pos = array_search($token_type, $check_token_type, true);
|
||||
// if (!in_array($token_type, $check_token_type)) {
|
||||
// $this->_rspErr(1, "token_type parameter error, desired_token_type: {$desired_token_type}");
|
||||
// return;
|
||||
// }
|
||||
$goods = mt\ShopGoods::get($id);
|
||||
// 这里命名混乱了, 购买个数,一捆个数命名冲突
|
||||
$goods_num = $order['goods_num'];
|
||||
$bundle_size = $goods['bonus_num'];
|
||||
$item_num = $goods_num * $bundle_size;
|
||||
$item_id = $goods['bonus'];
|
||||
$address = $order['address'];
|
||||
$account_id = $this->getAccountId($address);
|
||||
|
||||
if ($goods_num > $row['max_amount']) {
|
||||
$this->_rspErr(1, "goods_num parameter error, max_amount: {$row['max_amount']}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 这里命名混乱了, 购买个数,一捆个数命名冲突
|
||||
$goods_count = $row['goods_num'];
|
||||
|
||||
$itemMeta = mt\Item::get($row['goods_id']);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
for ($i = 0; $i < $goods_num; $i++) {
|
||||
// 既然这种货币是在链上的,那么这里不应该增加任何物品,
|
||||
// $this->internalAddItem($propertyChgService, $itemMeta, $goods_count, 0);
|
||||
}
|
||||
$awardService = new services\AwardService();
|
||||
// $awardService->addItem($row['goods_id'], $goods_num);
|
||||
ShopBuyRecord::add($id, $goods_num);
|
||||
if ($item_id == V_ITEM_DIAMOND) {
|
||||
$event = [
|
||||
'name' => LogService::RECHARGE_CEBG_BONUS,
|
||||
'val' => $item_num
|
||||
];
|
||||
LogService::productDiamond(['account_id' => $account_id], $event);
|
||||
}
|
||||
|
||||
$this->_addGoods($address, array(
|
||||
'goods_id' => $item_id,
|
||||
'goods_num' => $item_num,
|
||||
'id' => $id,
|
||||
));
|
||||
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
@ -515,14 +509,14 @@ class ShopController extends BaseAuthedController
|
||||
$this->_rspErr(2, "product_id is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// $goods = mt\ShopGoods::getByProductId($product_id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$order = SqlHelper::selectOne($conn, 't_web2_order', array('address', 'id', 'item_id', 'goods_num', 'status'), array('order_id' => $order_id, 'status' => 0));
|
||||
error_log('process order '. json_encode($order));
|
||||
error_log('process order ' . json_encode($order));
|
||||
if (!$order) {
|
||||
$this->_rspErr(3, "order not found, order_id: {$order_id}");
|
||||
return;
|
||||
|
@ -30,6 +30,7 @@ class LogService extends BaseService
|
||||
|
||||
const CEBG_TO_DIAMOND = "cebg_to_diamond"; //CEBG兑换钻石
|
||||
const RECHARGE_DIAMOND = "recharge_diamond"; //充值钻石
|
||||
const RECHARGE_CEBG_BONUS = "recarge_cebg_bonus"; //充值CEBG奖励
|
||||
|
||||
|
||||
const PRONAME = 'game_2006_api';
|
||||
|
Loading…
x
Reference in New Issue
Block a user