diff --git a/doc/Shop.py b/doc/Shop.py index 486bf61b..4d0856ec 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -166,6 +166,8 @@ class Shop(object): ], 'response': [ _common.RspHead(), + ['idx', 0, '每日精选的索引'], + ['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'], ] }, { 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; - }