This commit is contained in:
azw 2023-07-30 13:17:05 +08:00
parent 8ec2131b82
commit 2b029f1b77
5 changed files with 83 additions and 18 deletions

View File

@ -1278,6 +1278,64 @@ CREATE TABLE `t_user_honor` (
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */; /*!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`; DROP TABLE IF EXISTS `t_web2_order`;
CREATE TABLE `t_web2_order` ( CREATE TABLE `t_web2_order` (
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',

View File

@ -245,32 +245,18 @@ class ShopController extends BaseAuthedController {
public function inappPurchase() public function inappPurchase()
{ {
$self = myself(); $goodsUuid = getReqVal('goods_uuid', 0);
if (!$self) { $goodsNum = getReqVal('goods_num', 0);
$this->_rspErr(1, "start purchase failed"); $goods = mt\ShopGoods::getByGoodsUuid($goodsUuid);
return;
}
$id = getReqVal('id', 0);
$goods = mt\ShopGoods::get($id);
if (!$goods) { if (!$goods) {
$this->_rspErr(2, "start purchase failed"); $this->_rspErr(2, "start purchase failed");
return; return;
} }
if ($goods['shop_id'] != 9) { if ($goods['shop_id'] != mt\Shop::INAPP_SHOP) {
$this->_rspErr(3, "start purchase failed"); $this->_rspErr(3, "start purchase failed");
return; 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_id = $goods['goods_id'];
$item_num = $goods['goods_num'] * $goodsNum; $item_num = $goods['goods_num'] * $goodsNum;

View File

@ -0,0 +1,10 @@
<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class InAppOrder extends BaseModel {
}

View File

@ -0,0 +1,10 @@
<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class OutAppOrder extends BaseModel {
}

View File

@ -43,6 +43,7 @@ class Shop {
const WEEKLY_BUY_LIMIT = 2; const WEEKLY_BUY_LIMIT = 2;
const TOTAL_BUY_LIMIT = 3; const TOTAL_BUY_LIMIT = 3;
const INAPP_SHOP = 9;
const OUTSIDE_SHOP = 100; const OUTSIDE_SHOP = 100;
public static function get($id) public static function get($id)