| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 | 
							- <?php
 
- namespace User\Lib;
 
- use Dever;
 
- class Info
 
- {
 
-     public function manage_search_api()
 
-     {
 
-         $table = 'user/info';
 
-         $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['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;
 
-     }
 
- }
 
 
  |