This commit is contained in:
hujiabin 2022-08-26 20:02:33 +08:00
parent 1848e7ec3a
commit 242a928fdf

View File

@ -55,7 +55,15 @@ class HeroController extends BaseAuthedController {
array_push($chipAttr,$v);
}
}
$hero['rand_attr'] = $chipAttr;
$item = [];
foreach ($chipAttr as $k=>$v){
if (!isset($item[$v['attr_id']])){
$item[$v['attr_id']] = $v;
}else{
$item[$v['attr_id']]['val']+= $v['val'];
}
}
$hero['rand_attr'] = $item;
$hero_attr = emptyReplace(json_decode($hero['attr'], true), array());
\mt\AttrHelper::mergeAttr($hero_attr,$chipAttr);
$hero['attr'] = $hero_attr;