...
This commit is contained in:
parent
2c7a64bfea
commit
c28cb72a82
@ -27,7 +27,8 @@ use models\Gun;
|
|||||||
use models\GunSkin;
|
use models\GunSkin;
|
||||||
use models\ShopBuyRecord;
|
use models\ShopBuyRecord;
|
||||||
|
|
||||||
class ShopController extends BaseAuthedController {
|
class ShopController extends BaseAuthedController
|
||||||
|
{
|
||||||
|
|
||||||
const TOKEN_TYPE_CEG = '1';
|
const TOKEN_TYPE_CEG = '1';
|
||||||
const TOKEN_TYPE_CEC = '2';
|
const TOKEN_TYPE_CEC = '2';
|
||||||
@ -48,19 +49,49 @@ class ShopController extends BaseAuthedController {
|
|||||||
public function getGoodsList()
|
public function getGoodsList()
|
||||||
{
|
{
|
||||||
$goodsList = mt\ShopGoods::all();
|
$goodsList = mt\ShopGoods::all();
|
||||||
|
$goodsList = $goodsList ? $goodsList : array();
|
||||||
|
$buyRecordHash = ShopBuyRecord::allToHash();
|
||||||
|
|
||||||
$this->_rspData(array(
|
foreach ($goodsList as $goods) {
|
||||||
'goods_list' => $goodsList ? $goodsList : array(),
|
$goods['bought_times'] = 0;
|
||||||
));
|
switch ($goods['limit_type']) {
|
||||||
|
case mt\Item::DAILY_BUY_LIMIT: {
|
||||||
|
$buyRecord = getXVal($buyRecordHash, $goods['id']);
|
||||||
|
$goods['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case mt\Item::WEEKLY_BUY_LIMIT: {
|
||||||
|
$buyRecord = getXVal($buyRecordHash, $goods['id']);
|
||||||
|
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case mt\Item::TOTAL_BUY_LIMIT: {
|
||||||
|
$buyRecord = getXVal($buyRecordHash, $goods['id']);
|
||||||
|
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: {
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_rspData(
|
||||||
|
array(
|
||||||
|
'goods_list' => $goodsList,
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShopNames()
|
public function getShopNames()
|
||||||
{
|
{
|
||||||
$shopList = mt\Shop::all();
|
$shopList = mt\Shop::all();
|
||||||
|
|
||||||
$this->_rspData(array(
|
$this->_rspData(
|
||||||
|
array(
|
||||||
'shop_name_list' => $shopList ? $shopList : array(),
|
'shop_name_list' => $shopList ? $shopList : array(),
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buyGoodsNew()
|
public function buyGoodsNew()
|
||||||
@ -87,8 +118,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
$buyRecordHash = ShopBuyRecord::allToHash();
|
$buyRecordHash = ShopBuyRecord::allToHash();
|
||||||
$boughtTimes = 1;
|
$boughtTimes = 1;
|
||||||
switch ($row['limit_type']) {
|
switch ($row['limit_type']) {
|
||||||
case ShopController::DAILY_BUY_LIMIT:
|
case ShopController::DAILY_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $row['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $row['limit_num']) {
|
||||||
@ -101,8 +131,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ShopController::WEEKLY_BUY_LIMIT:
|
case ShopController::WEEKLY_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $row['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $row['limit_num']) {
|
||||||
@ -115,8 +144,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ShopController::TOTAL_BUY_LIMIT:
|
case ShopController::TOTAL_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $id);
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $row['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $row['limit_num']) {
|
||||||
@ -129,8 +157,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -184,19 +211,20 @@ class ShopController extends BaseAuthedController {
|
|||||||
'limit_type' => $row['limit_type'],
|
'limit_type' => $row['limit_type'],
|
||||||
'bought_times' => $boughtTimes,
|
'bought_times' => $boughtTimes,
|
||||||
'total_buy_times' => $row['limit_num'],
|
'total_buy_times' => $row['limit_num'],
|
||||||
);
|
); {
|
||||||
{
|
|
||||||
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
||||||
if (!empty($priceInfo)) {
|
if (!empty($priceInfo)) {
|
||||||
$goodsDto['price_info'] = $priceInfo['price_info'];
|
$goodsDto['price_info'] = $priceInfo['price_info'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$this->_rspData(array(
|
$this->_rspData(
|
||||||
|
array(
|
||||||
'award' => $awardService->toDto(),
|
'award' => $awardService->toDto(),
|
||||||
'property_chg' => $propertyChgService->toDto(),
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
'goods_chg' => $goodsDto
|
'goods_chg' => $goodsDto
|
||||||
));
|
)
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ShopController::TOKEN_TYPE_BCEG:
|
case ShopController::TOKEN_TYPE_BCEG:
|
||||||
@ -254,13 +282,15 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
$goodsList = mt\ShopGoods::getGoodsList($shopId);
|
$goodsList = mt\ShopGoods::getGoodsList($shopId);
|
||||||
if (!$goodsList) {
|
if (!$goodsList) {
|
||||||
$this->_rspData(array(
|
$this->_rspData(
|
||||||
|
array(
|
||||||
'info' => array(
|
'info' => array(
|
||||||
'shop_id' => $shopId,
|
'shop_id' => $shopId,
|
||||||
'goods_list1' => array(),
|
'goods_list1' => array(),
|
||||||
'goods_list2' => array(),
|
'goods_list2' => array(),
|
||||||
)
|
)
|
||||||
));
|
)
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$buyRecordHash = ShopBuyRecord::allToHash();
|
$buyRecordHash = ShopBuyRecord::allToHash();
|
||||||
@ -279,26 +309,22 @@ class ShopController extends BaseAuthedController {
|
|||||||
'total_buy_times' => $itemMeta['limit_num'],
|
'total_buy_times' => $itemMeta['limit_num'],
|
||||||
);
|
);
|
||||||
switch ($itemMeta['limit_type']) {
|
switch ($itemMeta['limit_type']) {
|
||||||
case mt\Item::DAILY_BUY_LIMIT:
|
case mt\Item::DAILY_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
||||||
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0;
|
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_day_buy_times'] : 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::WEEKLY_BUY_LIMIT:
|
case mt\Item::WEEKLY_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
||||||
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0;
|
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['this_week_buy_times'] : 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::TOTAL_BUY_LIMIT:
|
case mt\Item::TOTAL_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
||||||
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0;
|
$goodsDto['bought_times'] = $buyRecord ? $buyRecord['total_buy_times'] : 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -309,13 +335,15 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_rspData(array(
|
$this->_rspData(
|
||||||
|
array(
|
||||||
'info' => array(
|
'info' => array(
|
||||||
'shop_id' => $shopId,
|
'shop_id' => $shopId,
|
||||||
'goods_list1' => $goodsDtoList1,
|
'goods_list1' => $goodsDtoList1,
|
||||||
'goods_list2' => $goodsDtoList2,
|
'goods_list2' => $goodsDtoList2,
|
||||||
)
|
)
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buyGoods()
|
public function buyGoods()
|
||||||
@ -345,8 +373,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
$buyRecordHash = ShopBuyRecord::allToHash();
|
$buyRecordHash = ShopBuyRecord::allToHash();
|
||||||
$boughtTimes = 1;
|
$boughtTimes = 1;
|
||||||
switch ($itemMeta['limit_type']) {
|
switch ($itemMeta['limit_type']) {
|
||||||
case mt\Item::DAILY_BUY_LIMIT:
|
case mt\Item::DAILY_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $itemMeta['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $itemMeta['limit_num']) {
|
||||||
@ -359,8 +386,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::WEEKLY_BUY_LIMIT:
|
case mt\Item::WEEKLY_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $itemMeta['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $itemMeta['limit_num']) {
|
||||||
@ -373,8 +399,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::TOTAL_BUY_LIMIT:
|
case mt\Item::TOTAL_BUY_LIMIT: {
|
||||||
{
|
|
||||||
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
$buyRecord = getXVal($buyRecordHash, $itemMeta['id']);
|
||||||
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
|
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1;
|
||||||
if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $itemMeta['limit_num']) {
|
if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $itemMeta['limit_num']) {
|
||||||
@ -387,12 +412,10 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
} {
|
||||||
{
|
|
||||||
$errCode = 0;
|
$errCode = 0;
|
||||||
$errMsg = '';
|
$errMsg = '';
|
||||||
if (!$this->canBuy($itemMeta, $errCode, $errMsg)) {
|
if (!$this->canBuy($itemMeta, $errCode, $errMsg)) {
|
||||||
@ -433,28 +456,30 @@ class ShopController extends BaseAuthedController {
|
|||||||
'limit_type' => $itemMeta['limit_type'],
|
'limit_type' => $itemMeta['limit_type'],
|
||||||
'bought_times' => $boughtTimes,
|
'bought_times' => $boughtTimes,
|
||||||
'total_buy_times' => $itemMeta['limit_num'],
|
'total_buy_times' => $itemMeta['limit_num'],
|
||||||
);
|
); {
|
||||||
{
|
|
||||||
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
||||||
if (!empty($priceInfo)) {
|
if (!empty($priceInfo)) {
|
||||||
$goodsDto['price_info'] = $priceInfo['price_info'];
|
$goodsDto['price_info'] = $priceInfo['price_info'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$this->_rspData(array(
|
$this->_rspData(
|
||||||
|
array(
|
||||||
'award' => $awardService->toDto(),
|
'award' => $awardService->toDto(),
|
||||||
'property_chg' => $propertyChgService->toDto(),
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
'goods_chg' => $goodsDto
|
'goods_chg' => $goodsDto
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDiscountList()
|
public function getDiscountList()
|
||||||
{
|
{
|
||||||
$items = array();
|
$items = array(); {
|
||||||
{
|
$types = array(
|
||||||
$types = array(mt\Item::HERO_TYPE,
|
mt\Item::HERO_TYPE,
|
||||||
mt\Item::HERO_SKIN_TYPE,
|
mt\Item::HERO_SKIN_TYPE,
|
||||||
mt\Item::GUN_SKIN_TYPE);
|
mt\Item::GUN_SKIN_TYPE
|
||||||
|
);
|
||||||
mt\Item::filter(function ($meta) use (&$items, &$types) {
|
mt\Item::filter(function ($meta) use (&$items, &$types) {
|
||||||
if (mt\Item::inTypes($meta, $types)) {
|
if (mt\Item::inTypes($meta, $types)) {
|
||||||
array_push($items, $meta);
|
array_push($items, $meta);
|
||||||
@ -475,13 +500,11 @@ class ShopController extends BaseAuthedController {
|
|||||||
foreach ($costGroup as $cost) {
|
foreach ($costGroup as $cost) {
|
||||||
if ($cost['discount'] > 0) {
|
if ($cost['discount'] > 0) {
|
||||||
switch ($cost['item_id']) {
|
switch ($cost['item_id']) {
|
||||||
case V_ITEM_GOLD:
|
case V_ITEM_GOLD: {
|
||||||
{
|
|
||||||
$goodsDto['gold_discount'] = $cost['discount'];
|
$goodsDto['gold_discount'] = $cost['discount'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case V_ITEM_DIAMOND:
|
case V_ITEM_DIAMOND: {
|
||||||
{
|
|
||||||
$goodsDto['diamond_discount'] = $cost['discount'];
|
$goodsDto['diamond_discount'] = $cost['discount'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -494,9 +517,11 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$this->_rspData(array(
|
$this->_rspData(
|
||||||
|
array(
|
||||||
'goods_list' => $goodsDtoList,
|
'goods_list' => $goodsDtoList,
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function outsideBuy($shopId, $itemId, $itemNum, $costItemId)
|
private function outsideBuy($shopId, $itemId, $itemNum, $costItemId)
|
||||||
@ -516,14 +541,15 @@ class ShopController extends BaseAuthedController {
|
|||||||
$this->_rspErr(1, 'cost_item_id parameter error');
|
$this->_rspErr(1, 'cost_item_id parameter error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$types = array(mt\Item::HERO_TYPE,
|
$types = array(
|
||||||
|
mt\Item::HERO_TYPE,
|
||||||
mt\Item::HERO_SKIN_TYPE,
|
mt\Item::HERO_SKIN_TYPE,
|
||||||
mt\Item::GUN_SKIN_TYPE);
|
mt\Item::GUN_SKIN_TYPE
|
||||||
|
);
|
||||||
if (!mt\Item::inTypes($itemMeta, $types)) {
|
if (!mt\Item::inTypes($itemMeta, $types)) {
|
||||||
$this->_rspErr(1, 'item_id parameter error');
|
$this->_rspErr(1, 'item_id parameter error');
|
||||||
return;
|
return;
|
||||||
}
|
} {
|
||||||
{
|
|
||||||
$errCode = 0;
|
$errCode = 0;
|
||||||
$errMsg = '';
|
$errMsg = '';
|
||||||
if (!$this->canBuy($itemMeta, $errCode, $errMsg)) {
|
if (!$this->canBuy($itemMeta, $errCode, $errMsg)) {
|
||||||
@ -564,28 +590,30 @@ class ShopController extends BaseAuthedController {
|
|||||||
'limit_type' => $itemMeta['limit_type'],
|
'limit_type' => $itemMeta['limit_type'],
|
||||||
'bought_times' => 0,
|
'bought_times' => 0,
|
||||||
'total_buy_times' => $itemMeta['limit_num'],
|
'total_buy_times' => $itemMeta['limit_num'],
|
||||||
);
|
); {
|
||||||
{
|
|
||||||
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
||||||
if (!empty($priceInfo)) {
|
if (!empty($priceInfo)) {
|
||||||
$goodsDto['price_info'] = $priceInfo;
|
$goodsDto['price_info'] = $priceInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$this->_rspData(array(
|
$this->_rspData(
|
||||||
|
array(
|
||||||
'award' => $awardService->toDto(),
|
'award' => $awardService->toDto(),
|
||||||
'property_chg' => $propertyChgService->toDto(),
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
'goods_chg' => $goodsDto
|
'goods_chg' => $goodsDto
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getOutsideShopInfo()
|
private function getOutsideShopInfo()
|
||||||
{
|
{
|
||||||
$items = array();
|
$items = array(); {
|
||||||
{
|
$types = array(
|
||||||
$types = array(mt\Item::HERO_TYPE,
|
mt\Item::HERO_TYPE,
|
||||||
mt\Item::HERO_SKIN_TYPE,
|
mt\Item::HERO_SKIN_TYPE,
|
||||||
mt\Item::GUN_SKIN_TYPE);
|
mt\Item::GUN_SKIN_TYPE
|
||||||
|
);
|
||||||
mt\Item::filter(function ($meta) use (&$items, &$types) {
|
mt\Item::filter(function ($meta) use (&$items, &$types) {
|
||||||
if (mt\Item::inTypes($meta, $types)) {
|
if (mt\Item::inTypes($meta, $types)) {
|
||||||
array_push($items, $meta);
|
array_push($items, $meta);
|
||||||
@ -611,13 +639,15 @@ class ShopController extends BaseAuthedController {
|
|||||||
array_push($goodsDtoList1, $goodsDto);
|
array_push($goodsDtoList1, $goodsDto);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$this->_rspData(array(
|
$this->_rspData(
|
||||||
|
array(
|
||||||
'info' => array(
|
'info' => array(
|
||||||
'shop_id' => mt\Shop::OUTSIDE_SHOP,
|
'shop_id' => mt\Shop::OUTSIDE_SHOP,
|
||||||
'goods_list1' => $goodsDtoList1,
|
'goods_list1' => $goodsDtoList1,
|
||||||
'goods_list2' => $goodsDtoList2,
|
'goods_list2' => $goodsDtoList2,
|
||||||
)
|
)
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCostItems($priceInfo, $costItemId)
|
private function getCostItems($priceInfo, $costItemId)
|
||||||
@ -637,19 +667,22 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
$costItems = array();
|
$costItems = array();
|
||||||
array_walk($costGroup, function ($val) use (&$costItems, $priceInfo) {
|
array_walk($costGroup, function ($val) use (&$costItems, $priceInfo) {
|
||||||
if ($val['discount'] > 0 &&
|
if (
|
||||||
|
$val['discount'] > 0 &&
|
||||||
$this->_getNowTime() >= $priceInfo['discount_begin_time'] &&
|
$this->_getNowTime() >= $priceInfo['discount_begin_time'] &&
|
||||||
$this->_getNowTime() <= $priceInfo['discount_end_time']
|
$this->_getNowTime() <= $priceInfo['discount_end_time']
|
||||||
) {
|
) {
|
||||||
array_push($costItems, array(
|
array_push($costItems, array(
|
||||||
'item_id' => $val['item_id'],
|
'item_id' => $val['item_id'],
|
||||||
'item_num' => (int) ($val['item_num'] * ($priceInfo['discount'] / 100)),
|
'item_num' => (int) ($val['item_num'] * ($priceInfo['discount'] / 100)),
|
||||||
));
|
)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
array_push($costItems, array(
|
array_push($costItems, array(
|
||||||
'item_id' => $val['item_id'],
|
'item_id' => $val['item_id'],
|
||||||
'item_num' => $val['item_num'],
|
'item_num' => $val['item_num'],
|
||||||
));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return $costItems;
|
return $costItems;
|
||||||
@ -658,33 +691,28 @@ class ShopController extends BaseAuthedController {
|
|||||||
private function internalAddItem($propertyChgService, $itemMeta)
|
private function internalAddItem($propertyChgService, $itemMeta)
|
||||||
{
|
{
|
||||||
switch ($itemMeta['type']) {
|
switch ($itemMeta['type']) {
|
||||||
case mt\Item::HERO_TYPE:
|
case mt\Item::HERO_TYPE: {
|
||||||
{
|
|
||||||
Hero::addHero($itemMeta);
|
Hero::addHero($itemMeta);
|
||||||
$propertyChgService->addHeroChg();
|
$propertyChgService->addHeroChg();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::HERO_SKIN_TYPE:
|
case mt\Item::HERO_SKIN_TYPE: {
|
||||||
{
|
|
||||||
HeroSkin::addSkin($itemMeta);
|
HeroSkin::addSkin($itemMeta);
|
||||||
$propertyChgService->addHeroSkinChg();
|
$propertyChgService->addHeroSkinChg();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::GUN_TYPE:
|
case mt\Item::GUN_TYPE: {
|
||||||
{
|
|
||||||
Gun::addGun($itemMeta);
|
Gun::addGun($itemMeta);
|
||||||
$propertyChgService->addGunChg();
|
$propertyChgService->addGunChg();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::GUN_SKIN_TYPE:
|
case mt\Item::GUN_SKIN_TYPE: {
|
||||||
{
|
|
||||||
GunSkin::addSkin($itemMeta);
|
GunSkin::addSkin($itemMeta);
|
||||||
$propertyChgService->addGunSkinChg();
|
$propertyChgService->addGunSkinChg();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
Bag::addItem($itemMeta['id'], 1);
|
Bag::addItem($itemMeta['id'], 1);
|
||||||
$propertyChgService->addBagChg();
|
$propertyChgService->addBagChg();
|
||||||
}
|
}
|
||||||
@ -697,8 +725,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
$errCode = 0;
|
$errCode = 0;
|
||||||
$errMsg = '';
|
$errMsg = '';
|
||||||
switch ($itemMeta['type']) {
|
switch ($itemMeta['type']) {
|
||||||
case mt\Item::HERO_TYPE:
|
case mt\Item::HERO_TYPE: {
|
||||||
{
|
|
||||||
$heroDb = Hero::find($itemMeta['id']);
|
$heroDb = Hero::find($itemMeta['id']);
|
||||||
if ($heroDb) {
|
if ($heroDb) {
|
||||||
$errCode = 10;
|
$errCode = 10;
|
||||||
@ -707,8 +734,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::HERO_SKIN_TYPE:
|
case mt\Item::HERO_SKIN_TYPE: {
|
||||||
{
|
|
||||||
$heroSkinDb = HeroSkin::find($itemMeta['id']);
|
$heroSkinDb = HeroSkin::find($itemMeta['id']);
|
||||||
if ($heroSkinDb) {
|
if ($heroSkinDb) {
|
||||||
$errCode = 10;
|
$errCode = 10;
|
||||||
@ -717,8 +743,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::GUN_SKIN_TYPE:
|
case mt\Item::GUN_SKIN_TYPE: {
|
||||||
{
|
|
||||||
$gunSkinDb = GunSkin::find($itemMeta['id']);
|
$gunSkinDb = GunSkin::find($itemMeta['id']);
|
||||||
if ($gunSkinDb) {
|
if ($gunSkinDb) {
|
||||||
$errCode = 10;
|
$errCode = 10;
|
||||||
@ -727,8 +752,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user