1
This commit is contained in:
parent
6ec0749780
commit
04b68353e1
15
doc/Hero.py
15
doc/Hero.py
@ -5,6 +5,21 @@ import _common
|
|||||||
class Hero(object):
|
class Hero(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.apis_ = [
|
||||||
|
{
|
||||||
|
'name': 'heroList',
|
||||||
|
'desc': '获取英雄列表',
|
||||||
|
'group': 'Hero',
|
||||||
|
'url': 'webapp/index.php?c=Hero&a=heroList',
|
||||||
|
'params': [
|
||||||
|
_common.ReqHead(),
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['!hero_list', _common.Hero, '英雄列表']
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
self.apis_ = [
|
self.apis_ = [
|
||||||
{
|
{
|
||||||
'desc': 'addItemToDB',
|
'desc': 'addItemToDB',
|
||||||
|
@ -123,6 +123,19 @@ class UserInfo(object):
|
|||||||
['first_fight', 0, '是否是第一次战斗'],
|
['first_fight', 0, '是否是第一次战斗'],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class Hero(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['hero_id', 0, '英雄id'],
|
||||||
|
['hero_lv', 0, '英雄等级'],
|
||||||
|
['skin_id', 0, '英雄皮肤id'],
|
||||||
|
['skill1_lv1', 0, '必杀技等级'],
|
||||||
|
['skill1_lv2', 0, '躲避技能等级'],
|
||||||
|
['yoke_exp', 0, '当前羁绊等级的经验'],
|
||||||
|
['yoke_total_exp', 0, '羁绊获得的总经验'],
|
||||||
|
]
|
||||||
|
|
||||||
class RobotInfo(object):
|
class RobotInfo(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
ini_set('date.timezone','Asia/Shanghai');
|
ini_set('date.timezone','Asia/Shanghai');
|
||||||
require 'phpcommon/common.php';
|
require 'phpcommon/common.php';
|
||||||
|
require_once('models/BaseModel.php');
|
||||||
|
|
||||||
define('TEAMID_KEY', 'team_uuid:');
|
define('TEAMID_KEY', 'team_uuid:');
|
||||||
//每日任务
|
//每日任务
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
require_once('mt/Player.php');
|
require_once('mt/Player.php');
|
||||||
|
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
class BaseAuthedController extends BaseController {
|
class BaseAuthedController extends BaseController {
|
||||||
|
|
||||||
private $accountId = '';
|
private $accountId = '';
|
||||||
@ -87,9 +89,9 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function getUserInfo($fields)
|
protected function getUserInfo($fields)
|
||||||
{
|
{
|
||||||
$row = phpcommon\SqlHelper::selectOne
|
$row = SqlHelper::selectOne
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
'user',
|
't_user',
|
||||||
$fields,
|
$fields,
|
||||||
array(
|
array(
|
||||||
'accountid' => $this->getAccountId()
|
'accountid' => $this->getAccountId()
|
||||||
@ -105,9 +107,9 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function getOrmUserInfo()
|
protected function getOrmUserInfo()
|
||||||
{
|
{
|
||||||
$row = phpcommon\SqlHelper::ormSelectOne
|
$row = SqlHelper::ormSelectOne
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
'user',
|
't_user',
|
||||||
array(
|
array(
|
||||||
'accountid' => $this->getAccountId()
|
'accountid' => $this->getAccountId()
|
||||||
)
|
)
|
||||||
@ -122,7 +124,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function safeGetOrmUserInfo()
|
protected function safeGetOrmUserInfo()
|
||||||
{
|
{
|
||||||
$row = phpcommon\SqlHelper::ormSelectOne
|
$row = SqlHelper::ormSelectOne
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
't_user',
|
't_user',
|
||||||
array(
|
array(
|
||||||
@ -134,7 +136,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function updateUserInfo($fieldsKv)
|
protected function updateUserInfo($fieldsKv)
|
||||||
{
|
{
|
||||||
phpcommon\SqlHelper::update
|
SqlHelper::update
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
'user',
|
'user',
|
||||||
array(
|
array(
|
||||||
@ -155,7 +157,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function getItem($itemId)
|
protected function getItem($itemId)
|
||||||
{
|
{
|
||||||
$row = phpcommon\SqlHelper::selectOne
|
$row = SqlHelper::selectOne
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
'bag',
|
'bag',
|
||||||
array(
|
array(
|
||||||
@ -195,7 +197,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
$row = phpcommon\SqlHelper::selectOne
|
$row = SqlHelper::selectOne
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
'bag',
|
'bag',
|
||||||
array(
|
array(
|
||||||
@ -237,9 +239,9 @@ class BaseAuthedController extends BaseController {
|
|||||||
$this->addLottery($item['item_num']);
|
$this->addLottery($item['item_num']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
phpcommon\SqlHelper::upsert
|
SqlHelper::upsert
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
'bag',
|
't_bag',
|
||||||
array(
|
array(
|
||||||
'accountid' => $this->getAccountId(),
|
'accountid' => $this->getAccountId(),
|
||||||
'item_id' => $item['item_id']
|
'item_id' => $item['item_id']
|
||||||
@ -271,7 +273,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
// $this->decGold($item['item_num']);
|
// $this->decGold($item['item_num']);
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
phpcommon\SqlHelper::update
|
SqlHelper::update
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
'bag',
|
'bag',
|
||||||
array(
|
array(
|
||||||
@ -314,7 +316,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
}
|
}
|
||||||
protected function decGold($decGold)
|
protected function decGold($decGold)
|
||||||
{
|
{
|
||||||
phpcommon\SqlHelper::update
|
SqlHelper::update
|
||||||
(
|
(
|
||||||
$this->getSelfMysql(),
|
$this->getSelfMysql(),
|
||||||
'user',
|
'user',
|
||||||
@ -331,7 +333,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function addGold($addGold)
|
protected function addGold($addGold)
|
||||||
{
|
{
|
||||||
phpcommon\SqlHelper::update
|
SqlHelper::update
|
||||||
(
|
(
|
||||||
$this->getSelfMysql(),
|
$this->getSelfMysql(),
|
||||||
'user',
|
'user',
|
||||||
@ -345,7 +347,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
}
|
}
|
||||||
protected function addLottery($addLottery)
|
protected function addLottery($addLottery)
|
||||||
{
|
{
|
||||||
phpcommon\SqlHelper::update
|
SqlHelper::update
|
||||||
(
|
(
|
||||||
$this->getSelfMysql(),
|
$this->getSelfMysql(),
|
||||||
'user',
|
'user',
|
||||||
@ -415,7 +417,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function getTalentLv($skillId, $skillTypeId)
|
protected function getTalentLv($skillId, $skillTypeId)
|
||||||
{
|
{
|
||||||
$row = phpcommon\SqlHelper::selectOne
|
$row = SqlHelper::selectOne
|
||||||
(
|
(
|
||||||
$this->getSelfMysql(),
|
$this->getSelfMysql(),
|
||||||
'gun_intensify',
|
'gun_intensify',
|
||||||
@ -529,28 +531,12 @@ class BaseAuthedController extends BaseController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDtoUser($userInfo)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'name' => $userInfo['name'],
|
|
||||||
'sex' => $userInfo['sex'],
|
|
||||||
'head_id' => $userInfo['hero_id'],
|
|
||||||
'head_frame' => $userInfo['head_frame'],
|
|
||||||
'level' => $userInfo['level'],
|
|
||||||
'exp' => $userInfo['exp'],
|
|
||||||
'gold' => $userInfo['gold'],
|
|
||||||
'diamond' => $userInfo['diamond'],
|
|
||||||
'hero_id' => $userInfo['hero_id'],
|
|
||||||
'first_fight' => $userInfo['first_fight'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function addHero($heroMeta)
|
protected function addHero($heroMeta)
|
||||||
{
|
{
|
||||||
if (!$heroMeta) {
|
if (!$heroMeta) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
phpcommon\SqlHelper::upsert
|
SqlHelper::upsert
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
't_hero',
|
't_hero',
|
||||||
array(
|
array(
|
||||||
@ -563,7 +549,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
'accountid' => $this->getAccountId(),
|
'accountid' => $this->getAccountId(),
|
||||||
'hero_id' => $heroMeta['id'],
|
'hero_id' => $heroMeta['id'],
|
||||||
'hero_lv' => 1,
|
'hero_lv' => 1,
|
||||||
'skin_id' => $heroMeta['skin_id'],
|
'skin_id' => mt\Player::getDefaultSkin($heroMeta),
|
||||||
'skill1_lv1' => 1,
|
'skill1_lv1' => 1,
|
||||||
'skill1_lv2' => 1,
|
'skill1_lv2' => 1,
|
||||||
'yoke_exp' => 0,
|
'yoke_exp' => 0,
|
||||||
@ -580,13 +566,13 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function addHeroSkinXX($heroId, $skinId)
|
protected function addHeroSkinXX($heroId, $skinId)
|
||||||
{
|
{
|
||||||
phpcommon\SqlHelper::upsert
|
SqlHelper::upsert
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
't_hero_skin',
|
't_hero_skin',
|
||||||
array(
|
array(
|
||||||
'accountid' => $this->getAccountId(),
|
'accountid' => $this->getAccountId(),
|
||||||
'hero_id' => $heroId,
|
'hero_id' => $heroId,
|
||||||
'skin_id' => $skinid
|
'skin_id' => $skinId
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'skin_state' => 3,
|
'skin_state' => 3,
|
||||||
@ -608,7 +594,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
protected function getUsingEquipId()
|
protected function getUsingEquipId()
|
||||||
{
|
{
|
||||||
$row = phpcommon\SqlHelper::selectOne
|
$row = SqlHelper::selectOne
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
'equip',
|
'equip',
|
||||||
array(
|
array(
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
require 'phpcommon/sqlhelper.php';
|
require 'phpcommon/sqlhelper.php';
|
||||||
|
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
class BaseController {
|
class BaseController {
|
||||||
|
|
||||||
private $nowtime = 0;
|
private $nowtime = 0;
|
||||||
|
@ -2,43 +2,31 @@
|
|||||||
|
|
||||||
require_once('mt/NewShop.php');
|
require_once('mt/NewShop.php');
|
||||||
|
|
||||||
|
require_once('models/Hero.php');
|
||||||
|
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
use models\Hero;
|
||||||
|
|
||||||
class HeroController extends BaseAuthedController {
|
class HeroController extends BaseAuthedController {
|
||||||
|
|
||||||
|
public function heroList()
|
||||||
public function addItemToDB()
|
|
||||||
{
|
{
|
||||||
// $itemArr = [10101,10102,10103,10104,10105,10106,10200,10201,
|
$heroList = array();
|
||||||
// 10202,10203,10204,10205,10206,10207,10208,12100,12102,12103,12104,
|
SqlHelper::ormSelect(
|
||||||
// 12105,12106,12107,12119,12120,12121];
|
$this->getSelfMysql(),
|
||||||
$playerCfg = require('../res/player@player.php');
|
't_hero',
|
||||||
$itemIDArr = array(30100,30200,30300);
|
array(
|
||||||
$itemArr = array();
|
'accountid' => $this->getAccountId()
|
||||||
$len = count($itemIDArr);
|
),
|
||||||
for($i = 0; $i< $len; $i++)
|
function ($row) use(&$heroList) {
|
||||||
{
|
array_push($heroList, Hero::toDto($row));
|
||||||
$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->rspData(array(
|
||||||
$this->sendDataToClient(1,"test03",$playerCfg);
|
'hero_list' => $heroList
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addHeroToDB($heroID,$_heroCfg)
|
private function addHeroToDB($heroID,$_heroCfg)
|
||||||
{
|
{
|
||||||
$code = 100;
|
$code = 100;
|
||||||
@ -66,15 +54,13 @@ class HeroController extends BaseAuthedController {
|
|||||||
array_push($resultArr,$skinData);
|
array_push($resultArr,$skinData);
|
||||||
return $resultArr;
|
return $resultArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addHeroAndSkin($heroID,$_heroCfg,$skinID)
|
private function addHeroAndSkin($heroID,$_heroCfg,$skinID)
|
||||||
{
|
{
|
||||||
$code = 100;
|
$code = 100;
|
||||||
$itemArr = array();
|
$itemArr = array();
|
||||||
$resultArr = array();
|
$resultArr = array();
|
||||||
$heroCfg = $_heroCfg;
|
$heroCfg = $_heroCfg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//添加指定皮肤
|
//添加指定皮肤
|
||||||
$skinData = array(
|
$skinData = array(
|
||||||
'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $skinID,
|
'accountid' => $this->getAccountId(),'hero_id' => $heroID,'skin_id' => $skinID,
|
||||||
@ -104,6 +90,7 @@ class HeroController extends BaseAuthedController {
|
|||||||
array_push($resultArr,$skinData02);
|
array_push($resultArr,$skinData02);
|
||||||
return $resultArr;
|
return $resultArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAllHero()
|
public function getAllHero()
|
||||||
{
|
{
|
||||||
$account_id = $_REQUEST['account_id'];
|
$account_id = $_REQUEST['account_id'];
|
||||||
@ -118,6 +105,7 @@ class HeroController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
$this->sendDataToClient(0,"getHero",$row);
|
$this->sendDataToClient(0,"getHero",$row);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeroInfoByID()
|
public function getHeroInfoByID()
|
||||||
{
|
{
|
||||||
$account_id = $_REQUEST['account_id'];
|
$account_id = $_REQUEST['account_id'];
|
||||||
@ -134,10 +122,12 @@ class HeroController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
$this->sendDataToClient(0,"getHeroInfoByID",$row);
|
$this->sendDataToClient(0,"getHeroInfoByID",$row);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getYokeItemInfo()//获得羁绊道具信息
|
public function getYokeItemInfo()//获得羁绊道具信息
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changeSkin()//切换英雄皮肤
|
public function changeSkin()//切换英雄皮肤
|
||||||
{
|
{
|
||||||
$skinID = $_REQUEST['skin_id'];
|
$skinID = $_REQUEST['skin_id'];
|
||||||
@ -611,6 +601,7 @@ class HeroController extends BaseAuthedController {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addAllHero($items)
|
private function addAllHero($items)
|
||||||
{
|
{
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
@ -642,5 +633,3 @@ class HeroController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
require 'classes/Quest.php';
|
require 'classes/Quest.php';
|
||||||
require 'classes/AddReward.php';
|
require 'classes/AddReward.php';
|
||||||
|
|
||||||
|
require_once('models/User.php');
|
||||||
|
|
||||||
require_once('mt/Parameter.php');
|
require_once('mt/Parameter.php');
|
||||||
require_once('mt/Drop.php');
|
require_once('mt/Drop.php');
|
||||||
require_once('mt/EquipUpgrade.php');
|
require_once('mt/EquipUpgrade.php');
|
||||||
@ -13,6 +15,9 @@ require_once('mt/Equip.php');
|
|||||||
require_once('mt/Player.php');
|
require_once('mt/Player.php');
|
||||||
require_once('mt/Robot.php');
|
require_once('mt/Robot.php');
|
||||||
|
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
use models\User;
|
||||||
|
|
||||||
class UserController extends BaseAuthedController {
|
class UserController extends BaseAuthedController {
|
||||||
|
|
||||||
public function login()
|
public function login()
|
||||||
@ -30,9 +35,8 @@ class UserController extends BaseAuthedController {
|
|||||||
if (!$this->loginCheck($userInfo)) {
|
if (!$this->loginCheck($userInfo)) {
|
||||||
$userInfo = $this->getOrmUserInfo();
|
$userInfo = $this->getOrmUserInfo();
|
||||||
}
|
}
|
||||||
$dtoUser = $this->getDtoUser($userInfo);
|
|
||||||
$this->rspData(array(
|
$this->rspData(array(
|
||||||
'info' => $dtoUser
|
'info' => User::show($userInfo)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +47,7 @@ class UserController extends BaseAuthedController {
|
|||||||
|
|
||||||
private function createNewUser($userName, $avatarUrl)
|
private function createNewUser($userName, $avatarUrl)
|
||||||
{
|
{
|
||||||
phpcommon\SqlHelper::upsert
|
SqlHelper::upsert
|
||||||
($this->getSelfMysql(),
|
($this->getSelfMysql(),
|
||||||
't_user',
|
't_user',
|
||||||
array(
|
array(
|
||||||
@ -71,21 +75,19 @@ class UserController extends BaseAuthedController {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
{
|
{
|
||||||
$paramMeta = mt\Parameter::getByName('creator_hero_id');
|
foreach (mt\Parameter::getListValue('creator_hero_id') as $heroId) {
|
||||||
if ($paramMeta) {
|
$heroMeta = mt\Player::get($heroId);
|
||||||
$heros = mt\Parameter::getListValue($paramMeta);
|
if ($heroMeta) {
|
||||||
foreach ($heros as $heroId) {
|
$this->addHero($heroMeta);
|
||||||
$heroMeta = mt\Player::get($heroId);
|
|
||||||
if ($heroMeta) {
|
|
||||||
$this->addHero($heroMeta);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
$this->addItem(array(
|
$this->addItem(array(
|
||||||
'item_id' => 16001,
|
array(
|
||||||
'item_num' => 0,
|
'item_id' => 16001,
|
||||||
|
'item_num' => 0,
|
||||||
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace models;
|
||||||
|
|
||||||
|
class BaseModel {
|
||||||
|
|
||||||
|
}
|
20
webapp/models/Hero.php
Normal file
20
webapp/models/Hero.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace models;
|
||||||
|
|
||||||
|
class Hero extends BaseModel {
|
||||||
|
|
||||||
|
public static function toDto($row)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'hero_id' => $row['hero_id'],
|
||||||
|
'hero_lv' => $row['hero_lv'],
|
||||||
|
'skin_id' => $row['skin_id'],
|
||||||
|
'skill1_lv1' => $row['skill1_lv1'],
|
||||||
|
'skill1_lv2' => $row['skill1_lv2'],
|
||||||
|
'yoke_exp' => $row['yoke_exp'],
|
||||||
|
'yoke_total_exp' => $row['yoke_total_exp'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mt;
|
namespace models;
|
||||||
|
|
||||||
use phpcommon;
|
class User extends BaseModel {
|
||||||
|
|
||||||
|
public static function show($row)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'name' => $row['name'],
|
||||||
|
'sex' => $row['sex'],
|
||||||
|
'head_id' => $row['hero_id'],
|
||||||
|
'head_frame' => $row['head_frame'],
|
||||||
|
'level' => $row['level'],
|
||||||
|
'exp' => $row['exp'],
|
||||||
|
'gold' => $row['gold'],
|
||||||
|
'diamond' => $row['diamond'],
|
||||||
|
'hero_id' => $row['hero_id'],
|
||||||
|
'first_fight' => $row['first_fight'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -26,20 +26,23 @@ class Parameter {
|
|||||||
public static function getByName($name)
|
public static function getByName($name)
|
||||||
{
|
{
|
||||||
self::mustBeNameHash();
|
self::mustBeNameHash();
|
||||||
$meta = array_key_exists($id, self::$nameHash) ? self::$nameHash[$name] : null;
|
$meta = array_key_exists($name, self::$nameHash) ? self::$nameHash[$name] : null;
|
||||||
return $meta;
|
return $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getVal($name, $defVal)
|
public static function getVal($name, $defVal)
|
||||||
{
|
{
|
||||||
self::mustBeNameHash();
|
$meta = self::getByName($name);
|
||||||
$meta = array_key_exists($id, self::$nameHash) ? self::$nameHash[$name] : null;
|
|
||||||
return $meta ? $meta['param_value'] : $defVal;
|
return $meta ? $meta['param_value'] : $defVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getListValue($meta)
|
public static function getListValue($name, $defVal = array())
|
||||||
{
|
{
|
||||||
$values = explode("|", $meta['param_value']);
|
$val = self::getVal($name, null);
|
||||||
|
if ($val == null) {
|
||||||
|
return $defVal;
|
||||||
|
}
|
||||||
|
$values = explode('|', $val);
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user