select(array($field => $id)); if ($result) { foreach ($result as $k => $v) { $result[$k]['type'] = 'show'; $result[$k]['width'] = '100'; $result[$k]['show'] = true; $result[$k]['fixed'] = true; $result[$k]['key'] = $v['name']; $value = Dever::db($table . '_value')->select(array($field => $id, 'spec_id' => $v['id'])); if ($value) { foreach ($value as $k1 => $v1) { $value[$k1]['parent'] = $result[$k]['key']; $value[$k1]['name'] = $v1['value']; $value[$k1]['key'] = $v1['value']; if ($v1['is_checked'] == 1) { $value[$k1]['checked'] = true; } else { $value[$k1]['checked'] = false; } } } $result[$k]['value'] = $value; } } } return $result; } # 获取列表 public function getList($where, $app) { $where['state'] = 1; $data = Dever::db('spec', $app)->select($where, array('col' => 'id,name')); if ($data) { foreach ($data as &$v) { $w = $where; $w['spec_id'] = $v['id']; unset($v['id']); $v['value'] = Dever::db('spec_value', $app)->select($w, array('col' => 'id,value')); } } return $data; } }