public function get_mention() { $appid = intval($this->input['appid']); $platid = intval($this->input['id']); $token = urldecode($this->input['access_plat_token']); $since_id = urldecode($this->input['since_id']); $page = $this->input['page'] ? intval($this->input['page']) : 1; $count = intval($this->input['count']) ? intval($this->input['count']) : 50; //先判断token有没有过期 if ($token) { $checktoken = $this->pub->share_check_token($token); } else { $checktoken['msg'] = false; } if ($checktoken['msg'] !== 'new' && $checktoken['msg']) { $platdata = $this->obj->get_by_app_plat($checktoken['data']['appid'], $checktoken['data']['platId']); include_once CUR_CONF_PATH . 'lib/' . $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_oauth.php'; $action = $this->settings['share_plat'][$platdata['type']]['name'] . '_get_mention'; $ret = $this->{$action}($checktoken, $since_id, $page, $count); $this->addItem($ret); $this->output(); } else { include CUR_CONF_PATH . 'lib/oauthlogin.class.php'; $oauthlogin = new oauthlogin(); if ($appid && $platid) { $ret = $oauthlogin->oauthlogin($appid, $platid, $token); } else { $this->errorOutput('NO_APPID_PLATID'); } $ret['error'] = 1; $this->addItem($ret); $this->output(); } }
/** * 同上,输出内容不同 * @name share * @access public * @author * @category hogesoft * @copyright hogesoft * @return data or false */ public function get_type() { $plat_type = array(); $id = intval($this->input['appid']); if (!$id) { $this->errorOutput('NO_APP_INFO'); } $app = $this->obj->get_app_by_systemId($id); if (empty($app)) { $this->errorOutput('NO_PLAT_DATA'); } $platdatas = $this->obj->get_plat_supportid('id,name,picurl,type', $app['platIds'], 'id'); if (is_array($platdatas) && count($platdatas) > 0) { include_once CUR_CONF_PATH . 'lib/oauthlogin.class.php'; $oauthlogin = new oauthlogin(); foreach ($platdatas as $k => $v) { $plat = $oauthlogin->oauthlogin($id, $v['id']); $v['url'] = $plat['sync_third_auth'] . '?oauth_url=' . $plat['oauth_url'] . '&access_plat_token=' . $plat['access_plat_token'] . "&other=1&access_token=" . $this->user['token'] . "&uid=" . $uid; $this->addItem($v); } } $this->output(); // foreach($platdatas as $v) // { // $plat_type[$v['type']] = $this->settings['share_plat'][$v['type']]['name_ch']; // } // $this->addItem($plat_type); // $this->output(); }
/** * 根据系统id,分享平台id * @name share * @access public * @author * @category hogesoft * @copyright hogesoft * @return */ public function revoke() { $appid = intval($this->input['appid']); $platid = intval($this->input['id']); $plat_type = intval($this->input['plat_type']); $token = urldecode($this->input['access_plat_token']); //先判断token有没有过期 if ($token) { $checktoken = $this->pub->share_check_token($token); } else { $checktoken['msg'] = false; } if ($checktoken['msg'] !== 'new' && $checktoken['msg']) { include_once CUR_CONF_PATH . 'lib/' . $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_oauth.php'; $action = $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_revoke'; $ret = $this->{$action}($checktoken); if (!empty($ret['error'])) { $this->errorOutput($ret['error']); } else { //删除access_plat_token auth_user表中数据 $this->obj->delete_access_plat_token($token); if (!empty($checktoken['data']['access_token']['uid'])) { $uid = $checktoken['data']['access_token']['uid']; } if (!empty($checktoken['data']['access_token']['name'])) { $name = $checktoken['data']['access_token']['name']; } if ($uid && $name) { $this->obj->delete_auth_user($checktoken['data']['platId'], $uid, $name); } $this->addItem($ret); $this->output(); } } else { include CUR_CONF_PATH . 'lib/oauthlogin.class.php'; $oauthlogin = new oauthlogin(); if ($appid && $platid) { $ret = $oauthlogin->oauthlogin($appid, $platid, $token); } else { if ($platid || !$plat_type) { $this->errorOutput('NO_APPID_PLATID'); } else { $plat = $this->obj->get_plat_by_type($appid, $plat_type); if (empty($plat)) { $this->errorOutput('NO_ANY_PLAT'); } $ret = $oauthlogin->oauthlogin($appid, $plat['id'], $token); } } $ret['error'] = 1; $this->addItem($ret); $this->output(); } }
public function get_user_timeline() { // $this->input = array ( // 'format' => 'json', // 'appid' => '55', // 'id' => '88', // 'uid' => '', // 'name' => '易建联', // 'access_plat_token' => '9224ec0aadf60c124d3007ec352a3cac', // 'since_id' => '0', // 'page' => '1', // 'count' => '50', // 'lpip' => '', // 'm2o_ckey' => 'OjEN52E9LieIe9yx8mfDZEpDlUnxuya9', // 'access_token' => 'b786098710ac38134ec0249ee8ff5b6b', // ); // file_put_contents('./cache/111.txt',var_export($this->input,1)); $appid = intval($this->input['appid']); $platid = intval($this->input['id']); $token = urldecode($this->input['access_plat_token']); $uid = urldecode($this->input['uid']); $name = urldecode($this->input['name']); $since_id = urldecode($this->input['since_id']); $page = urldecode($this->input['page']); //如果是tx 则表示是pagetime $count = urldecode($this->input['count']); //先判断token有没有过期 if ($token) { $checktoken = $this->pub->share_check_token($token); } else { $checktoken['msg'] = false; } // print_r($checktoken); if ($checktoken['msg'] !== 'new' && $checktoken['msg']) { $platdata = $this->obj->get_by_app_plat($checktoken['data']['appid'], $checktoken['data']['platId']); include_once CUR_CONF_PATH . 'lib/' . $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_oauth.php'; $action = $this->settings['share_plat'][$platdata['type']]['name'] . '_user_timeline'; $ret = $this->{$action}($checktoken, $uid, $name, $since_id, $page, $count); // file_put_contents('./cache/222.txt',var_export($ret,1)); $this->addItem($ret); $this->output(); } else { include CUR_CONF_PATH . 'lib/oauthlogin.class.php'; $oauthlogin = new oauthlogin(); if ($appid && $platid) { $ret = $oauthlogin->oauthlogin($appid, $platid, $token); } else { $this->errorOutput('NO_APPID_PLATID'); } $ret['error'] = 1; $this->addItem($ret); $this->output(); } }
/** * 根据系统id,分享平台id * @name share * @access public * @author * @category hogesoft * @copyright hogesoft * @return */ public function comments() { $appid = intval($this->input['appid']); $platid = intval($this->input['id']); $plat_type = intval($this->input['plat_type']); $weibo_id = urldecode($this->input['weibo_id']); $comment_id = urldecode($this->input['comment_id']); $comment = urldecode($this->input['comment']); $comment_ori = intval($this->input['comment_ori']); //当评论转发微博时,是否评论给原微博,0:否、1:是,默认为0。 $token = urldecode($this->input['access_plat_token']); //先判断token有没有过期 if ($token) { $checktoken = $this->pub->share_check_token($token); } else { $checktoken['msg'] = false; } if ($checktoken['msg'] !== 'new' && $checktoken['msg']) { include_once CUR_CONF_PATH . 'lib/' . $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_oauth.php'; $action = $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_comments'; $ret = $this->{$action}($checktoken, $weibo_id, $comment, $comment_ori, $comment_id); if (!empty($ret['error'])) { $this->errorOutput($ret['error']); } else { $this->addItem($ret); $this->output(); } $this->addItem($ret); $this->output(); } else { include CUR_CONF_PATH . 'lib/oauthlogin.class.php'; $oauthlogin = new oauthlogin(); if ($appid && $platid) { $ret = $oauthlogin->oauthlogin($appid, $platid, $token); } else { if ($platid || !$plat_type) { $this->errorOutput('NO_APPID_PLATID'); } else { $plat = $this->obj->get_plat_by_type($appid, $plat_type); if (empty($plat)) { $this->errorOutput('NO_ANY_PLAT'); } $ret = $oauthlogin->oauthlogin($appid, $plat['id'], $token); } } $ret['error'] = 1; $this->addItem($ret); $this->output(); } }
/** * 根据系统id,分享平台id * @name share * @access public * @author * @category hogesoft * @copyright hogesoft * @return */ public function oauthlogin() { $appid = intval($this->input['appid']); $platid = intval($this->input['id']); $access_plat_token = $this->input['access_plat_token']; include CUR_CONF_PATH . 'lib/oauthlogin.class.php'; $oauthlogin = new oauthlogin(); $ret = $oauthlogin->oauthlogin($appid, $platid, $access_plat_token); if ($ret == 'NO_PLAT_DATA') { $this->errorOutput('NO_PLAT_DATA'); } else { $this->addItem($ret); $this->output(); } }
/** * 根据系统id,分享平台id * @name share * @access public * @author * @category hogesoft * @copyright hogesoft * @return */ public function search_user() { $appid = intval($this->input['appid']); $platid = intval($this->input['id']); $keyword = urldecode($this->input['keyword']); $token = urldecode($this->input['access_plat_token']); $plat_type = urldecode($this->input['plat_type']); //先判断token有没有过期 if ($token) { $checktoken = $this->pub->share_check_token($token); } else { $checktoken['msg'] = false; } if ($checktoken['msg'] !== 'new' && $checktoken['msg']) { include_once CUR_CONF_PATH . 'lib/' . $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_oauth.php'; $action = $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_search_user'; $ret = $this->{$action}($checktoken, $keyword); $result['info'] = $ret; $result['platId'] = $checktoken['data']['platId']; $result['plat_type'] = $checktoken['data']['type']; $result['plat_type_name'] = $this->settings['share_plat'][$checktoken['data']['type']]['name_ch']; $this->addItem($result); $this->output(); } else { include CUR_CONF_PATH . 'lib/oauthlogin.class.php'; $oauthlogin = new oauthlogin(); if ($appid && $platid) { $ret = $oauthlogin->oauthlogin($appid, $platid, $token); } else { if ($platid || !$plat_type) { $this->errorOutput('NO_APPID_PLATID'); } else { $plat = $this->obj->get_plat_by_type($appid, $plat_type); if (empty($plat)) { $this->errorOutput('NO_ANY_PLAT'); } $ret = $oauthlogin->oauthlogin($appid, $plat['id'], $token); } } $ret['error'] = 1; $this->addItem($ret); $this->output(); } }
/** * 根据系统id,分享平台id * @name share * @access public * @author * @category hogesoft * @copyright hogesoft * @return */ public function get_user() { $uid = urldecode($this->input['uid']); $name = urldecode($this->input['name']); $appid = intval($this->input['appid']); $platid = intval($this->input['id']); $token = urldecode($this->input['access_plat_token']); //先判断token有没有过期 if ($token) { $checktoken = $this->pub->share_check_token($token); } else { $checktoken['msg'] = false; } if ($checktoken['msg'] !== 'new' && $checktoken['msg']) { if (!$name && !$uid) { if (!empty($checktoken['data']['access_token']['uid'])) { $uid = $checktoken['data']['access_token']['uid']; } else { if (!empty($checktoken['data']['access_token']['name'])) { $name = $checktoken['data']['access_token']['name']; } } } include_once CUR_CONF_PATH . 'lib/' . $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_oauth.php'; $action = $this->settings['share_plat'][$checktoken['data']['type']]['name'] . '_getuser'; $result = $this->{$action}($checktoken, $uid, $name); $this->addItem($result); $this->output(); } else { include CUR_CONF_PATH . 'lib/oauthlogin.class.php'; $oauthlogin = new oauthlogin(); if ($appid && $platid) { $ret = $oauthlogin->oauthlogin($appid, $platid, $token); } else { $this->errorOutput('NO_APPID_PLATID'); } $ret['error'] = 1; $this->addItem($ret); $this->output(); } }