1
This commit is contained in:
parent
6a31c180f8
commit
a49918b880
@ -420,7 +420,7 @@ class HeroController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
$response = services\BlockChainService::gameItemMallBuy(
|
$response = services\BlockChainService::gameItemMallBuy(
|
||||||
Transaction::RESET_HERO_LEVEL_TYPE, services\BlockChainService::formatCurrency($price), V_ITEM_RESET_CARD, 1);
|
Transaction::RESET_HERO_LEVEL_TYPE, services\BlockChainService::formatCurrency($price), V_ITEM_RESET_CARD, 1);
|
||||||
$this->_setV(TN_DAILY_RESET_HERO_LEVEL_STATE, $hero_unnid, 1);
|
$this->_setV(TN_DAILY_RESET_HERO_LEVEL_STATE, intval($hero_unnid), 1);
|
||||||
BcOrder::upsert($response['trans_id'], array(
|
BcOrder::upsert($response['trans_id'], array(
|
||||||
'item_id' => V_ITEM_RESET_CARD,
|
'item_id' => V_ITEM_RESET_CARD,
|
||||||
'item_num' => 1,
|
'item_num' => 1,
|
||||||
|
@ -69,7 +69,7 @@ class BuyPassCbService
|
|||||||
'hero_unnid' => json_decode($order['ext_data']),
|
'hero_unnid' => json_decode($order['ext_data']),
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
$this->_resetHeroLevel($order);
|
$this->_resetHeroLevel($order,$itemService);
|
||||||
error_log("callback resetHeroLevel address: {$order['address']}, order_id: {$order['order_id']}, item_id: {$order['item_id']}, item_num: {$order['item_num']}");
|
error_log("callback resetHeroLevel address: {$order['address']}, order_id: {$order['order_id']}, item_id: {$order['item_id']}, item_num: {$order['item_num']}");
|
||||||
$itemService->addGameLog($order['address'],"resetHero","end",array(
|
$itemService->addGameLog($order['address'],"resetHero","end",array(
|
||||||
'param1' => $order['order_id'],
|
'param1' => $order['order_id'],
|
||||||
@ -86,7 +86,7 @@ class BuyPassCbService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _resetHeroLevel($order){
|
private function _resetHeroLevel($order,$addItemService){
|
||||||
$heroDb = SqlHelper::ormSelectOne(
|
$heroDb = SqlHelper::ormSelectOne(
|
||||||
myself()->_getMysql($order['address']),
|
myself()->_getMysql($order['address']),
|
||||||
't_hero',
|
't_hero',
|
||||||
@ -122,35 +122,12 @@ class BuyPassCbService
|
|||||||
'rand_attr' => $heroDb['base_attr'],
|
'rand_attr' => $heroDb['base_attr'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$conn = myself()->_getMysql($order['address']);
|
$addItemService->addItem($order['address'],$piece_item_id,$piece);
|
||||||
$this->_addBagItem($conn,$order['account_id'],$piece_item_id,$piece);
|
$addItemService->addItem($order['address'],V_ITEM_HERO_META,$serum);
|
||||||
$this->_addBagItem($conn,$order['account_id'],V_ITEM_HERO_META,$serum);
|
$addItemService->addItem($order['address'],V_ITEM_GOLD,$gold);
|
||||||
$this->_addBagItem($conn,$order['account_id'],V_ITEM_GOLD,$gold);
|
|
||||||
$this->_updateDynData($order,TN_DAILY_RESET_HERO_LEVEL_STATE,json_decode($order['ext_data']));
|
$this->_updateDynData($order,TN_DAILY_RESET_HERO_LEVEL_STATE,json_decode($order['ext_data']));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _addBagItem($conn,$accountId,$itemId,$itemNum){
|
|
||||||
SqlHelper::upsert
|
|
||||||
($conn,
|
|
||||||
't_bag',
|
|
||||||
array(
|
|
||||||
'account_id' => $accountId,
|
|
||||||
'item_id' => $itemId
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'item_num' => function () use($itemNum) { return "item_num + {$itemNum}";},
|
|
||||||
'modifytime' => myself()->_getNowTime(),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'account_id' => $accountId,
|
|
||||||
'item_id' => $itemId,
|
|
||||||
'item_num' => $itemNum,
|
|
||||||
'createtime' => myself()->_getNowTime(),
|
|
||||||
'modifytime' => myself()->_getNowTime()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function _activateUser($address){
|
private function _activateUser($address){
|
||||||
SqlHelper::update
|
SqlHelper::update
|
||||||
(myself()->_getMysql($address),
|
(myself()->_getMysql($address),
|
||||||
@ -209,6 +186,8 @@ class BuyPassCbService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function _updateDynData($user,$x,$y){
|
private function _updateDynData($user,$x,$y){
|
||||||
|
$x = intval($x) ;
|
||||||
|
$y = intval($y) ;
|
||||||
SqlHelper::update
|
SqlHelper::update
|
||||||
( myself()->_getMysql($user['address']),
|
( myself()->_getMysql($user['address']),
|
||||||
't_dyndata',
|
't_dyndata',
|
||||||
|
@ -40,31 +40,36 @@ class ShopAddItemService
|
|||||||
}
|
}
|
||||||
$accountId = $this->getAccountId($address);
|
$accountId = $this->getAccountId($address);
|
||||||
$conn = myself()->_getMysql($address);
|
$conn = myself()->_getMysql($address);
|
||||||
if (\mt\Item::isBagItem($itemMeta['type'], $itemMeta['sub_type'])) {
|
if ($this->_isVirtualItem($itemId)) {
|
||||||
$this->internalAddBag($conn,$itemId,$itemNum,$accountId);
|
$this->_addVirtualItem($conn,$accountId,$itemId, $itemNum);
|
||||||
}else{
|
}else{
|
||||||
for ($i = 0; $i < $itemNum; $i++) {
|
if (\mt\Item::isBagItem($itemMeta['type'], $itemMeta['sub_type'])) {
|
||||||
switch ($itemMeta['type']){
|
$this->internalAddBag($conn,$itemId,$itemNum,$accountId);
|
||||||
case \mt\Item::HERO_TYPE : {
|
}else{
|
||||||
$this->internalAddHero($conn,$itemMeta,$accountId);
|
for ($i = 0; $i < $itemNum; $i++) {
|
||||||
}
|
switch ($itemMeta['type']){
|
||||||
break;
|
case \mt\Item::HERO_TYPE : {
|
||||||
case \mt\Item::GUN_TYPE : {
|
$this->internalAddHero($conn,$itemMeta,$accountId);
|
||||||
$this->internalAddGun($conn,$itemMeta,$accountId);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case \mt\Item::GUN_TYPE : {
|
||||||
case \mt\Item::CHIP_TYPE : {
|
$this->internalAddGun($conn,$itemMeta,$accountId);
|
||||||
$this->internalAddChip($conn,$itemMeta,$accountId);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case \mt\Item::CHIP_TYPE : {
|
||||||
case \mt\Item::HERO_SKIN_TYPE : {
|
$this->internalAddChip($conn,$itemMeta,$accountId);
|
||||||
$this->internalAddHeroSkin($conn,$itemMeta,$accountId);
|
}
|
||||||
|
break;
|
||||||
|
case \mt\Item::HERO_SKIN_TYPE : {
|
||||||
|
$this->internalAddHeroSkin($conn,$itemMeta,$accountId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAccountId($address){
|
private function getAccountId($address){
|
||||||
@ -220,4 +225,37 @@ class ShopAddItemService
|
|||||||
return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE,V_ITEM_BCEG,V_ITEM_STAR));
|
return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE,V_ITEM_BCEG,V_ITEM_STAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function _addVirtualItem($conn,$accountId,$itemId,$itemNum){
|
||||||
|
if ($itemNum <= 0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch ($itemId) {
|
||||||
|
case V_ITEM_GOLD:
|
||||||
|
{
|
||||||
|
$this->_updateUserInfo($conn,$accountId,array(
|
||||||
|
'gold' => function () use($itemNum) {
|
||||||
|
return "gold + ${itemNum}";
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _updateUserInfo($conn,$accountId,$fieldsKv)
|
||||||
|
{
|
||||||
|
SqlHelper::update
|
||||||
|
($conn,
|
||||||
|
't_user',
|
||||||
|
array(
|
||||||
|
'account_id' => $accountId
|
||||||
|
),
|
||||||
|
$fieldsKv
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user