This commit is contained in:
aozhiwei 2024-08-01 18:42:38 +08:00
parent 4a2983130d
commit e0cf6486ec

View File

@ -245,6 +245,21 @@ class BigwheelController extends BaseAuthedController {
}
array_push($data['grid_list'], $grid1);
array_push($data['grid_list'], $grid2);
$costItems = array(
array(
'item_id' => V_ITEM_DIAMOND,
'item_num' => $costItemNum
),
);
$lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return;
}
$this->_decItems($costItems);
$this->propertyChgService->addUserChg();
myself()->_addItems($hashItems, $this->awardService, $this->propertyChgService);
myself()->_callModelStatic('MidData', 'setData', $key, json_encode($data));
{
@ -267,6 +282,52 @@ class BigwheelController extends BaseAuthedController {
{
$key = $this->getMidDataKey();
$data = $this->getAndCreateData($key);
$gridRef = null;
$gridId = getReqVal('grid_id', 0);
$this->getGridRefByGridId($data, $gridId, $gridRef);
error_log(json_encode($gridRef));
if (empty($gridRef) ||
$gridRef['grid_state'] != 2) {
myself()->_rspErr(1, 'cant buy');
return;
}
$costItems = array(
array(
'item_id' => V_ITEM_DIAMOND,
'item_num' => $gridRef['buy_price']
),
);
$lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return;
}
$this->_decItems($costItems);
$gridRef['grid_state'] = 1;
foreach ($data['grid_list'] as &$grid) {
if ($grid['grid_id'] == $gridId) {
$grid['grid_state'] = 1;
}
}
error_log(json_encode($gridRef));
error_log(json_encode($data));
myself()->_callModelStatic('MidData', 'setData', $key, json_encode($data));
$this->awardService->addItem($gridRef['item_id'], $gridRef['item_num']);
$this->propertyChgService->addUserChg();
$priceInfo = $this->getPriceInfo($data['drawed_times']);
if (empty($priceInfo)) {
myself()->_rspErr(500, 'server internal error');
return;
}
$info = array();
$this->fillInfo($info, $data, $priceInfo);
myself()->_rspData(array(
'award' => $this->awardService->toDto(),
'property_chg' => $this->propertyChgService->toDto(),
'info' => $info
));
}
private function getMidDataKey()