0 && $source_table) { $info = Dever::db('store/author')->one($author); if (!$info) { $insert['name'] = $author; $author = Dever::db('store/author')->insert($insert); } Dever::db($source_table)->update(array('where_id' => $id, 'author_id' => $author)); } } # 搜索 public function search_api() { $keyword = Dever::input('keyword'); $yes = Dever::input('yes'); $where = array(); if ($yes) { $yes = Dever::db('store/author')->getAll(array('ids' => $yes)); } if (!$keyword) { $where['limit'] = '0,50'; $data = Dever::db('store/author')->getAll($where); } else { $where['name'] = $keyword; $data = Dever::db('store/author')->getAll($where); } $insert = array(); if (!$data && $keyword) { $insert[0]['name'] = $keyword . '[新增]'; $insert[0]['value'] = $keyword; } $result = array(); if ($yes) { foreach ($yes as $k => $v) { if (isset($data[$k])) { unset($data[$k]); } $yes[$k]['selected'] = 'selected'; } $data = $insert + $yes + $data; $data = array_merge($data, array()); } else { $data = $insert + $data; $data = array_merge($data, array()); } if (!$data) { Dever::alert('暂无数据'); } return $data; } }