/** * _construct * * 构造方法 * @access public * @since 5 * @param string $access_token access_token value * @param string $openid openid value * @return Object QC */ public function __construct($access_token = "", $openid = "") { parent::__construct(); //如果access_token和openid为空,则从session里去取,适用于demo展示情形 if ($access_token === "" || $openid === "") { $this->keysArr = array("oauth_consumer_key" => (int) $this->recorder->readInc("appid"), "access_token" => $this->recorder->read("access_token"), "openid" => $this->recorder->read("openid")); } else { $this->keysArr = array("oauth_consumer_key" => (int) $this->recorder->readInc("appid"), "access_token" => $access_token, "openid" => $openid); } //初始化APIMap /* * 加#表示非必须,无则不传入url(url中不会出现该参数), "key" => "val" 表示key如果没有定义则使用默认值val * 规则 array( baseUrl, argListArr, method) */ $this->APIMap = array("add_blog" => array("https://graph.qq.com/blog/add_one_blog", array("title", "format" => "json", "content" => null), "POST"), "add_topic" => array("https://graph.qq.com/shuoshuo/add_topic", array("richtype", "richval", "con", "#lbs_nm", "#lbs_x", "#lbs_y", "format" => "json", "#third_source"), "POST"), "get_user_info" => array("https://graph.qq.com/user/get_user_info", array("format" => "json"), "GET"), "add_one_blog" => array("https://graph.qq.com/blog/add_one_blog", array("title", "content", "format" => "json"), "GET"), "add_album" => array("https://graph.qq.com/photo/add_album", array("albumname", "#albumdesc", "#priv", "format" => "json"), "POST"), "upload_pic" => array("https://graph.qq.com/photo/upload_pic", array("picture", "#photodesc", "#title", "#albumid", "#mobile", "#x", "#y", "#needfeed", "#successnum", "#picnum", "format" => "json"), "POST"), "list_album" => array("https://graph.qq.com/photo/list_album", array("format" => "json")), "add_share" => array("https://graph.qq.com/share/add_share", array("title", "url", "#comment", "#summary", "#images", "format" => "json", "#type", "#playurl", "#nswb", "site", "fromurl"), "POST"), "check_page_fans" => array("https://graph.qq.com/user/check_page_fans", array("page_id" => "314416946", "format" => "json")), "add_t" => array("https://graph.qq.com/t/add_t", array("format" => "json", "content", "#clientip", "#longitude", "#compatibleflag"), "POST"), "add_pic_t" => array("https://graph.qq.com/t/add_pic_t", array("content", "pic", "format" => "json", "#clientip", "#longitude", "#latitude", "#syncflag", "#compatiblefalg"), "POST"), "del_t" => array("https://graph.qq.com/t/del_t", array("id", "format" => "json"), "POST"), "get_repost_list" => array("https://graph.qq.com/t/get_repost_list", array("flag", "rootid", "pageflag", "pagetime", "reqnum", "twitterid", "format" => "json")), "get_info" => array("https://graph.qq.com/user/get_info", array("format" => "json")), "get_other_info" => array("https://graph.qq.com/user/get_other_info", array("format" => "json", "#name", "fopenid")), "get_fanslist" => array("https://graph.qq.com/relation/get_fanslist", array("format" => "json", "reqnum", "startindex", "#mode", "#install", "#sex")), "get_idollist" => array("https://graph.qq.com/relation/get_idollist", array("format" => "json", "reqnum", "startindex", "#mode", "#install")), "add_idol" => array("https://graph.qq.com/relation/add_idol", array("format" => "json", "#name-1", "#fopenids-1"), "POST"), "del_idol" => array("https://graph.qq.com/relation/del_idol", array("format" => "json", "#name-1", "#fopenid-1"), "POST"), "get_tenpay_addr" => array("https://graph.qq.com/cft_info/get_tenpay_addr", array("ver" => 1, "limit" => 5, "offset" => 0, "format" => "json"))); }
/** * _construct * * 构造方法 * @access public * @since 5 * @param string $access_token access_token value * @param string $openid openid value * @return Object QC */ public function __construct($access_token = "", $openid = "") { parent::__construct(); //如果access_token和openid为空,则从session里去取,适用于demo展示情形 if ($access_token === "" || $openid === "") { $this->keysArr = array("oauth_consumer_key" => (int) $this->recorder->readInc("appid"), "access_token" => $this->recorder->read("access_token"), "openid" => $this->recorder->read("openid")); } else { $this->keysArr = array("oauth_consumer_key" => (int) $this->recorder->readInc("appid"), "access_token" => $access_token, "openid" => $openid); } //初始化APIMap /* * 加#表示非必须,无则不传入url(url中不会出现该参数), "key" => "val" 表示key如果没有定义则使用默认值val * 规则 array( baseUrl, argListArr, method) */ $this->APIMap = array("get_user_info" => array("https://api.weixin.qq.com/sns/userinfo", array("format" => "json"), "GET")); }
public function __construct($clientId, $clientSecret, $redirectUrl, $state = null) { parent::__construct($clientId, $clientSecret, $redirectUrl, $state); }