one($id); if (!$info) { Dever::db('passport/system')->insert($data); } else { $data['where_id'] = $info['id']; $data['state'] = Dever::param('state', $param); if (!$name) { unset($data['name']); }; Dever::db('passport/system')->update($data); } return $info; } public function show($id) { $db = Dever::db('passport/user'); $user = $db->one($id); $config = $db->config; if ($user['avatar']) { $table['头像'] = ''; } elseif ($user['avatar_id'] > 0) { $avatar = Dever::db('passport/avatar')->one($user['avatar_id']); $table['头像'] = ''; } if ($user['area']) { $table['地区'] = $user['area']; } if (isset($user['address']) && $user['address']) { $table['详细地址'] = $user['address']; } if ($user['system_source']) { $table['来源'] = $config['system_source'][$user['system_source']]; } elseif ($user['source_type']) { $table['来源'] = $config['source_type'][$user['source_type']]; } if ($user['profession']) { $profession = Dever::db('passport/profession')->one($user['profession']); $table['职业'] = $profession['name']; } if ($user['sex']) { $table['性别'] = $config['sex'][$user['sex']]; } if ($user['wechat']) { $table['微信号'] = $user['wechat']; } if ($user['email']) { $table['邮箱'] = $user['email']; } if (Dever::project('invite')) { $invite = Dever::db('invite/code')->one(array('uid' => $user['id'])); if ($invite) { $table['邀请码'] = $invite['value']; } } return Dever::table($table); } public function showAvatar($id) { $db = Dever::db('passport/avatar'); $user = $db->one($id); if ($user['avatar']) { $table['头像'] = ''; } return Dever::table($table); } public function search_api() { $table = 'passport/user'; $keyword = Dever::input('keyword'); $yes = Dever::input('yes'); $where = array(); $cate = Dever::input('cate'); if ($cate) { $where['cate_id'] = $cate; } if ($yes) { $yes = Dever::db($table)->search(array('ids' => $yes)); } if (!$keyword) { $where['limit'] = '0,10'; $data = Dever::db($table)->search($where); } else { $where['username'] = $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'] = 'selected'; } $data = $yes + $data; $data = array_merge($data, array()); } else { $data = array_merge($data, array()); } if (!$data) { Dever::alert('暂无数据'); } return $data; } }