This commit is contained in:
hujiabin 2023-07-14 16:15:45 +08:00
parent d46dda27af
commit 3b9c559854
2 changed files with 33 additions and 2 deletions

View File

@ -36,6 +36,25 @@ use services\LogService;
class HeroController extends BaseAuthedController {
public function test(){
$heroUniId = getReqVal('hero_uniid', 0);
$heroDb = Hero::find($heroUniId);
if (!$heroDb) {
$this->_rspErr(100, 'param error or null');
return;
}
if ($heroDb['hero_lv'] == 15){
$this->_rspErr(100, 'param error or null');
return;
}
$attrs = Hero::LvUpAddAttr($heroDb);
Hero::update($heroUniId, array(
'hero_lv' => $heroDb['hero_lv'] + 1,
'rand_attr' => json_encode($attrs['rand_attr']),
'base_attr' => json_encode($attrs['base_attr']),
));
}
public function heroList()
{
$heroList = array();
@ -111,7 +130,8 @@ class HeroController extends BaseAuthedController {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
if (!$heroSkinDb) {
$itemMeta = \mt\Item::get($skinId);
if ($itemMeta['isdefaultskin'] != 1 && !$heroSkinDb) {
$this->_rspErr(2, "You don't have the skin yet");
return;
}

View File

@ -63,7 +63,7 @@ class HeroSkin extends BaseModel {
'hero_id'=>0
)
);
SqlHelper::update(
SqlHelper::upsert(
myself()->_getSelfMysql(),
't_hero_skin',
array(
@ -72,6 +72,17 @@ class HeroSkin extends BaseModel {
),
array(
'hero_id'=>$heroId
),
array(
'account_id' => myself()->_getAccountId(),
'skin_id' => $skinId,
'skin_state' => 0,
'get_from' => 0,
'consume_num' => 0,
'try_expire_at' => 0,
'hero_id' => $heroId,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}