From 1b3ee8765a3c54e7356a798860a5728c688a5365 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 10 Jul 2023 10:50:48 +0800 Subject: [PATCH] ... --- sql/gamedb.sql | 1 + sql/gamedb2006_migrate_230710_01.sql | 5 ++++ webapp/controller/ShopController.class.php | 27 ++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 sql/gamedb2006_migrate_230710_01.sql diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 9358ef2c..22455742 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -1151,6 +1151,7 @@ CREATE TABLE `t_shop_buy_order` ( `idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单id', `address` varchar(60) NOT NULL COMMENT '账户id', `createtime` int(11) NOT NULL COMMENT '订单开始时间', + `id` int(11) NOT NULL COMMENT '商店货物id', `item_id` int(11) NOT NULL COMMENT '道具id', `goods_num` int(11) NOT NULL COMMENT '购买个数', `status` int(11) NOT NULL COMMENT '订单状态 0-客户端申请了订单 1-订单完成 2-订单失败', diff --git a/sql/gamedb2006_migrate_230710_01.sql b/sql/gamedb2006_migrate_230710_01.sql new file mode 100644 index 00000000..081cdac4 --- /dev/null +++ b/sql/gamedb2006_migrate_230710_01.sql @@ -0,0 +1,5 @@ +begin; + +alter table t_bc_order add column `id` int(11) NOT NULL COMMENT '商店货物id', + +commit; \ No newline at end of file diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 535aadc7..a0f74f4a 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -111,7 +111,11 @@ class ShopController extends BaseAuthedController // } // } - if (getReqVal('a', '') != 'buyGoodsDirect') { + $a = getReqVal('a', ''); + if ( + $a != 'buyGoodsDirect' && + $a != 'purchaseDiamonds' + ) { parent::_handlePre(); } } @@ -189,6 +193,8 @@ class ShopController extends BaseAuthedController $token_type = getReqVal('token_type', ''); $goods_num = getReqVal('goods_num', 0); + $goods = mt\ShopGoods::get($id); + $conn = myself()->_getMysql(''); $address = myself()->_getAddress(); @@ -196,14 +202,14 @@ class ShopController extends BaseAuthedController $this->_rspErr(1, 'address is empty'); } - $chk = SqlHelper::insert( $conn, 't_shop_buy_order', array( 'address' => $address, 'createtime' => myself()->_getNowTime(), - 'item_id' => $id, + 'id' => $id, + 'item_id' => $goods['goods_id'], 'goods_num' => $goods_num, 'status' => 0, // 0-客户端申请了订单 1-订单完成 2-订单失败 ) @@ -229,7 +235,7 @@ class ShopController extends BaseAuthedController $row = SqlHelper::selectOne( $conn, 't_shop_buy_order', - array('status'), + array('status', 'id'), array( 'idx' => $order_id, ) @@ -238,6 +244,8 @@ class ShopController extends BaseAuthedController $this->_rspData( array( 'status' => $row['status'], + 'item_id' => $row['item_id'], + 'item_num' => $row['goods_num'], ) ); } else { @@ -350,6 +358,17 @@ class ShopController extends BaseAuthedController $this->_rspOk(); } + public function purchaseDiamonds() + { + + // 有三种情况: + // 1. 从商城购买钻石,有订单号 + // 2. 站外充值钻石,没有订单号 + // 3. appstore 退款,没有订单号 + + $this->_rspOk(); + } + public function getPayMethods() { $token_type = getReqVal('token_type', 99);