并发处理

This commit is contained in:
hujiabin 2024-08-01 16:21:54 +08:00
parent 68ad3df9f5
commit 79acc95aa9
22 changed files with 79 additions and 40 deletions

View File

@ -45,10 +45,10 @@ class Avatar(object):
['property_chg', _common.PropertyChg(), '属性变更'],
]
},{
'name': 'buyAvatar',
'name': 'buyAvatarS',
'desc': '购买装饰物品',
'group': 'Avatar',
'url': 'webapp/index.php?c=Avatar&a=buyAvatar',
'surl': 'webapp/index.php?c=Avatar&a=buyAvatarS',
'params': [
_common.ReqHead(),
['item_id', '', '装饰物品itemId'],

View File

@ -54,10 +54,10 @@ class Bag(object):
]
},
{
'name': 'buyItem',
'name': 'buyItemS',
'desc': '购买道具(目前只一次购买改名卡)',
'group': 'Bag',
'url': 'webapp/index.php?c=Bag&a=buyItem',
'surl': 'webapp/index.php?c=Bag&a=buyItemS',
'params': [
_common.ReqHead(),
['item_id', '', '道具id'],

View File

@ -45,10 +45,10 @@ class Chip(object):
['!data', [AttrChange()], '属性变化信息']
]
},{
'name': 'upgradeQuality',
'name': 'upgradeQualityS',
'desc': '芯片升阶',
'group': 'Chip',
'url': 'webapp/index.php?c=Chip&a=upgradeQuality',
'surl': 'webapp/index.php?c=Chip&a=upgradeQualityS',
'params': [
_common.ReqHead(),
['chip_uniid', '', '升阶芯片唯一id'],
@ -61,10 +61,10 @@ class Chip(object):
]
},
{
'name': 'synChip',
'name': 'synChipS',
'desc': '芯片合成',
'group': 'Chip',
'url': 'webapp/index.php?c=Chip&a=synChip',
'surl': 'webapp/index.php?c=Chip&a=synChipS',
'params': [
_common.ReqHead(),
['item_id', '', '材料item_id'],

View File

@ -25,10 +25,10 @@ class HashRate(object):
['refresh_times', 0, '今日刷新次数'],
]
},{
'name': 'commitTask',
'name': 'commitTaskS',
'desc': '获取算力信息',
'group': 'HashRate',
'url': 'webapp/index.php?c=HashRate&a=commitTask',
'surl': 'webapp/index.php?c=HashRate&a=commitTaskS',
'params': [
_common.ReqHead(),
['task_id', 0, '任务id'],

View File

@ -75,10 +75,10 @@ class Hero(object):
_common.RspHead(),
]
},{
'name': 'upgradeQuality',
'name': 'upgradeQualityS',
'desc': '英雄升阶',
'group': 'Hero',
'url': 'webapp/index.php?c=Hero&a=upgradeQuality',
'surl': 'webapp/index.php?c=Hero&a=upgradeQualityS',
'params': [
_common.ReqHead(),
['hero_uniid', 0, '英雄唯一id'],
@ -107,10 +107,10 @@ class Hero(object):
['property_chg', _common.PropertyChg(), '属性变更'],
]
},{
'name': 'synHero',
'name': 'synHeroS',
'desc': '英雄合成',
'group': 'Hero',
'url': 'webapp/index.php?c=Hero&a=synHero',
'surl': 'webapp/index.php?c=Hero&a=synHeroS',
'params': [
_common.ReqHead(),
['item_id', 0, '碎片item_id'],

View File

@ -70,10 +70,10 @@ class HeroSkin(object):
_common.RspHead(),
]
},{
'name': 'synSkin',
'name': 'synSkinS',
'desc': '皮肤合成',
'group': 'HeroSkin',
'url': 'webapp/index.php?c=HeroSkin&a=synSkin',
'surl': 'webapp/index.php?c=HeroSkin&a=synSkinS',
'params': [
_common.ReqHead(),
['item_id', 0, '材料itemId'],

View File

@ -29,10 +29,10 @@ class InGameMall(object):
]
},
{
'name': 'sell',
'name': 'sellS',
'desc': '出售',
'group': 'InGameMall',
'url': 'webapp/index.php?c=InGameMall&a=sell',
'surl': 'webapp/index.php?c=InGameMall&a=sellS',
'params': [
_common.ReqHead(),
['goods_uniid', '', '道具id'],
@ -45,10 +45,10 @@ class InGameMall(object):
]
},
{
'name': 'buy',
'name': 'buyS',
'desc': '购买',
'group': 'InGameMall',
'url': 'webapp/index.php?c=InGameMall&a=buy',
'surl': 'webapp/index.php?c=InGameMall&a=buyS',
'params': [
_common.ReqHead(),
['order_id', '', '订单id'],
@ -59,10 +59,10 @@ class InGameMall(object):
]
},
{
'name': 'cancel',
'name': 'cancelS',
'desc': '下架物品',
'group': 'InGameMall',
'url': 'webapp/index.php?c=InGameMall&a=cancel',
'surl': 'webapp/index.php?c=InGameMall&a=cancelS',
'params': [
_common.ReqHead(),
['order_id', '', '订单id'],
@ -135,10 +135,10 @@ class InGameMall(object):
]
},
{
'name': 'shoppingCartBuy',
'name': 'shoppingCartBuyS',
'desc': '购物车下单',
'group': 'InGameMall',
'url': 'webapp/index.php?c=InGameMall&a=shoppingCartBuy',
'surl': 'webapp/index.php?c=InGameMall&a=shoppingCartBuyS',
'params':[
_common.ReqHead(),
['order_ids', '', '订单id(多个订单用 | 隔开)'],

View File

@ -18,6 +18,20 @@
* @apiSuccessExample {json} Success-Response:
* 2024/07/25
* c=Bag&a=useItemS
* c=Bag&a=buyItemS
* c=Avatar&a=buyAvatarS
* c=Chip&a=upgradeQualityS
* c=Chip&a=synChipS
* c=HashRate&a=commitTaskS
* c=Hero&a=synHeroS
* c=Hero&a=upgradeQualityS
* c=HeroSkin&a=synSkinS
* c=InGameMall&a=sellS
* c=InGameMall&a=buyS
* c=InGameMall&a=cancelS
* c=InGameMall&a=shoppingCartBuyS
* c=Sign&a=receiveS
* c=User&a=selectFreeItemS
*
*
*/

View File

@ -20,10 +20,10 @@ class Sign(object):
]
},
{
'name': 'receive',
'name': 'receiveS',
'desc': '领取签到奖励',
'group': 'Sign',
'url': 'webapp/index.php?c=Sign&a=receive',
'surl': 'webapp/index.php?c=Sign&a=receiveS',
'params': [
_common.ReqHead(),
['sign_id', '', '签到id'],

View File

@ -150,6 +150,19 @@ class User(object):
_common.RspHead(),
['!data', [], '列表'],
]
},{
'name': 'selectFreeItemS',
'desc': '获取免费英雄和武器列表',
'group': 'User',
'surl': 'webapp/index.php?c=User&a=selectFreeItemS',
'params': [
_common.ReqHead(),
['itemId', 0, '英雄itemId'],
],
'response': [
_common.RspHead(),
['!data', [], 'item'],
]
},
{
'method': 'POST',

View File

@ -128,7 +128,7 @@ class AvatarController extends BaseAuthedController {
}
public function buyAvatar(){
public function buyAvatarS(){
$itemId = trim(getReqVal('item_id', 0));
$itemMeta = \mt\Item::get($itemId);
if (!$itemMeta || $itemMeta['type'] != \mt\Item::AVATAR_TYPE){

View File

@ -466,7 +466,7 @@ class BagController extends BaseAuthedController {
}
public function buyItem()
public function buyItemS()
{
$itemId = getReqVal('item_id', 0);
$itemNum = getReqVal('item_num', 1);

View File

@ -476,6 +476,7 @@ class BaseAuthedController extends BaseController {
public function _addItems($items, $awardService, $propertyService)
{
myself()->_checkS();
$heads = array();
$headFrames = array();
foreach ($items as $item) {
@ -630,6 +631,7 @@ class BaseAuthedController extends BaseController {
public function _decItems($items)
{
myself()->_checkS();
foreach ($items as $item) {
//道具消耗埋点
LogService::consumeItem($item);

View File

@ -370,4 +370,11 @@ class BaseController {
die();
}
public function _checkS()
{
$sign = getReqVal('__sign', '');
if (empty($sign)) {
error_log('waring unsafe call---------------' . json_encode($_REQUEST));
}
}
}

View File

@ -114,7 +114,7 @@ class ChipController extends BaseAuthedController
));
}
public function upgradeQuality(){
public function upgradeQualityS(){
$chipUniId = getReqVal('chip_uniid', 0);
$consumeUniIds = getReqVal('consume_uniids',0);
$chipDb = Chip::find($chipUniId);
@ -212,7 +212,7 @@ class ChipController extends BaseAuthedController
));
}
public function synChip(){
public function synChipS(){
$itemId = getReqVal('item_id',0);
$itemNum = getReqVal('item_num',0);
$needItem = \mt\Parameter::getVal('chip_craft_need_item',0);

View File

@ -67,7 +67,7 @@ class HashRateController extends BaseAuthedController
));
}
public function commitTask(){
public function commitTaskS(){
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
if (! $currentPeriod){
$this->_rspErr(1, 'Already ended');

View File

@ -73,7 +73,7 @@ class HeroController extends BaseAuthedController {
));
}
public function synHero(){
public function synHeroS(){
$itemId = getReqVal('item_id',0);
$itemNum = getReqVal('item_num',0);
$itemMeta = \mt\Item::get($itemId);
@ -129,7 +129,7 @@ class HeroController extends BaseAuthedController {
}
public function upgradeQuality(){
public function upgradeQualityS(){
$heroUniId = getReqVal('hero_uniid', 0);
$itemId = getReqVal('item_id',0);
$itemNum = max(0,getReqVal('item_num',0));

View File

@ -166,7 +166,7 @@ class HeroSkinController extends BaseAuthedController {
));
}
public function synSkin(){
public function synSkinS(){
$itemId = getReqVal('item_id',0);
$itemNum = getReqVal('item_num',0);
$itemMeta = \mt\Item::get($itemId);

View File

@ -185,7 +185,7 @@ class InGameMallController extends BaseAuthedController {
myself()->_rspData($out);
}
public function sell()
public function sellS()
{
$goodsUniid = getReqVal('goods_uniid', '');
$itemId = getReqVal('item_id', '');
@ -294,7 +294,7 @@ class InGameMallController extends BaseAuthedController {
));
}
public function buy(){
public function buyS(){
$orderId = getReqVal('order_id', '');
$goodsDb = InGameMall::findByOrderId($orderId);
if (!$goodsDb) {
@ -431,7 +431,7 @@ EOD;
LogService::burialPointEvent($event1);
}
public function cancel()
public function cancelS()
{
$orderId = getReqVal('order_id', '');
$goodsDb = InGameMall::findByOrderId($orderId);
@ -642,7 +642,7 @@ EOD;
));
}
public function shoppingCartBuy(){
public function shoppingCartBuyS(){
$orderIds = getReqVal('order_ids', '');
if (!$orderIds){
$this->_rspErr(1, 'param is not null');

View File

@ -51,7 +51,7 @@ class SignController extends BaseAuthedController
));
}
public function receive(){
public function receiveS(){
$sign_id = getReqVal('sign_id', '');
$meta = \mt\Sign::get($sign_id);
if (!$meta){

View File

@ -21,9 +21,12 @@ class StarController extends BaseAuthedController {
private $currMissionSeasonMeta = null;
public function _handlePre()
{
if(getReqVal('a', '') != 'resetStar'){
parent::_handlePre();
}
$this->_rspErr(10, 'server internal error');
die();
$this->currMissionSeasonMeta = \mt\StarLevel::getCurrentSeason();
if (!$this->currMissionSeasonMeta) {
$this->_rspErr(10, 'server internal error');

View File

@ -912,7 +912,7 @@ class UserController extends BaseAuthedController {
}
public function selectFreeItem(){
public function selectFreeItemS(){
$itemId = getReqVal('itemId', '');
if (!$itemId){
$this->_rspErr(1, 'param is error');