站点工具

New release available: 2020-07-29 "Hogfather". upgrade now! [51.3] (what's this?)
New release candidate 3 available: 2020-06-09 "Hogfather". upgrade now! [51.2] (what's this?)
New release candidate 2 available: 2020-06-01 "Hogfather". upgrade now! [51.1] (what's this?)
New release candidate available: 2020-06-01 "Hogfather". upgrade now! [51] (what's this?)
Hotfix release available: 2018-04-22c "Greebo". upgrade now! [50.3] (what's this?)
Hotfix release available: 2018-04-22b "Greebo". upgrade now! [50.2] (what's this?)
Hotfix release available: 2018-04-22a "Greebo". upgrade now! [50.1] (what's this?)
New release available: 2018-04-22 "Greebo". upgrade now! [50] (what's this?)
Hotfix release available: 2017-02-19g "Frusterick Manners". upgrade now! [49.7] (what's this?)
Hotfix release available: 2017-02-19f "Frusterick Manners". upgrade now! [49.6] (what's this?)
Hotfix release available: 2017-02-19e "Frusterick Manners". upgrade now! [49.5] (what's this?)
Hotfix release available fixing CVE-2017-12979 and CVE-2017-12980: 2017-02-19d "Frusterick Manners". upgrade now! [49.4] (what's this?)
Hotfix release available fixing CVE-2017-12583: 2017-02-19c "Frusterick Manners". upgrade now! [49.3] (what's this?)
Hotfix release available fixing security token and media manager: 2017-02-19b "Frusterick Manners". upgrade now! [49.2] (what's this?)
Hotfix release available fixing install and media manager issues: 2017-02-19a "Frusterick Manners". upgrade now! [49.1] (what's this?)
New release available: 2017-02-19 "Frusterick Manners". upgrade now! [49] (what's this?)
Hotfix release available: 2016-06-26e "Elenor of Tsort". upgrade now! [48.5] (what's this?)
Hotfix release available fixing CVE-2017-12979 and CVE-2017-12980: 2016-06-26d "Elenor of Tsort". upgrade now! [48.4] (what's this?)
Hotfix release available fixing CVE-2017-12583: 2016-06-26c "Elenor of Tsort". upgrade now! [48.3] (what's this?)
Hotfix release available fixing security token: 2016-06-26b "Elenor of Tsort". upgrade now! [48.2] (what's this?)
Hotfix release available fixing authad issues: 2016-06-26a "Elenor of Tsort". upgrade now! [48.1] (what's this?)
New release available: 2016-06-26 "Elenor of Tsort". upgrade now! [48] (what's this?)
Hotfix release available: 2015-08-10a "Detritus". upgrade now! [47.1] (what's this?)
New release available: 2015-08-10 "Detritus". upgrade now! [47] (what's this?)
Hotfix release available: 2014-09-29d "Hrun". upgrade now! [46.4] (what's this?)
Hotfix release available: 2014-09-29c "Hrun". upgrade now! [46.3] (what's this?)
Hotfix release available to prevent XSS attack via SWF uploads: 2014-09-29b "Hrun". upgrade now! [46.2] (what's this?)
Hotfix release available: 2014-09-29a "Hrun". upgrade now! [46.1] (what's this?)
New release available: 2014-09-29 "Hrun". upgrade now! [46] (what's this?)
Hotfix release available: 2014-05-05e "Ponder Stibbons". upgrade now! [44.5] (what's this?)
Hotfix release available: 2014-05-05d "Ponder Stibbons". upgrade now! [44.4] (what's this?)
Hotfix release available to prevent XSS attack via SWF uploads: 2014-05-05c "Ponder Stibbons". upgrade now! [44.3] (what's this?)
Security Hotfix 2014-05-05b to prevent zero byte attacks on external auth systems is available. upgrade now! [44.2] (what's this?)
Security Hotfix 2014-05-05a for Issue 765 available. upgrade now! [44.1] (what's this?)

upload_avatar

用户头像上传、获取接口

1、用户头像上传接口(客户端调用,POST方式上传)

https://m.repai.com/user/upload_avatar_api/access_token/rpat_47be0653fe75e8ae3f3d4fa5de931c24

其中 rpat_47be0653fe75e8ae3f3d4fa5de931c24 为 access_token 示例。

输入参数说明:

  • POST内容 【form表单方式上传,构造的form表单格式示例如下,name名称需要命名为upload,编码格式需要为multipart/form-data】
<form action="https://m.repai.com/user/upload_avatar_api/access_token/rpat_2cfcda0cf07ba2fa9b68f5fcb15c66c4" method="post" enctype="multipart/form-data">
<input name="upload" type="file" />
<input type="submit" name="Submit" value="上传" />
</form>

HTML表单上传文件网址示例:http://doc.repai.com/example/upload.htm

PHP跟curl模拟表单上传的代码示例如下:

<?php
$post_data = array (
	"upload" => "@".dirname(__FILE__)."/upload_avatar_api.jpg"
);

$result = model_curl_post("https://m.repai.com/user/upload_avatar_api/access_token/rpat_2cfcda0cf07ba2fa9b68f5fcb15c66c4", "", $post_data);
var_dump($result);

function model_curl_post($url,$userAgent="",$fields=""){
	$userAgent = $userAgent ? $userAgent : 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A405';
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_TIMEOUT, 10);
	curl_setopt ( $ch, CURLOPT_USERAGENT, $userAgent );
	if ($fields) {
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);   
	}
	$data = curl_exec($ch);
	return $data;
}
?>

输出参数说明:

  • JSON格式输出,错误时,status值为false,reason为失败原因,示例如下:
{
"reason": "上传失败,请重新上传或检查是否已经登录!",
"status": false
}
  • JSON格式输出,正确时,status值为true,表示上传成功,并输出头像地址,示例如下:
{
"pic_medium": "http://pic.repaiapp.com/pic/96/54/2b/96542b7b78e94383b023af4b4e64f083de9f2bc8.png@0e_400w_400h_0c_0i_1o_90Q_1x.jpg",
"pic_small": "http://pic.repaiapp.com/pic/96/54/2b/96542b7b78e94383b023af4b4e64f083de9f2bc8.png@0e_120w_120h_0c_0i_1o_90Q_1x.jpg",
"reason": "上传成功!",
"status": true
}
  • status 【是否上传成功,true为已上传成功,false为未登录或未上传成功】
  • reason 【上传成功或失败的文本提示】
  • pic_medium 【头像中等大小图,400×400】
  • pic_small 【头像小图,120×120】

2、用户头像图片地址获取接口(客户端调用,GET方式获取)

https://m.repai.com/user/get_avatar_api/access_token/rpat_47be0653fe75e8ae3f3d4fa5de931c24

其中 rpat_47be0653fe75e8ae3f3d4fa5de931c24 为 access_token 示例。

输入参数说明:


输出参数说明:

  • JSON格式输出,无头像时、或没有登录时,status值为false,示例如下:
{
"reason": "用户没有上传头像!",
"status": false
}

{
"reason": "用户没有登录!",
"status": false
}
  • JSON格式输出,有头像时,status值为true,并输出头像地址,示例如下:
{
"pic_medium": "http://pic.repaiapp.com/pic/96/54/2b/96542b7b78e94383b023af4b4e64f083de9f2bc8.png@0e_120w_120h_0c_0i_1o_90Q_1x.jpg",
"pic_small": "http://pic.repaiapp.com/pic/96/54/2b/96542b7b78e94383b023af4b4e64f083de9f2bc8.png@0e_400w_400h_0c_0i_1o_90Q_1x.jpg",
"reason": "用户拥有头像!",
"status": true
}
  • status 【是否有头像,true为有,false为无】
  • reason 【用户拥有头像的文本提示】
  • pic_medium 【头像中等大小图,400×400】
  • pic_small 【头像小图,120×120】

返回首页

upload_avatar.txt · 最后更改: 2014/08/12 23:58 由 123.113.149.199