From 689d375de96bc8660d7e50d318aad39be0babb5c Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 19 Jun 2023 11:14:25 +0800 Subject: [PATCH 1/3] ... --- doc/Shop.py | 1 + webapp/controller/ShopController.class.php | 24 ++++++++++++++++++---- webapp/mt/ShopGoods.php | 10 ++++----- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/doc/Shop.py b/doc/Shop.py index 486bf61b..c90fa6ff 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -166,6 +166,7 @@ class Shop(object): ], 'response': [ _common.RspHead(), + ['!goods_list', [_common.DailySelection()], '每日精选列表'], ] }, { diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index f3814176..d71a8adf 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -21,6 +21,7 @@ require_once('models/Chip.php'); require_once('services/AwardService.php'); require_once('services/PropertyChgService.php'); +use phpcommon\HttpClient; use phpcommon\SqlHelper; use models\User; use models\Bag; @@ -787,17 +788,32 @@ class ShopController extends BaseAuthedController $grid = getReqVal('grid', 0); $count = getReqVal('count', 0); - $chk = $this->decDailySelectionItem($idx, $grid, $count); - if (!$chk) { - $this->_rspErr(1, 'goods not enough'); - return false; + // $chk = $this->decDailySelectionItem($idx, $grid, $count); + // if (!$chk) { + // $this->_rspErr(1, 'goods not enough'); + // return; + // } + + $url = "192.168.100.39:7672/webapp/index.php"; + $params = array( + 'c' => 'GameItemMall', + 'a' => 'buy', + 'account' => $account, + 'price' => 100, + ); + if (!phpcommon\HttpClient::get($url, $params, $response)) { + $this->_rspErr(500, 'GameItemMall buy failed'); + return; } + $response = ''; + error_log($response); $this->_rspData( array( 'idx' => $idx, 'grid' => $grid, 'count' => $count, + 'response' => $response, ) ); } diff --git a/webapp/mt/ShopGoods.php b/webapp/mt/ShopGoods.php index fb6d6da9..dd9ef143 100644 --- a/webapp/mt/ShopGoods.php +++ b/webapp/mt/ShopGoods.php @@ -4,7 +4,8 @@ namespace mt; use phpcommon; -class ShopGoods { +class ShopGoods +{ public static function get($id) { @@ -24,11 +25,11 @@ class ShopGoods { { if (!self::$goodsList) { self::$goodsList = array(); - foreach(self::getMetaList() as $meta) { + foreach (self::getMetaList() as $meta) { array_push(self::$goodsList, $meta); } } - + return self::$goodsList; } @@ -47,7 +48,7 @@ class ShopGoods { if (!self::$shopGoodsHash) { self::$shopGoodsHash = array(); foreach (self::getMetaList() as $meta) { - if (!getXVal(self::$shopGoodsHash, $meta['shop_id'], null)){ + if (!getXVal(self::$shopGoodsHash, $meta['shop_id'], null)) { self::$shopGoodsHash[$meta['shop_id']] = array( 'goodsList' => array(), 'goodsHash' => array() @@ -70,5 +71,4 @@ class ShopGoods { protected static $goodsList; protected static $shopGoodsHash; protected static $metaList; - } From 240a4ab294f5515ca3600944981e7b199eca1731 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 19 Jun 2023 11:15:45 +0800 Subject: [PATCH 2/3] ... --- doc/Shop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Shop.py b/doc/Shop.py index c90fa6ff..57d850d3 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -166,7 +166,7 @@ class Shop(object): ], 'response': [ _common.RspHead(), - ['!goods_list', [_common.DailySelection()], '每日精选列表'], + ['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'], ] }, { From 4e6db6c90179abfff42c6a7f82c638a12a392e10 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 19 Jun 2023 11:24:41 +0800 Subject: [PATCH 3/3] ... --- doc/Shop.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Shop.py b/doc/Shop.py index 57d850d3..4d0856ec 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -166,6 +166,7 @@ class Shop(object): ], 'response': [ _common.RspHead(), + ['idx', 0, '每日精选的索引'], ['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'], ] },