public function bucket_second() { $bucket = $this->workerModel->getBucketWorkerHave($this->uid, $this->shopId); $data=array(); if ($bucket) { foreach ($bucket AS $value) { $data[$value['goods_id']]['goods_id']=$value['goods_id']; $data[$value['goods_id']]['heavy'] +=$value['heavy_num']; $data[$value['goods_id']]['light'] += $value['light_num']; $data[$value['goods_id']]['sum'] += $value['light_num']+$value['heavy_num']; } } unset($bucket); if($data){ foreach ($data as $k=>$v){ //var_dump($k); $goods_name=model('goods')->getGoodsName($k); if(!$goods_name){ unset($data[$k]); continue; } $data[$k]['goods_name']=$goods_name; } $data=array_values($data); } return $this->json = array( 'ret' => API_OK, 'response' => array( 'list' => $data ) ); }
array_values