1
This commit is contained in:
parent
d76d663e04
commit
1914112edf
@ -1307,9 +1307,9 @@ DROP TABLE IF EXISTS `t_inapp_record`;
|
|||||||
CREATE TABLE `t_inapp_record` (
|
CREATE TABLE `t_inapp_record` (
|
||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||||
`amount` bigint NOT NULL DEFAULT '0' COMMENT '充值总额',
|
`amount` double NOT NULL DEFAULT '0' COMMENT '充值总额',
|
||||||
`buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值次数',
|
`buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值次数',
|
||||||
`amount_ok` bigint NOT NULL DEFAULT '0' COMMENT '充值成功总额',
|
`amount_ok` double NOT NULL DEFAULT '0' COMMENT '充值成功总额',
|
||||||
`buy_ok_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值成功次数',
|
`buy_ok_times` int(11) NOT NULL DEFAULT '0' COMMENT '充值成功次数',
|
||||||
`daytime` int(11) NOT NULL DEFAULT '0' COMMENT '时间',
|
`daytime` int(11) NOT NULL DEFAULT '0' COMMENT '时间',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
@ -237,6 +237,10 @@ class ShopController extends BaseAuthedController {
|
|||||||
$platform = getReqVal('platform', 0);
|
$platform = getReqVal('platform', 0);
|
||||||
$balance = $this->getInAppBalance();
|
$balance = $this->getInAppBalance();
|
||||||
|
|
||||||
|
if ($balance <= 0) {
|
||||||
|
$this->_rspErr(2, "insufficient available balance");
|
||||||
|
return;
|
||||||
|
}
|
||||||
$goodsMeta = mt\ShopGoods::getByGoodsUuid($goodsId);
|
$goodsMeta = mt\ShopGoods::getByGoodsUuid($goodsId);
|
||||||
if (!$goodsMeta) {
|
if (!$goodsMeta) {
|
||||||
$this->_rspErr(2, "inapp purchase failed");
|
$this->_rspErr(2, "inapp purchase failed");
|
||||||
@ -258,8 +262,20 @@ class ShopController extends BaseAuthedController {
|
|||||||
$this->_rspErr(1, "error paramater platform");
|
$this->_rspErr(1, "error paramater platform");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$price = $goodsMeta['price'];
|
||||||
|
if (empty($price) || $pirce < 0.001) {
|
||||||
|
$this->_rspErr(1, "config error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$orderId = OrderId::gen();
|
$orderId = OrderId::gen();
|
||||||
|
InAppOrder::add(
|
||||||
|
$orderId,
|
||||||
|
$platform,
|
||||||
|
$goodsId,
|
||||||
|
$price
|
||||||
|
);
|
||||||
|
InAppRecord::addAmount($price);
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'order_id' => $order_id,
|
'order_id' => $order_id,
|
||||||
));
|
));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user