This commit is contained in:
hujiabin 2022-08-31 20:14:12 +08:00
parent 8468ed2655
commit ae0c533ddf
3 changed files with 15 additions and 11 deletions

View File

@ -28,8 +28,10 @@ class ChipController extends BaseAuthedController
$chipList = Chip::all($type);
$chipDtoList = array();
foreach ($chipList as $item) {
// array_push($chipDtoList, $item);
array_push($chipDtoList, Chip::toDto($item));
}
// print_r($chipDtoList);die;
$this->_rspData(array(
'data' => $chipDtoList,
));

View File

@ -39,7 +39,7 @@ class UserController extends BaseAuthedController {
if (!$userInfo) {
$this->createNewUser($userName, $avatarUrl);
//$this->addChip();
$this->addChip();
$userInfo = $this->_getOrmUserInfo();
}

View File

@ -72,18 +72,20 @@ class Chip extends BaseModel
$attr_pool = emptyReplace(json_decode($row['rand_attr'], true), array());
$attrs = array();
foreach ($attr_pool as $key=>$val){
$attr = mt\ChipAttr::getAttrById($val['attr_id'],$val['attr_type']);
$newAttr = [
if ($val){
$attr = mt\ChipAttr::getAttrById($val['attr_id'],$val['attr_type']);
$newAttr = [
'attr_id' => $attr['attr_id'],
'type' => 2,
'val' => $attr['lv'.$row['chip_grade']]*$val['attr_pool_number'],
'attr_id' => $attr['attr_id'],
'type' => 2,
'val' => $attr['lv'.$row['chip_grade']]*$val['attr_pool_number'],
// 'chip_name' => $attr['chip_name'],
'chip_type' => $attr['chip_type'],
'attr_num' => $attr['lv'.$row['chip_grade']],
'attr_pool_num' => $val['attr_pool_number'],
];
array_push($attrs,$newAttr);
'chip_type' => $attr['chip_type'],
'attr_num' => $attr['lv'.$row['chip_grade']],
'attr_pool_num' => $val['attr_pool_number'],
];
array_push($attrs,$newAttr);
}
}
$row['rand_attr'] = $attrs;
$row['today_get_gold'] = $todayGetGold;