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

This commit is contained in:
hujiabin 2023-07-04 11:24:50 +08:00
commit b8b5d01f5a
4 changed files with 25 additions and 15 deletions

View File

@ -9,7 +9,7 @@ class Shop(object):
self.apis = [
{
'name': 'info',
'desc': '获取商店信息',
'desc': '获取商店信息[废弃]',
'group': 'Shop',
'url': 'webapp/index.php?c=Shop&a=info',
'params': [
@ -23,7 +23,7 @@ class Shop(object):
},
{
'name': 'buyGoods',
'desc': '购买商品',
'desc': '购买商品[废弃]',
'group': 'Shop',
'url': 'webapp/index.php?c=Shop&a=buyGoods',
'params': [
@ -42,7 +42,7 @@ class Shop(object):
},
{
'name': 'getDiscountList',
'desc': '获取商品折扣列表',
'desc': '获取商品折扣列表[废弃]',
'group': 'Shop',
'url': 'webapp/index.php?c=Shop&a=getDiscountList',
'params': [
@ -60,6 +60,7 @@ class Shop(object):
'url': 'webapp/index.php?c=Shop&a=getGoodsList',
'params': [
_common.ReqHead(),
['shop_id', 0, '商店id 0: 所有商店(较慢)'],
],
'response': [
_common.RspHead(),
@ -81,7 +82,7 @@ class Shop(object):
},
{
'name': 'buyGoodsNew',
'desc': '购买商品(新)',
'desc': '购买商品[废弃]',
'group': 'Shop',
'url': 'webapp/index.php?c=Shop&a=buyGoodsNew',
'params': [

View File

@ -75,11 +75,13 @@ class BaseAuthedController extends BaseController {
$this->accountId = getReqVal('account_id', '');
$this->sessionId = getReqVal('session_id', '');
if (SERVER_ENV != _DEBUG) {
if (!phpcommon\isValidSessionId($this->accountId,
$this->sessionId)) {
phpcommon\sendError(500, 'invalid session_id');
die();
}
}
if (!(getReqVal('c', '') == 'User' && getReqVal('a', '') == 'login')) {
if ((getReqVal('c', '') == 'Battle')) {
return;

View File

@ -590,7 +590,7 @@ class MarketController extends BaseController
if (empty($nftDb)) {
$nftDb = Nft::getNft($row['token_id']);
}
$row['info'] = Nft::toDto($nftDb);
// $row['info'] = Nft::toDto($nftDb);
// $row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id']));
// if (in_array($row['info']['info']['job'], $job) == false) continue;
// if ($row['detail']['hero_lv'] < $lv) continue;
@ -1488,7 +1488,7 @@ class MarketController extends BaseController
private function listMySelledNfts($account, $type)
{
error_log('listMySelledNfts ' . $account . ' ' . $type);
// error_log('listMySelledNfts ' . $account . ' ' . $type);
$conn = myself()->_getMarketMysql('');

View File

@ -113,7 +113,13 @@ class ShopController extends BaseAuthedController
public function getGoodsList()
{
$goodsList = mt\ShopGoods::all();
$shop_id = getReqVal('shop_id', 0);
if ($shop_id == 0) {
$goodsList = mt\ShopGoods::all();
} else {
$goodsList = mt\ShopGoods::getGoodsList($shop_id);
}
$goodsList = $goodsList ? $goodsList : array();
$buyRecordHash = ShopBuyRecord::allToHash();
@ -511,21 +517,22 @@ class ShopController extends BaseAuthedController
}
break;
case ShopController::TOTAL_BUY_LIMIT: {
error_log("total buy limit " . $address . " " . $id . " " . $row['limit_num']);
$buyRecord = getXVal($buyRecordHash, $id);
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $row['limit_num']) {
$this->_rspErr(2, 'The maximum number of purchase restrictions has been reached');
$this->_rspErr(2, 'The maximum number of purchase restrictions has been reached 1');
return;
}
if ($row['limit_num'] <= 0) {
$this->_rspErr(2, 'he maximum number of purchase restrictions has been reached');
return;
}
$sendingTimes = $this->countBuyGoodsRequestTimesByGoodsId($address, $row['goods_id']);
if ($sendingTimes >= $row['limit_num']) {
$this->_rspErr(2, 'The maximum number of purchase restrictions has been reached');
$this->_rspErr(2, 'he maximum number of purchase restrictions has been reached 2');
return;
}
// $sendingTimes = $this->countBuyGoodsRequestTimesByGoodsId($address, $row['goods_id']);
// if ($sendingTimes >= $row['limit_num']) {
// $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached 3');
// return;
// }
}
break;
default: {