This commit is contained in:
hujiabin 2024-04-10 15:45:09 +08:00
parent 230be5d2ad
commit e08b4d4647
4 changed files with 68 additions and 2 deletions

View File

@ -44,6 +44,23 @@ class ChipController extends BaseAuthedController
)); ));
} }
public function mallChipInfo(){
$unique_id = trim(getReqVal('unique_id', 0));
if (! $unique_id){
$this->_rspErr(1, 'Please enter parameter unique_id');
return ;
}
$chipDb = Chip::findEx($unique_id);
if (! $chipDb){
$this->_rspErr(1, "You don't have the chip yet");
return;
}
$chip = Chip::toDto($chipDb);
$this->_rspData(array(
'data' => $chip,
));
}
public function upgradeQuality(){ public function upgradeQuality(){
$chipUniId = trim(getReqVal('chip_uniid', 0)); $chipUniId = trim(getReqVal('chip_uniid', 0));
if (!$chipUniId) { if (!$chipUniId) {

View File

@ -78,6 +78,23 @@ class HeroController extends BaseAuthedController {
)); ));
} }
public function mallHeroInfo(){
$unique_id = trim(getReqVal('unique_id', 0));
if ( ! $unique_id) {
$this->_rspErr(1, 'Please enter instructions');
return;
}
$heroDb = Hero::findEx($unique_id);
if (! $heroDb){
$this->_rspErr(1, "You don't have the hero yet");
return;
}
$hero = Hero::mallInfo($heroDb);
$this->_rspData(array(
'data' => $hero
));
}
public function skinList() public function skinList()
{ {
$heroId = getReqVal('hero_id',0); $heroId = getReqVal('hero_id',0);

View File

@ -47,6 +47,18 @@ class Chip extends BaseModel
return $row; return $row;
} }
public static function findEx($chipUniId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_chip',
array(
'idx' => $chipUniId,
)
);
return $row;
}
public static function update2($chipUniId, $fieldsKv){ public static function update2($chipUniId, $fieldsKv){
if (self::find($chipUniId)) { if (self::find($chipUniId)) {

View File

@ -279,7 +279,7 @@ class Hero extends BaseModel {
'is_select' => $isSelect, 'is_select' => $isSelect,
'lucky' => self::getHeroLucky($row), 'lucky' => self::getHeroLucky($row),
'wealth' => self::getHeroWealth($row), 'wealth' => self::getHeroWealth($row),
'ability' => self::abilityInfo($row, $attr), 'ability' => self::abilityInfo($row),
'seal_type' => $row['seal_type'], 'seal_type' => $row['seal_type'],
'unseal_time' => $row['unseal_time'], 'unseal_time' => $row['unseal_time'],
'valid_lefttime' => max(0, 'valid_lefttime' => max(0,
@ -297,6 +297,26 @@ class Hero extends BaseModel {
return $dto; return $dto;
} }
public static function mallInfo($row){
$attr = emptyReplace(json_decode($row['rand_attr'], true), array());
return array(
'idx' => $row['idx'],
'token_id' => $row['token_id'],
'hero_uniid' => $row['idx'],
'hero_id' => $row['hero_id'],
'hero_lv' => $row['hero_lv'],
'hero_tili' => $row['hero_tili'],
'state' => $row['state'],
'quality' => $row['quality'],
'skill_lv1' => $row['skill_lv1'],
'skill_lv2' => $row['skill_lv2'],
'rand_attr' => $attr,
'lucky' => self::getHeroLucky($row),
'wealth' => self::getHeroWealth($row),
'ability' => self::abilityInfo($row),
);
}
private static function celHeroWealthUpLimit($row){ private static function celHeroWealthUpLimit($row){
//最大财富值和幸运值计算 //最大财富值和幸运值计算
@ -348,7 +368,7 @@ class Hero extends BaseModel {
return $avatarInfos; return $avatarInfos;
} }
private static function abilityInfo($row, $attr){ private static function abilityInfo($row ){
$info = array( $info = array(
'hp' => 0, 'hp' => 0,
'attack' => 0, 'attack' => 0,