function getUserInfo($openid, $token, $update = false)
 {
     $user_key = 'Xydzp_getUserInfo_' . $openid . '_' . $token;
     $info = S($user_key);
     if ($info === false || $update) {
         $map['openid'] = $openid;
         $map['token'] = $token;
         $info = (array) M('user')->where($map)->find();
         isset($info['nickname']) && ($info['nickname'] = deal_emoji($info['nickname'], 1));
         S($user_key, $info);
     }
     return $info;
 }
Esempio n. 2
0
 /**
  * 显示用户公众号信息
  */
 function showPublic($uid)
 {
     if (!empty($uid)) {
         $map['uid'] = $uid;
         $ucanter = M('user')->where($map)->find();
         isset($ucanter['nickname']) && ($ucanter['nickname'] = deal_emoji($ucanter['nickname'], 1));
         $public = M('public')->where($map)->find();
         $this->assign('ucanter', $ucanter);
         $this->assign('public', $public);
     }
     $this->display();
 }
 function searchUser($key)
 {
     if (empty($key)) {
         return 0;
     }
     $key2 = str_replace('\\u', '\\\\\\\\u', trim(deal_emoji($key, 0), '"'));
     // 搜索用户表
     $where = "nickname LIKE '%{$key}%' OR nickname LIKE '%{$key2}%' OR truename LIKE '%{$key}%' OR truename LIKE '%{$key2}%'";
     $uids = (array) $this->where($where)->getFields('uid');
     // 搜索用户名备注
     $where2 = "remark LIKE '%{$key}%'";
     $uids2 = (array) M('public_follow')->where($where2)->getFields('uid');
     $uids = array_unique(array_merge($uids, $uids2));
     if (empty($uids)) {
         return 0;
     } else {
         return implode(',', $uids);
     }
 }
 function export()
 {
     set_time_limit(0);
     $umap['u.status'] = array('gt', 0);
     $umap['f.token'] = get_token();
     $gid = I('id', 0);
     if ($gid) {
         $map['group_id'] = $gid;
         $uids = M('auth_group_access')->where($map)->getFields('uid');
         if (!empty($uids)) {
             $umap['u.uid'] = array('in', $uids);
         } else {
             $umap['u.uid'] = 0;
         }
     }
     $order = 'u.uid asc';
     $px = C('DB_PREFIX');
     $field = 'u.uid,nickname,truename,mobile,sex,province,city,score,experience,f.openid';
     $data = M()->table($px . 'public_follow as f')->join($px . 'user as u ON f.uid=u.uid')->field($field)->where($umap)->order($order)->select();
     $sexArr = array(0 => '保密', 1 => '男', 2 => '女');
     foreach ($data as $k => &$vo) {
         $vo['sex'] = $sexArr[$vo['sex']];
         $vo['nickname'] = deal_emoji($vo['nickname'], 1);
     }
     $ht = array('用户编号', '昵称', '姓名', '联系电话', '性别', '省份', '城市', '金币值', '经验值', 'OpenID');
     $dataArr[0] = $ht;
     $dataArr = array_merge($dataArr, (array) $data);
     // 		dump($dataArr);
     outExcel($dataArr, $map['module']);
     // 		vendor ( 'out-csv' );
     // 		export_csv ( $dataArr, 'user_export' );
 }
Esempio n. 5
0
 function _deal_nickname($data, $type = 0)
 {
     if (isset($data['nickname'])) {
         $data['nickname'] = deal_emoji($data['nickname'], $type);
     }
     return $data;
 }