1
This commit is contained in:
parent
2830888059
commit
948b811756
@ -26,6 +26,7 @@ class SeasonCard(object):
|
|||||||
'url': 'webapp/index.php?c=SeasonCard&a=getReward',
|
'url': 'webapp/index.php?c=SeasonCard&a=getReward',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
|
['type', 0, '1:普通 2:精英'],
|
||||||
['level', 0, '手册等级'],
|
['level', 0, '手册等级'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
@ -56,7 +57,8 @@ class SeasonCard(object):
|
|||||||
'url': 'webapp/index.php?c=SeasonCard&a=buyGiftPackage',
|
'url': 'webapp/index.php?c=SeasonCard&a=buyGiftPackage',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['pacakge_id', 0, '礼包id(1:普通礼包 2:豪华礼包)'],
|
['package_id', 0, '礼包id(1:普通礼包 2:豪华礼包)'],
|
||||||
|
['cost_item_id', 0, '支付方式'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
@ -226,6 +226,7 @@ class SeasonCardGiftPackage(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.fields = [
|
self.fields = [
|
||||||
['package_id', 0, '礼包id'],
|
['package_id', 0, '礼包id'],
|
||||||
|
['item_id', 0, '礼包道具表id(目前客户端没用到先不用管)'],
|
||||||
['state', 0, '0:未购买 1:已购买'],
|
['state', 0, '0:未购买 1:已购买'],
|
||||||
['price_info', PriceInfo(), '价格信息'],
|
['price_info', PriceInfo(), '价格信息'],
|
||||||
]
|
]
|
||||||
|
@ -214,6 +214,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
$heads = array();
|
$heads = array();
|
||||||
$headFrames = array();
|
$headFrames = array();
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
$awardService->addItem($item['item_id'], $item['item_num']);
|
||||||
if ($this->_isVirtualItem($item['item_id'])) {
|
if ($this->_isVirtualItem($item['item_id'])) {
|
||||||
$this->_addVirtualItem($item['item_id'], $item['item_num']);
|
$this->_addVirtualItem($item['item_id'], $item['item_num']);
|
||||||
$propertyService->addUserChg();
|
$propertyService->addUserChg();
|
||||||
@ -275,8 +276,8 @@ class BaseAuthedController extends BaseController {
|
|||||||
}//end foreach
|
}//end foreach
|
||||||
if (!empty($heads) || !empty($headFrames)) {
|
if (!empty($heads) || !empty($headFrames)) {
|
||||||
$userInfo = $this->_getOrmUserInfo();
|
$userInfo = $this->_getOrmUserInfo();
|
||||||
$headsDb = emptyReplae(json_decode($userInfo['head_list'], true), array());
|
$headsDb = emptyReplace(json_decode($userInfo['head_list'], true), array());
|
||||||
$headFramesDb = emptyReplae(json_decode($userInfo['head_frame_list'], true), array());
|
$headFramesDb = emptyReplace(json_decode($userInfo['head_frame_list'], true), array());
|
||||||
$heads = array_unique(array_merge($heads, $headsDb));
|
$heads = array_unique(array_merge($heads, $headsDb));
|
||||||
$headFrames = array_unique(array_merge($headFrames, $headFramesDb));
|
$headFrames = array_unique(array_merge($headFrames, $headFramesDb));
|
||||||
$this->_updateUserInfo(array(
|
$this->_updateUserInfo(array(
|
||||||
@ -333,8 +334,8 @@ class BaseAuthedController extends BaseController {
|
|||||||
if (!$itemMeta) {
|
if (!$itemMeta) {
|
||||||
return '道具不足';
|
return '道具不足';
|
||||||
}
|
}
|
||||||
if (SERVER_ENV != __ONLINE) {
|
if (SERVER_ENV != _ONLINE) {
|
||||||
return "${itemMeta['name']}不足 库存:${itemMeta['inventory']} 需求:${itemMeta['item_num']}";
|
return "${itemMeta['name']}不足 库存:${lackItem['inventory']} 需求:${lackItem['item_num']}";
|
||||||
} else {
|
} else {
|
||||||
return "${itemMeta['name']}不足";
|
return "${itemMeta['name']}不足";
|
||||||
}
|
}
|
||||||
@ -344,7 +345,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
{
|
{
|
||||||
$itemIds = explode('|', $dropMeta['item_id']);
|
$itemIds = explode('|', $dropMeta['item_id']);
|
||||||
$nums = explode('|', $dropMeta['num']);
|
$nums = explode('|', $dropMeta['num']);
|
||||||
$weights = explode('|', $dropMeta['weights']);
|
$weights = explode('|', $dropMeta['weight']);
|
||||||
if (count($itemIds) != count($nums) ||
|
if (count($itemIds) != count($nums) ||
|
||||||
count($itemIds) != count($weights)) {
|
count($itemIds) != count($weights)) {
|
||||||
return;
|
return;
|
||||||
@ -393,7 +394,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'drop_source' => $dropSource,
|
'drop_source' => $dropSource,
|
||||||
'drop_id' => $dropMeta['id'],
|
'drop_id' => $dropMeta['drop_id'],
|
||||||
'drop_items' => json_encode($addItems),
|
'drop_items' => json_encode($addItems),
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime()
|
'modifytime' => myself()->_getNowTime()
|
||||||
@ -407,10 +408,10 @@ class BaseAuthedController extends BaseController {
|
|||||||
'account_id' => $this->_getAccountId(),
|
'account_id' => $this->_getAccountId(),
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'subtype' => $subtype,
|
'subtype' => $subtype,
|
||||||
'param1' => getXVale($params, 'param1', ''),
|
'param1' => getXVal($params, 'param1', ''),
|
||||||
'param2' => getXVale($params, 'param2', ''),
|
'param2' => getXVal($params, 'param2', ''),
|
||||||
'param3' => getXVale($params, 'param3', ''),
|
'param3' => getXVal($params, 'param3', ''),
|
||||||
'param4' => getXVale($params, 'param4', ''),
|
'param4' => getXVal($params, 'param4', ''),
|
||||||
'createtime' => myself()->_getNowTime(),
|
'createtime' => myself()->_getNowTime(),
|
||||||
'modifytime' => myself()->_getNowTime()
|
'modifytime' => myself()->_getNowTime()
|
||||||
);
|
);
|
||||||
|
@ -5,6 +5,7 @@ require_once('models/Hero.php');
|
|||||||
require_once('models/Season.php');
|
require_once('models/Season.php');
|
||||||
require_once('models/SeasonCard.php');
|
require_once('models/SeasonCard.php');
|
||||||
|
|
||||||
|
require_once('mt/Item.php');
|
||||||
require_once('mt/Parameter.php');
|
require_once('mt/Parameter.php');
|
||||||
require_once('mt/Drop.php');
|
require_once('mt/Drop.php');
|
||||||
require_once('mt/Season.php');
|
require_once('mt/Season.php');
|
||||||
@ -39,7 +40,7 @@ class SeasonCardController extends BaseAuthedController {
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
$this->propertyChgService = new services\PropertyChgService();
|
$this->propertyChgService = new services\PropertyChgService();
|
||||||
$this->awardService = new services\AwardChgService();
|
$this->awardService = new services\AwardService();
|
||||||
$this->userInfo = $this->_safeGetOrmUserInfo();
|
$this->userInfo = $this->_safeGetOrmUserInfo();
|
||||||
$this->seasonService = new services\SeasonService();
|
$this->seasonService = new services\SeasonService();
|
||||||
if (!$this->seasonService->checkSeason($this->userInfo)) {
|
if (!$this->seasonService->checkSeason($this->userInfo)) {
|
||||||
@ -82,22 +83,30 @@ class SeasonCardController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function getReward()
|
public function getReward()
|
||||||
{
|
{
|
||||||
|
$type = getReqVal('type', 0);
|
||||||
$level = getReqVal('level', 0);
|
$level = getReqVal('level', 0);
|
||||||
$cardMeta = mt\SeasonCard::get($level);
|
$cardMeta = mt\SeasonCard::get($level);
|
||||||
if ($level) {
|
if ($level) {
|
||||||
$this->_rspErr(1, 'level参数错误');
|
$this->_rspErr(1, 'level参数错误');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!in_array($type, array(
|
||||||
|
SeasonCard::NORMAL_PACKAGE_ID,
|
||||||
|
SeasonCard::VIP_PACKAGE_ID
|
||||||
|
))) {
|
||||||
|
$this->_rspErr(1, 'type参数错误');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($level > $this->seasonDb['card_lv']) {
|
if ($level > $this->seasonDb['card_lv']) {
|
||||||
$this->_rspErr(2, '等级未解锁不可领取');
|
$this->_rspErr(2, '等级未解锁不可领取');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$cardDb = getXVal($this->seasonCardDb, $level);
|
$cardDb = getXVal($this->seasonCardDb[$type], $level);
|
||||||
if ($cardDd) {
|
if ($cardDd) {
|
||||||
$this->_rspErr(3, '不能重复领取');
|
$this->_rspErr(3, '不能重复领取');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SeasonCard::add($this->currSeasonMeta['id'], $level);
|
SeasonCard::add($this->currSeasonMeta['id'], $type, $level);
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'award' => $this->awardService->toDto(),
|
'award' => $this->awardService->toDto(),
|
||||||
'property_chg' => $this->propertyChgService->toDto(),
|
'property_chg' => $this->propertyChgService->toDto(),
|
||||||
@ -150,12 +159,12 @@ class SeasonCardController extends BaseAuthedController {
|
|||||||
$this->_rspErr(2, '不能重复购买');
|
$this->_rspErr(2, '不能重复购买');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$priceInfo = $giftPackage['priceInfo'];
|
$priceInfo = $giftPackage['price_info'];
|
||||||
if (empty($priceInfo)) {
|
if (empty($priceInfo)) {
|
||||||
$this->_rspErr(3, '配置表错误');
|
$this->_rspErr(3, '配置表错误');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$itemMeta = mt\Item::get($priceInfo['item_id']);
|
$itemMeta = mt\Item::get($giftPackage['item_id']);
|
||||||
if (empty($itemMeta)) {
|
if (empty($itemMeta)) {
|
||||||
$this->_rspErr(3, '配置表错误1');
|
$this->_rspErr(3, '配置表错误1');
|
||||||
return;
|
return;
|
||||||
@ -165,7 +174,7 @@ class SeasonCardController extends BaseAuthedController {
|
|||||||
$this->_rspErr(3, '配置表错误3');
|
$this->_rspErr(3, '配置表错误3');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$costItems = $this->getCostItems($priceInfo, $costItemId);
|
$costItems = mt\Item::getCostItems($priceInfo, $costItemId);
|
||||||
if (empty($costItems)) {
|
if (empty($costItems)) {
|
||||||
$this->_rspErr(3, '配置表错误2');
|
$this->_rspErr(3, '配置表错误2');
|
||||||
return;
|
return;
|
||||||
@ -192,9 +201,12 @@ class SeasonCardController extends BaseAuthedController {
|
|||||||
$itemMeta = mt\Item::get(SeasonCard::VIP_PACKAGE_ITEM_ID);
|
$itemMeta = mt\Item::get(SeasonCard::VIP_PACKAGE_ITEM_ID);
|
||||||
$priceInfo = $itemMeta ? mt\Item::getPriceInfo($itemMeta) : null;
|
$priceInfo = $itemMeta ? mt\Item::getPriceInfo($itemMeta) : null;
|
||||||
$giftPackages = array(
|
$giftPackages = array(
|
||||||
'package_id' => SeasonCard::VIP_PACKAGE_ID,
|
array(
|
||||||
'state' => $this->seasonDb['gift_state2'],
|
'package_id' => SeasonCard::VIP_PACKAGE_ID,
|
||||||
'price_info' => $priceInfo
|
'item_id' => SeasonCard::VIP_PACKAGE_ITEM_ID,
|
||||||
|
'state' => $this->seasonDb['gift_state2'],
|
||||||
|
'price_info' => $priceInfo ? $priceInfo['price_info'] : null
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return $giftPackages;
|
return $giftPackages;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
||||||
if (!empty($priceInfo)) {
|
if (!empty($priceInfo)) {
|
||||||
$goodsDto['price_info'] = $priceInfo;
|
$goodsDto['price_info'] = $priceInfo['price_info'];
|
||||||
array_push($goodsDtoList1, $goodsDto);
|
array_push($goodsDtoList1, $goodsDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
{
|
{
|
||||||
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
||||||
if (!empty($priceInfo)) {
|
if (!empty($priceInfo)) {
|
||||||
$goodsDto['price_info'] = $priceInfo;
|
$goodsDto['price_info'] = $priceInfo['price_info'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
@ -389,7 +389,7 @@ class ShopController extends BaseAuthedController {
|
|||||||
);
|
);
|
||||||
$priceInfo = mt\Item::getPriceInfo($val);
|
$priceInfo = mt\Item::getPriceInfo($val);
|
||||||
if (!empty($priceInfo)) {
|
if (!empty($priceInfo)) {
|
||||||
$goodsDto['price_info'] = $priceInfo;
|
$goodsDto['price_info'] = $priceInfo['price_info'];
|
||||||
array_push($goodsDtoList1, $goodsDto);
|
array_push($goodsDtoList1, $goodsDto);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -134,6 +134,41 @@ class Item {
|
|||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getCostItems($priceInfo, $costItemId)
|
||||||
|
{
|
||||||
|
$costGroup = null;
|
||||||
|
array_walk($priceInfo['cost_list'], function ($val) use(&$costGroup, $costItemId) {
|
||||||
|
if ($costGroup) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (count($val) > 0 && $val[0]['item_id'] == $costItemId) {
|
||||||
|
$costGroup = $val;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!$costGroup) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$costItems = array();
|
||||||
|
array_walk($costGroup, function ($val) use (&$costItems, $priceInfo) {
|
||||||
|
if ($val['discount'] > 0 &&
|
||||||
|
myself()->_getNowTime() >= $priceInfo['discount_begin_time'] &&
|
||||||
|
myself()->_getNowTime() <= $priceInfo['discount_end_time']
|
||||||
|
) {
|
||||||
|
array_push($costItems, array(
|
||||||
|
'item_id' => $val['item_id'],
|
||||||
|
'item_num' => (int)($val['item_num'] * ($priceInfo['discount'] / 100)),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
array_push($costItems, array(
|
||||||
|
'item_id' => $val['item_id'],
|
||||||
|
'item_num' => $val['item_num'],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $costItems;
|
||||||
|
}
|
||||||
|
|
||||||
public static function isBagItem($type, $subType)
|
public static function isBagItem($type, $subType)
|
||||||
{
|
{
|
||||||
return in_array($type, array(
|
return in_array($type, array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user