diff --git a/webapp/controller/ChipController.class.php b/webapp/controller/ChipController.class.php index bd4038c8..199d68ee 100644 --- a/webapp/controller/ChipController.class.php +++ b/webapp/controller/ChipController.class.php @@ -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, )); diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index deb98e94..e12fa2d0 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -39,7 +39,7 @@ class UserController extends BaseAuthedController { if (!$userInfo) { $this->createNewUser($userName, $avatarUrl); - //$this->addChip(); + $this->addChip(); $userInfo = $this->_getOrmUserInfo(); } diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index d1e91ec0..870cdca9 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -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;