where(array('uid' => $this->mid))->order('sort desc,id asc')->select(); if (empty($data)) { return $data; } $ret=array(); foreach($data as $value){ $temp=['r' => $value->param_val, 'name' => $value->param_name]; if (!isset($thridarr[$value->rule_id])) { $ret[$value->rule_id][] = $temp; } else { array_push($thridarr[$value->rule_id], $temp); } } return $ret; } }