search(array('ids' => $yes)); } if (!$keyword) { $where['limit'] = '0,10'; $data = Dever::db($table)->search($where); } else { $where['search'] = $keyword; $data = Dever::db($table)->search($where); } $result = array(); if ($yes) { foreach ($yes as $k => $v) { if (isset($data[$k])) { unset($data[$k]); } $yes[$k]['selected'] = true; } $data = $yes + $data; $data = array_merge($data, array()); } else { $data = array_merge($data, array()); } if (!$data) { Dever::alert('暂无数据'); } return $data; } public function get($uid) { $info = Dever::db('user/info')->find($uid); if ($info) { if ($info['area']) { $info['area_string'] = Dever::load('area/api')->string($info['area']); } if (!$info['avatar'] && $info['avatar_id'] > 0) { $avatar = Dever::db('user/avatar')->one($info['avatar_id']); $info['avatar'] = $avatar['avatar']; } } return $info; } /** * 设置项目 * * @return mixed */ public function setProject($uid, $project) { $where['uid'] = $uid; $where['project_id'] = $project; $one = Dever::db('user/user_project')->find($where); if (!$one) { Dever::db('user/user_project')->insert($where); } } /** * 获取加密信息 * * @return mixed */ public function getSign($uid, $data = array()) { $data['signature'] = Dever::login($uid); return $data; } /** * 检测用户有效性 * * @return mixed */ public function check($state = true, $name = 'signature') { $signature = Dever::input($name); $user = Dever::checkLogin($signature, $state); if ($state && !isset($user['uid'])) { Dever::alert('user error'); } if (isset($user['uid']) && $user['uid']) { return $user['uid']; } return -1; } }