diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 6dbdf24f..d1dfafc6 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -1278,6 +1278,64 @@ CREATE TABLE `t_user_honor` ( ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `t_inapp_order` +-- + +DROP TABLE IF EXISTS `t_inapp_order`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_inapp_order` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id', + `sp_order_id` varchar(64) DEFAULT NULL COMMENT 'app store order_id', + `platform` int(11) NOT NULL DEFAULT '0' COMMENT '0: ios 1: android', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '申请账号id', + `address` varchar(60) DEFAULT NULL COMMENT '申请时账号绑定的钱包', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', + `item_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '物品数量', + `price` bigint(20) NOT NULL DEFAULT '0' COMMENT '价格', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`), + UNIQUE KEY `platform_sp_order_id` (`platform_sp_order_id`), + KEY `account_id` (`account_id`), + KEY `address` (`address`), + KEY `sp_order_id` (`sp_order_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_outapp_order` +-- + +DROP TABLE IF EXISTS `t_outapp_order`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_outapp_order` ( + `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id', + `sp_order_id` varchar(64) DEFAULT NULL COMMENT 'app store order_id', + `platform` int(11) NOT NULL DEFAULT '0' COMMENT '0: ios 1: android', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '申请账号id', + `address` varchar(60) DEFAULT NULL COMMENT '申请时账号绑定的钱包', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id', + `item_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '物品数量', + `price` bigint(20) NOT NULL DEFAULT '0' COMMENT '价格', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `order_id` (`order_id`), + UNIQUE KEY `platform_sp_order_id` (`platform_sp_order_id`), + KEY `account_id` (`account_id`), + KEY `address` (`address`), + KEY `sp_order_id` (`sp_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_web2_order`; CREATE TABLE `t_web2_order` ( `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 95e4ca07..7bf53c23 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -245,32 +245,18 @@ class ShopController extends BaseAuthedController { public function inappPurchase() { - $self = myself(); - if (!$self) { - $this->_rspErr(1, "start purchase failed"); - return; - } - - $id = getReqVal('id', 0); - $goods = mt\ShopGoods::get($id); + $goodsUuid = getReqVal('goods_uuid', 0); + $goodsNum = getReqVal('goods_num', 0); + $goods = mt\ShopGoods::getByGoodsUuid($goodsUuid); if (!$goods) { $this->_rspErr(2, "start purchase failed"); return; } - if ($goods['shop_id'] != 9) { + if ($goods['shop_id'] != mt\Shop::INAPP_SHOP) { $this->_rspErr(3, "start purchase failed"); return; } - $goodsNum = getReqVal('goods_num', 1); - - $account_id = $self->_getAccountId(); - $address = $self->_getAddress(); - if (empty($address)) { - $this->_rspErr(4, "start purchase failed"); - return; - } - $item_id = $goods['goods_id']; $item_num = $goods['goods_num'] * $goodsNum; diff --git a/webapp/models/InAppOrder.php b/webapp/models/InAppOrder.php new file mode 100644 index 00000000..7cccd922 --- /dev/null +++ b/webapp/models/InAppOrder.php @@ -0,0 +1,10 @@ +