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': [
_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/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,
)
);
}

View File

@ -4,7 +4,8 @@ namespace mt;
use phpcommon;
class ShopGoods {
class ShopGoods
{
public static function get($id)
{
@ -24,7 +25,7 @@ class ShopGoods {
{
if (!self::$goodsList) {
self::$goodsList = array();
foreach(self::getMetaList() as $meta) {
foreach (self::getMetaList() as $meta) {
array_push(self::$goodsList, $meta);
}
}
@ -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;
}