646 lines
25 KiB
PHP
646 lines
25 KiB
PHP
<?php
|
|
require_once('mt/NewShop.php');
|
|
class NHeroController extends BaseAuthedController {
|
|
|
|
|
|
public function addItemToDB()
|
|
{
|
|
// $itemArr = [10101,10102,10103,10104,10105,10106,10200,10201,
|
|
// 10202,10203,10204,10205,10206,10207,10208,12100,12102,12103,12104,
|
|
// 12105,12106,12107,12119,12120,12121];
|
|
$playerCfg = require('../res/player@player.php');
|
|
$itemIDArr = array(30100,30200,30300);
|
|
$itemArr = array();
|
|
$len = count($itemIDArr);
|
|
for($i = 0; $i< $len; $i++)
|
|
{
|
|
$heroID = $itemIDArr[$i];
|
|
if($playerCfg[$heroID])
|
|
{
|
|
$heroCfg = $playerCfg[$heroID];
|
|
$skinListStr = $heroCfg["skinlist"];
|
|
$skinIDArr = explode("|",$skinListStr);
|
|
$skinID = $skinIDArr[0];
|
|
$itemData = array("hero_id"=>$heroID,"skin_id"=>$skinID);
|
|
array_push($itemArr,$itemData);
|
|
error_log("itemTest=01====".$itemIDArr[$i]."==".$skinID);
|
|
$skinData = array(
|
|
'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $skinID,
|
|
'skin_state' => 0,
|
|
'get_from' => 0,
|
|
'consume_num' => 0,
|
|
'trytime' => 0
|
|
);
|
|
$this->addHeroSkin($skinData);
|
|
}
|
|
}
|
|
$this->addAllHero($itemArr);
|
|
$this->sendDataToClient(1,"test03",$playerCfg);
|
|
}
|
|
public function addHeroToDB($heroID,$_heroCfg)
|
|
{
|
|
$code = 100;
|
|
$itemArr = array();
|
|
$resultArr = array();
|
|
$heroCfg = $_heroCfg;
|
|
$skinListStr = $heroCfg["skinlist"];
|
|
$skinIDArr = explode("|",$skinListStr);
|
|
$skinID = $skinIDArr[0];
|
|
$itemData = array("hero_id"=>$heroID,"skin_id"=>$skinID);
|
|
array_push($itemArr,$itemData);
|
|
|
|
$skinData = array(
|
|
'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $skinID,
|
|
'skin_state' => 0,
|
|
'get_from' => 0,
|
|
'consume_num' => 0,
|
|
'trytime' => 0
|
|
);
|
|
|
|
$this->addHeroSkin($skinData);
|
|
|
|
$this->addAllHero($itemArr);
|
|
array_push($resultArr,$itemData);
|
|
array_push($resultArr,$skinData);
|
|
return $resultArr;
|
|
}
|
|
public function addHeroAndSkin($heroID,$_heroCfg,$skinID)
|
|
{
|
|
$code = 100;
|
|
$itemArr = array();
|
|
$resultArr = array();
|
|
$heroCfg = $_heroCfg;
|
|
|
|
|
|
|
|
//添加指定皮肤
|
|
$skinData = array(
|
|
'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $skinID,
|
|
'skin_state' => 0,
|
|
'get_from' => 1,
|
|
'consume_num' => 0,
|
|
'trytime' => 0
|
|
);
|
|
$this->addHeroSkin($skinData);
|
|
//添加默认皮肤
|
|
$skinListStr = $heroCfg["skinlist"];
|
|
$skinIDArr = explode("|",$skinListStr);
|
|
$defualtSkinID = $skinIDArr[0];
|
|
$skinData02 = array(
|
|
'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $defualtSkinID,
|
|
'skin_state' => 0,
|
|
'get_from' => 0,
|
|
'consume_num' => 0,
|
|
'trytime' => 0
|
|
);
|
|
$itemData = array("hero_id"=>$heroID,"default_skinID"=>$defualtSkinID,"skin_id"=>$skinID);
|
|
array_push($itemArr,$itemData);
|
|
$this->addHeroSkin($skinData02);
|
|
$this->addAllHero($itemArr);
|
|
array_push($resultArr,$itemData);
|
|
array_push($resultArr,$skinData);
|
|
array_push($resultArr,$skinData02);
|
|
return $resultArr;
|
|
}
|
|
public function getAllHero()
|
|
{
|
|
$account_id = $_REQUEST['account_id'];
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr = "SELECT id,lv,skinid,skill1_lv1,skill1_lv2,yokeexp,yoketotalexp FROM hero WHERE accountid=:accountid; ";
|
|
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id));
|
|
if($row) {
|
|
error_log("getHero======");
|
|
}
|
|
else{
|
|
error_log("getHeroFailed=======");
|
|
}
|
|
$this->sendDataToClient(0,"getHero",$row);
|
|
}
|
|
public function getHeroInfoByID()
|
|
{
|
|
$account_id = $_REQUEST['account_id'];
|
|
$heroID = $_REQUEST['heroID'];
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr = "SELECT * FROM hero WHERE accountid=:accountid AND id=:id;";
|
|
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':id' => $heroID));
|
|
|
|
if($row) {
|
|
error_log("getHero======");
|
|
}
|
|
else{
|
|
error_log("getHeroFailed=======");
|
|
}
|
|
$this->sendDataToClient(0,"getHeroInfoByID",$row);
|
|
}
|
|
public function getYokeItemInfo()//获得羁绊道具信息
|
|
{
|
|
|
|
}
|
|
public function changeSkin()//切换英雄皮肤
|
|
{
|
|
$skinID = $_REQUEST['skin_id'];
|
|
$heroID = $_REQUEST['hero_id'];
|
|
$account_id = $_REQUEST['account_id'];
|
|
$conn = $this->getMysql($account_id);
|
|
|
|
error_log("updateHeroSkinSuccess======".$heroID);
|
|
$sqlStr = "Update hero set skinid =:skinid WHERE accountid=:accountid AND id=:id ";
|
|
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':id'=>$heroID,':skinid'=>$skinID));
|
|
|
|
$this->sendDataToClient(100,"updateHeroSkin",$skinID);
|
|
}
|
|
public function buySkin()//购买英雄皮肤
|
|
{
|
|
|
|
$account_id = $_REQUEST['account_id'];
|
|
$skinID = $_REQUEST['skin_id'];
|
|
$heroID = $_REQUEST['hero_id'];
|
|
$goodsID = $_REQUEST['goodsID'];
|
|
|
|
$shopMeta = mt\NewShop::getShopItemByID($goodsID);
|
|
$code = 100;
|
|
$skinData = null;
|
|
if($shopMeta)
|
|
{
|
|
$priceNum = $shopMeta["priceNum"];
|
|
$priceID = $shopMeta["priceID"];
|
|
$code = $this->checkPriceEnough($priceNum,$priceID);
|
|
}
|
|
else
|
|
{
|
|
$code = 99;
|
|
}
|
|
|
|
|
|
|
|
if (SERVER_ENV != _ONLINE) {
|
|
$code = 100;
|
|
$skinData = array(
|
|
'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $skinID,
|
|
'skin_state' => 0,
|
|
'get_from' => 0,
|
|
'consume_num' => 0,
|
|
'trytime' => 0
|
|
);
|
|
$this->addHeroSkin($skinData);
|
|
}
|
|
else
|
|
{
|
|
if($code == 100)
|
|
{
|
|
$skinData = array(
|
|
'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $skinID,
|
|
'skin_state' => 0,
|
|
'get_from' => 0,
|
|
'consume_num' => 0,
|
|
'trytime' => 0
|
|
);
|
|
$this->addHeroSkin($skinData);
|
|
}
|
|
}
|
|
if($code == 100)
|
|
{
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr = "Update hero set skinid =:skinid WHERE accountid=:accountid AND id=:id ";
|
|
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':id'=>$heroID,':skinid'=>$skinID));
|
|
}
|
|
$this->sendDataToClient($code,"buyHeroSuccess",$skinData);
|
|
|
|
}
|
|
public function buyHero()//购买英雄
|
|
{
|
|
|
|
$playerCfg = require('../res/player@player.php');
|
|
$account_id = $_REQUEST['account_id'];
|
|
$heroID = $_REQUEST['hero_id'];
|
|
$buyType = $_REQUEST['buyType'];
|
|
$heroCfg = null;
|
|
$code = 99;
|
|
$money = 0;
|
|
$heroData = null;
|
|
$leftMoney = 0;
|
|
$skinPrice = 0;
|
|
$skinID = null;
|
|
if($playerCfg[$heroID])
|
|
{
|
|
$heroCfg = $playerCfg[$heroID];
|
|
$goodsID = $heroCfg["hero_item"];
|
|
$goodsItem = mt\NewShop::getShopItemByID($goodsID);
|
|
$priceNum = $goodsItem["priceNum"];//商品价格
|
|
$priceID = $goodsItem["priceID"];//商品价格货币ID
|
|
if($buyType == 1)
|
|
{
|
|
$playerSkinCfg = require('../res/playerskin@playerskin.php');
|
|
$skinID = $_REQUEST['skin_id'];
|
|
if($playerSkinCfg[$skinID])
|
|
{
|
|
$skinCfg = $playerSkinCfg[$skinID];
|
|
$skinGoodsID = $skinCfg["itemid"];
|
|
$skinGoodsItem = mt\NewShop::getShopItemByID($skinGoodsID);
|
|
$skinPriceNum = $skinGoodsItem["priceNum"];//商品价格
|
|
$skinPrice = $skinPriceNum;
|
|
}
|
|
|
|
}
|
|
$priceNum = $priceNum +$skinPrice;
|
|
|
|
$code = $this->checkPriceEnough($priceNum,$priceID);
|
|
if($code == 100)
|
|
{
|
|
error_log("购买英雄成功=====".$priceNum);
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr3 = "SELECT coin_num,diamond_num FROM user WHERE accountid=:accountid; ";
|
|
$row = $conn->execQuery($sqlStr3,array(':accountid' => $account_id));
|
|
|
|
if($row)
|
|
{
|
|
$money = $row[0]["coin_num"];
|
|
$diamond = $row[0]["diamond_num"];
|
|
$leftMoney = $money;
|
|
$leftDiamond = $diamond;
|
|
}
|
|
else
|
|
{
|
|
$code = 90;
|
|
}
|
|
if($code == 100)
|
|
{
|
|
if($priceID == "10001")
|
|
{
|
|
$leftMoney = $leftMoney -$priceNum;
|
|
}
|
|
else if($priceID == "10003")
|
|
{
|
|
$leftDiamond = $leftDiamond -$priceNum;
|
|
}
|
|
//更新货币到数据库
|
|
$this->updateCurrency($leftMoney,$leftDiamond);
|
|
//添加新英雄到数据库
|
|
if($buyType == 0)
|
|
{
|
|
$heroData = $this->addHeroToDB($heroID,$heroCfg);
|
|
}
|
|
else
|
|
{
|
|
$heroData = $this->addHeroAndSkin($heroID,$heroCfg,$skinID);
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
$this->sendDataToClient($code,"buyHero",$heroData);
|
|
}
|
|
public function updateCurrency($_money,$_diamond)
|
|
{
|
|
$account_id = $_REQUEST['account_id'];
|
|
$conn = $this->getMysql($account_id);
|
|
|
|
$sqlStr2 = "Update user set coin_num =:coin_num,diamond_num =:diamond_num WHERE accountid=:accountid ";
|
|
$row = $conn->execQuery($sqlStr2,array(':accountid' => $account_id,':coin_num' => $_money,':diamond_num' => $_diamond));
|
|
|
|
}
|
|
public function getAllHeroSkinByID()//获得英雄的所有皮肤
|
|
{
|
|
$account_id = $_REQUEST['account_id'];
|
|
$conn = $this->getMysql($account_id);
|
|
$heroID = $_REQUEST['hero_id'];
|
|
$sqlStr = "SELECT hero_id,skin_id,skin_state,get_from,consume_num,trytime FROM hero_skin WHERE accountid=:accountid AND hero_id=:hero_id;";
|
|
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':hero_id' => $heroID));
|
|
if($row) {
|
|
error_log("getHeroSkin=====");
|
|
}
|
|
else{
|
|
error_log("getHeroSkinFailed=======");
|
|
}
|
|
$this->sendDataToClient(0,"getHeroSkin",$row);
|
|
}
|
|
public function skillLvUp()//技能升级
|
|
{
|
|
$skillCfgArr = require('../res/skill@skill.php');
|
|
$playerCfg = require('../res/player@player.php');
|
|
|
|
$skillID = $_REQUEST['skillID'];
|
|
$skillCfg = null;
|
|
$heroID = $_REQUEST['heroID'];
|
|
$skillType = $_REQUEST['skillType'];
|
|
$account_id = $_REQUEST['account_id'];
|
|
$heroCfg = null;
|
|
$maxLv = 0;
|
|
$itemArr = array();
|
|
|
|
if($playerCfg[$heroID])
|
|
{
|
|
$heroCfg = $playerCfg[$heroID];
|
|
}
|
|
$skillLv = 0;
|
|
$code = 100;
|
|
$needItemArr = array();
|
|
if($skillCfgArr[$skillID])
|
|
{
|
|
$skillCfg = $skillCfgArr[$skillID];
|
|
}
|
|
else
|
|
{
|
|
$code = 99;//技能不存在
|
|
}
|
|
if($skillCfg)
|
|
{
|
|
$consumeStr = $skillCfg["upcost"];
|
|
$consumeStrArr = explode(";",$consumeStr);
|
|
|
|
$len = count($consumeStrArr);
|
|
for($i = 0; $i < $len; $i++)
|
|
{
|
|
$tmpStrArr = explode(":",$consumeStrArr[$i]);
|
|
$itemData = array("itemID"=>$tmpStrArr[0],"itemNum"=>$tmpStrArr[1]);
|
|
array_push($needItemArr,$itemData);
|
|
}
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr = "SELECT skill1_lv1,skill1_lv2 FROM hero WHERE accountid=:accountid AND id=:id;";
|
|
$sqlStr2 = "";
|
|
$leftMoney = 0;
|
|
$leftDiamond = 0;
|
|
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':id' => $heroID));
|
|
if($row)
|
|
{
|
|
if($skillType == 1)
|
|
{
|
|
$skillLv = number_format($row[0]["skill1_lv1"]);
|
|
$sqlStr2 = "Update hero set skill1_lv1 =:skill1_lv WHERE accountid=:accountid AND id=:id ";
|
|
$skillList1Str = $heroCfg["skill1list"];
|
|
$tmpArr = explode("|",$skillList1Str);
|
|
$maxLv = count($tmpArr);
|
|
}
|
|
else if($skillType == 2)
|
|
{
|
|
$skillLv = number_format($row[0]["skill1_lv2"]);
|
|
$sqlStr2 = "Update hero set skill1_lv2 =:skill1_lv WHERE accountid=:accountid AND id=:id ";
|
|
$skillList1Str = $heroCfg["skill2list"];
|
|
$tmpArr = explode("|",$skillList1Str);
|
|
$maxLv = count($tmpArr);
|
|
}
|
|
//获得Money和钻石
|
|
$money = 0;
|
|
$diamond = 0;
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr3 = "SELECT coin_num,diamond_num FROM user WHERE accountid=:accountid; ";
|
|
$row = $conn->execQuery($sqlStr3,array(':accountid' => $account_id));
|
|
|
|
if($row)
|
|
{
|
|
$money = $row[0]["coin_num"];
|
|
$diamond = $row[0]["diamond_num"];
|
|
$leftMoney = $money;
|
|
$leftDiamond = $diamond;
|
|
}
|
|
else
|
|
{
|
|
$code = 90;
|
|
}
|
|
//获得背包所有道具
|
|
if($code == 100)
|
|
{
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr3 = "SELECT * FROM bag WHERE accountid=:accountid; ";
|
|
$row = $conn->execQuery($sqlStr3,array(':accountid' => $account_id));
|
|
|
|
if($row) {//判断道具是否足够
|
|
$needItemArrLen = count($needItemArr);
|
|
$enoughN = 0;
|
|
$allItemLen = count($row);
|
|
for($i = 0; $i < $needItemArrLen; $i++)
|
|
{
|
|
$tempNeedItemID = $needItemArr[$i]["itemID"];
|
|
$tempNeedItemNum = $needItemArr[$i]["itemNum"];
|
|
error_log("技能升级01======".$tempNeedItemID."==".$tempNeedItemNum);
|
|
if($tempNeedItemID == "10001")
|
|
{
|
|
$code = 97;//金币不足
|
|
if($tempNeedItemNum <= $money)
|
|
{
|
|
$code = 100;
|
|
$leftMoney = $money -$tempNeedItemNum;
|
|
}
|
|
}
|
|
else if($tempNeedItemID == "10003")
|
|
{
|
|
$code = 96;//钻石不足
|
|
if($tempNeedItemNum <= $diamond)
|
|
{
|
|
$code = 100;
|
|
$leftDiamond = $diamond - $tempNeedItemNum;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$code = 95;//道具不足
|
|
for($j = 0; $j < $allItemLen; $j++)
|
|
{
|
|
$bagItemID = $row[$j]["id"];
|
|
$bagItemNum = $row[$j]["num"];
|
|
if($tempNeedItemID == $bagItemID)
|
|
{
|
|
error_log("技能升级======".$bagItemID."==".$bagItemNum);
|
|
if($tempNeedItemNum <= $bagItemNum)
|
|
{
|
|
$code = 100;
|
|
$deleteItem = array("item_id"=>$bagItemID,"item_num"=>$tempNeedItemNum);
|
|
array_push($itemArr,$deleteItem);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if($code != 100)
|
|
{
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$code = 90;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
if($skillLv + 1 <= $maxLv)
|
|
{
|
|
$skillLv ++;
|
|
}
|
|
else
|
|
{
|
|
$code = 98;//已经升到最大级
|
|
}
|
|
|
|
if($code == 100)//更新数据库
|
|
{
|
|
$this->decItem($itemArr);
|
|
$this->updateCurrency($leftMoney,$leftDiamond);
|
|
$conn = $this->getMysql($account_id);
|
|
$row = $conn->execQuery($sqlStr2,array(':accountid' => $account_id,':id' => $heroID,':skill1_lv' => $skillLv));
|
|
|
|
error_log("更新英雄数据到服务器===");
|
|
}
|
|
}
|
|
$resultArr = array("skillLv"=>$skillLv);
|
|
$this->sendDataToClient($code,"ok",$resultArr);
|
|
}
|
|
public function useYokeItem()//使用羁绊道具
|
|
{
|
|
$newItemCfg = require('../res/newitem@newitem.php');
|
|
$playerCfg = require('../res/player@player.php');
|
|
$itemID = $_REQUEST['itemID'];
|
|
$itemNum = $_REQUEST['itemNum'];
|
|
$heroID = $_REQUEST['heroID'];
|
|
$itemArr = array();
|
|
$deleteItem = array("item_id"=>$itemID,"item_num"=>$itemNum);
|
|
|
|
array_push($itemArr,$deleteItem);
|
|
$code = $this->deleteItem($deleteItem);
|
|
$expNum = 0;
|
|
$curHeroExp = 0;
|
|
$lvUp = 0;
|
|
$heroLv = 0;
|
|
$totalGetExp = 0;
|
|
if($code == 100)
|
|
{
|
|
//
|
|
if($newItemCfg[$itemID])
|
|
{
|
|
$itemCfg = $newItemCfg[$itemID];
|
|
$perExp = number_format($itemCfg["pre1"]);
|
|
$expNum = $perExp*$itemNum ;
|
|
}
|
|
$account_id = $_REQUEST['account_id'];
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr = "SELECT yokeexp,lv, yoketotalexp FROM hero WHERE accountid=:accountid AND id=:id;";
|
|
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':id' => $heroID));
|
|
if($row)
|
|
{
|
|
$curHeroExp = number_format($row[0]["yokeexp"]);
|
|
$heroLv = number_format($row[0]["lv"]);
|
|
$totalGetExp = number_format($row[0]["yoketotalexp"]);
|
|
}
|
|
if($playerCfg[$heroID] && $heroLv > 0)
|
|
{
|
|
$heroLvUpNeedExpStr = $playerCfg[$heroID]["lvexp"];
|
|
$heroLvUpNeedExpArray = explode("|",$heroLvUpNeedExpStr);
|
|
$maxLv = count($heroLvUpNeedExpArray);
|
|
$isOut = 0;
|
|
$totalExp = 0;
|
|
if($heroLv < $maxLv)//未超过最大等级
|
|
{
|
|
while($expNum > 0 && $isOut == 0)
|
|
{
|
|
$czExp = $heroLvUpNeedExpArray[$heroLv -1] - $curHeroExp;
|
|
|
|
if($expNum - $czExp >= 0)//当前经验狗升级
|
|
{
|
|
$heroLv ++;
|
|
$expNum = $expNum - $czExp;
|
|
$totalExp = $totalExp +$czExp;
|
|
$curHeroExp = 0;
|
|
error_log("TestLVUp=====".$heroLv."==".$czExp."==".$expNum.json_encode($heroLvUpNeedExpArray));
|
|
if($heroLv >= $maxLv)//未超过最大等级
|
|
{
|
|
$isOut = 1;
|
|
}
|
|
}
|
|
else//经验不够升级
|
|
{
|
|
|
|
$curHeroExp = $curHeroExp +$expNum;
|
|
$totalExp = $totalExp +$expNum;
|
|
$expNum = 0;
|
|
}
|
|
}
|
|
$totalGetExp = $totalGetExp + $totalExp;
|
|
|
|
}
|
|
else
|
|
{
|
|
$code = 95;//已经升到最大级
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
$code = 94;//错误数据
|
|
}
|
|
if($code == 100)
|
|
{
|
|
$this->decItem($itemArr);
|
|
$conn = $this->getMysql($account_id);
|
|
$sqlStr = "Update hero set lv =:lv,yokeexp =:yokeexp,yoketotalexp =:yoketotalexp WHERE accountid=:accountid AND id=:id ";
|
|
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':id' => $heroID,':lv' => $heroLv,':yokeexp' => $curHeroExp,':yoketotalexp' => $totalGetExp));
|
|
error_log("更新英雄数据到服务器===".$heroLv."==".$curHeroExp);
|
|
}
|
|
}
|
|
$resultArr = array("itemCnt"=>$itemNum,"itemPerExp"=>$perExp,"itemID"=>$itemID,"heroLV"=>$heroLv,"totalExp"=>$totalGetExp,"curExp"=>$curHeroExp);
|
|
$this->sendDataToClient($code,"ok",$resultArr);
|
|
}
|
|
public function addHeroSkin($item)
|
|
{
|
|
phpcommon\SqlHelper::insertOrUpdate
|
|
($this->getSelfMysql(),
|
|
'hero_skin',
|
|
array(
|
|
'accountid' => $this->getAccountId(),
|
|
'hero_id' => $item['hero_id'],
|
|
'skin_id' => $item['skin_id']
|
|
),
|
|
array(
|
|
'accountid' => $this->getAccountId(),
|
|
'hero_id' => $item['hero_id'],
|
|
'skin_id' => $item['skin_id'],
|
|
'skin_state' => $item['skin_state'],
|
|
'get_from' => $item['get_from'],
|
|
'consume_num' => $item['consume_num'],
|
|
'trytime' => $item['trytime'],
|
|
'createtime' => $this->getNowTime(),
|
|
'modifytime' => $this->getNowTime()
|
|
),
|
|
array(
|
|
'skin_state' => 3,
|
|
'modifytime' => $this->getNowTime()
|
|
)
|
|
);
|
|
}
|
|
public function addAllHero($items)
|
|
{
|
|
foreach ($items as $item) {
|
|
phpcommon\SqlHelper::insertOrUpdate
|
|
($this->getSelfMysql(),
|
|
'hero',
|
|
array(
|
|
'accountid' => $this->getAccountId(),
|
|
'id' => $item['hero_id']
|
|
),
|
|
array(
|
|
'accountid' => $this->getAccountId(),
|
|
'id' => $item['hero_id'],
|
|
'lv' => 1,
|
|
'skinid' => $item['skin_id'],
|
|
'skill1_lv1' =>1,
|
|
'skill1_lv2' =>1,
|
|
'yokeexp' => 0,
|
|
'yoketotalexp' => 0,
|
|
'createtime' => $this->getNowTime(),
|
|
'modifytime' => $this->getNowTime()
|
|
),
|
|
array(
|
|
'skill_lv1' => 1,
|
|
'modifytime' => $this->getNowTime()
|
|
)
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|