Merge branch 'star' of git.kingsome.cn:server/game2006api into star

This commit is contained in:
hujiabin 2023-06-19 12:29:51 +08:00
commit 86342e1115
3 changed files with 27 additions and 9 deletions

View File

@ -166,6 +166,8 @@ class Shop(object):
], ],
'response': [ 'response': [
_common.RspHead(), _common.RspHead(),
['idx', 0, '每日精选的索引'],
['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'],
] ]
}, },
{ {

View File

@ -21,6 +21,7 @@ require_once('models/Chip.php');
require_once('services/AwardService.php'); require_once('services/AwardService.php');
require_once('services/PropertyChgService.php'); require_once('services/PropertyChgService.php');
use phpcommon\HttpClient;
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
use models\User; use models\User;
use models\Bag; use models\Bag;
@ -787,17 +788,32 @@ class ShopController extends BaseAuthedController
$grid = getReqVal('grid', 0); $grid = getReqVal('grid', 0);
$count = getReqVal('count', 0); $count = getReqVal('count', 0);
$chk = $this->decDailySelectionItem($idx, $grid, $count); // $chk = $this->decDailySelectionItem($idx, $grid, $count);
if (!$chk) { // if (!$chk) {
$this->_rspErr(1, 'goods not enough'); // $this->_rspErr(1, 'goods not enough');
return false; // 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( $this->_rspData(
array( array(
'idx' => $idx, 'idx' => $idx,
'grid' => $grid, 'grid' => $grid,
'count' => $count, 'count' => $count,
'response' => $response,
) )
); );
} }

View File

@ -4,7 +4,8 @@ namespace mt;
use phpcommon; use phpcommon;
class ShopGoods { class ShopGoods
{
public static function get($id) public static function get($id)
{ {
@ -24,11 +25,11 @@ class ShopGoods {
{ {
if (!self::$goodsList) { if (!self::$goodsList) {
self::$goodsList = array(); self::$goodsList = array();
foreach(self::getMetaList() as $meta) { foreach (self::getMetaList() as $meta) {
array_push(self::$goodsList, $meta); array_push(self::$goodsList, $meta);
} }
} }
return self::$goodsList; return self::$goodsList;
} }
@ -47,7 +48,7 @@ class ShopGoods {
if (!self::$shopGoodsHash) { if (!self::$shopGoodsHash) {
self::$shopGoodsHash = array(); self::$shopGoodsHash = array();
foreach (self::getMetaList() as $meta) { 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( self::$shopGoodsHash[$meta['shop_id']] = array(
'goodsList' => array(), 'goodsList' => array(),
'goodsHash' => array() 'goodsHash' => array()
@ -70,5 +71,4 @@ class ShopGoods {
protected static $goodsList; protected static $goodsList;
protected static $shopGoodsHash; protected static $shopGoodsHash;
protected static $metaList; protected static $metaList;
} }