1
This commit is contained in:
parent
a2aebe000f
commit
c685808f5e
@ -101,7 +101,8 @@ class PropertyChg(object):
|
||||
|
||||
def __init__(self):
|
||||
self.fields = [
|
||||
['user_info', UserInfo(), '用户信息变更(用来更新本地客户端字段(有则更新无则不变))']
|
||||
['user_info', UserInfo(), '用户信息变更(用来更新本地客户端字段(有则更新无则不变))'],
|
||||
['!container_chg', [''], '容器类数据变更(bag、hero、heroSkin、gunSkin)']
|
||||
]
|
||||
|
||||
class CostInfoItem(object):
|
||||
|
@ -7,6 +7,8 @@ require_once('models/GunSkin.php');
|
||||
require_once('models/GunTalent.php');
|
||||
require_once('models/User.php');
|
||||
|
||||
require_once('services/PropertyChgService.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\GunSkin;
|
||||
use models\GunTalent;
|
||||
@ -84,10 +86,10 @@ class GunController extends BaseAuthedController {
|
||||
}
|
||||
$this->_decItems($costList);
|
||||
GunTalent::upgradeLv($typeId, $talentId, $currLv + 1);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addUserChg();
|
||||
$this->_rspData(array(
|
||||
'property_chg' => array(
|
||||
'user_info' => User::info($this->_getOrmUserInfo())
|
||||
)
|
||||
'property_chg' => $propertyChgService->toDto()
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ require_once('models/GunSkin.php');
|
||||
require_once('models/ShopBuyRecord.php');
|
||||
|
||||
require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\User;
|
||||
@ -110,6 +111,7 @@ class ShopController extends BaseAuthedController {
|
||||
return;
|
||||
}
|
||||
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$itemMeta = mt\Item::get($itemId);
|
||||
if (!$itemMeta) {
|
||||
$this->_rspErr(1, 'goods_id参数错误');
|
||||
@ -218,11 +220,10 @@ class ShopController extends BaseAuthedController {
|
||||
$goodsDto['price_info'] = $priceInfo;
|
||||
}
|
||||
}
|
||||
$propertyChgService->addUserChg();
|
||||
$this->rspData(array(
|
||||
'award' => $awardService->toDto(),
|
||||
'property_chg' => array(
|
||||
'user_info' => User::info($this->_getOrmUserInfo())
|
||||
),
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
'goods_chg' => $goodsDto
|
||||
));
|
||||
}
|
||||
@ -278,6 +279,7 @@ class ShopController extends BaseAuthedController {
|
||||
|
||||
private function outsideBuy($shopId, $itemId, $itemNum, $costItemId)
|
||||
{
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$itemMeta = mt\Item::get($itemId);
|
||||
if (!$itemMeta) {
|
||||
$this->_rspErr(1, 'item_id参数错误');
|
||||
@ -347,11 +349,10 @@ class ShopController extends BaseAuthedController {
|
||||
$goodsDto['price_info'] = $priceInfo;
|
||||
}
|
||||
}
|
||||
$propertyChgService->addUserChg();
|
||||
$this->_rspData(array(
|
||||
'award' => $awardService->toDto(),
|
||||
'property_chg' => array(
|
||||
'user_info' => User::info($this->_getOrmUserInfo())
|
||||
),
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
'goods_chg' => $goodsDto
|
||||
));
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ require_once('mt/Equip.php');
|
||||
require_once('mt/Player.php');
|
||||
require_once('mt/Robot.php');
|
||||
|
||||
require_once('services/PropertyChgService.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\User;
|
||||
use models\Hero;
|
||||
@ -138,10 +140,10 @@ class UserController extends BaseAuthedController {
|
||||
if (count($fieldsKv) > 0) {
|
||||
$this->_updateUserInfo($fieldsKv);
|
||||
}
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addUserChg();
|
||||
$this->_rspData(array(
|
||||
'property_chg' => array(
|
||||
'user_info' => User::info($this->_getOrmUserInfo())
|
||||
)
|
||||
'property_chg' => $propertyChgService->toDto()
|
||||
));
|
||||
}
|
||||
|
||||
|
57
webapp/services/PropertyChgService.php
Normal file
57
webapp/services/PropertyChgService.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace services;
|
||||
|
||||
require_once('models/User.php');
|
||||
|
||||
use models\User;
|
||||
|
||||
class PropertyChgService extends BaseService {
|
||||
|
||||
private $chgList = array();
|
||||
private $userChg = false;
|
||||
|
||||
public function addUserChg()
|
||||
{
|
||||
$this->userChg = true;
|
||||
}
|
||||
|
||||
public function addHeroChg()
|
||||
{
|
||||
$this->internalAddChg('hero');
|
||||
}
|
||||
|
||||
public function addHeroSkinChg()
|
||||
{
|
||||
$this->internalAddChg('heroSkin');
|
||||
}
|
||||
|
||||
public function addGunSkinChg()
|
||||
{
|
||||
$this->internalAddChg('gunSkin');
|
||||
}
|
||||
|
||||
public function addBagChg()
|
||||
{
|
||||
$this->internalAddChg('bag');
|
||||
}
|
||||
|
||||
public function toDto()
|
||||
{
|
||||
return array(
|
||||
'user_info' => $this->userChg ? User::info(myself()->_getOrmUserInfo()) : array(),
|
||||
'container_chg' => $this->chgList
|
||||
);
|
||||
}
|
||||
|
||||
private function internalAddChg($name)
|
||||
{
|
||||
foreach ($chgLlist as $item) {
|
||||
if ($item == $name) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
array_push($chgList, $name);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user