Ejemplo n.º 1
0
Archivo: QQ.php Proyecto: zuozuoba/zpf
 public function get_user_info()
 {
     $qq_safe_info = $this->callback();
     $access_token = $qq_safe_info['access_token'];
     $openid = $qq_safe_info['openid'];
     $user_info_url = "{$this->get_user_info_url}?access_token={$access_token}&oauth_consumer_key={$this->appid}&openid={$openid}&format=json";
     $info = Fun::getInstance()->curl_get($user_info_url);
     return array('openid' => $openid, 'user_info' => $info);
 }
Ejemplo n.º 2
0
 public function get_categories_with_businesses()
 {
     $api = $this->api . 'metadata/get_categories_with_deals';
     $a = array();
     $a['sign'] = $this->get_sign($a);
     $a['appkey'] = $this->appkey;
     $queryString = http_build_query($a);
     $url = $api . '?' . $queryString;
     $json = Fun::getInstance()->curl_get($url);
     return json_decode($json, true);
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     $this->fun = Fun::getInstance();
     $this->ip = $this->fun->getClientIp();
     $url = "http://api.map.baidu.com/location/ip?ak=bbCXktcD6Qrbxcpyp1DLkR8b&ip={$ip}&coor=bd09ll";
     $output = $this->fun->curl_get($url);
     $location = json_decode($output, true);
     $this->address_detail = $location['address'];
     $this->status = $location['status'];
     $this->address = $location['content']['address'];
     $this->porvince = $location['content']['address_detail']['porvince'];
     $this->city = $location['content']['address_detail']['city'];
     $this->city_code = $location['content']['address_detail']['city_code'];
     $this->district = $location['content']['address_detail']['district'];
     $this->street = $location['content']['address_detail']['street'];
     $this->street_number = $location['content']['address_detail']['street_number'];
     $this->x = $location['content']['point']['x'];
     $this->y = $location['content']['point']['y'];
 }
Ejemplo n.º 4
0
 public function pinyinac4()
 {
     $gamename = array(1 => '三国杀', 2 => '三国无双', 3 => '萌卡篮球', 4 => '梦幻三国', 5 => '上海', 6 => '上南');
     $node = array('gid' => array(), 'pinyin' => '', 'name' => '');
     $trees = array();
     // 存放拼音树
     $api = 'http://string2pinyin.sinaapp.com/?accent=0&delimiter=|&str=';
     $len = 0;
     foreach ($gamename as $gid => $gname) {
         $url = $api . $gname;
         $jsonPinyin = Fun::getInstance()->curl_get($url);
         $objPinyin = json_decode($jsonPinyin);
         $strPinyin = str_replace('|', '', $objPinyin->pinyin);
         $first_char = $strPinyin[0];
         $t = $node;
         $t['gid'] = $gid;
         $t['pinyin'] = $strPinyin;
         $t['name'] = $gname;
         $trees[$first_char][] = $t;
     }
     echo '<pre>';
     print_r($trees);
     $str = 'shang';
     $first_char = $str[0];
     //求相似度
     $similar = array();
     foreach ($trees[$first_char] as $k => $v) {
         $similar[$first_char][$k] = levenshtein($str, $v['pinyin']);
     }
     echo '<pre>';
     print_r($similar);
     exit;
 }
Ejemplo n.º 5
0
 public function initUserInfo()
 {
     //先判断是否有QQ登录过
     $objRedis = Load::getLib('iredis');
     $json_user_info = $objRedis->iget('qqsdk' . $this->cookierand, 'qquser');
     $userinfo = $this->getData('userinfo');
     if (!empty($json_user_info)) {
         $this->userinfo = json_decode($json_user_info, true);
     } elseif (!empty($userinfo)) {
         //查看cookie中有没有
         $json_user_info = urldecode($userinfo);
         $this->userinfo = json_decode($json_user_info, true);
     } else {
         //随机生成
         $this->userinfo['image'] = Fun::getInstance()->getRandImage();
         $this->userinfo['nickname'] = $this->loadBusiness('Test')->getRandArtNameForMain();
         $this->userinfo['type'] = 'rand';
         $json_user_info = json_encode($this->userinfo);
         setcookie('userinfo', urlencode($json_user_info), $this->intVisitTime + 86400 * 30, '/');
     }
     // $obj_user_info->image = Fun::getInstance()->getRandImage();
     return $this->userinfo;
 }