@kyletiao
2016-03-18T13:12:22.000000Z
字数 8704
阅读 2320
账号中心 使用文档所有输入值及返回值都以json字符串形式表现。
所有返回值格式固定,格式如下:
{"code":返回值代码(000000为正确,其他都是错误返回,错误码信息详见附录),"msg":信息,"data":数据(json格式)}
接口地址:
http://u9usercenter.yonyou.com/service/login
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| username | 用户名 | 32 | Y |
| password | 密码 | 32 | Y |
返回值:
{"code":"000000","msg":"ok","data":{"ticket":用户标识,"timestap":时间戳,"userinfo":{"dis_name":显示名称,"avatar":头像地址,"wxid":微信id,"email":邮箱,"tel":电话}}}
接口地址:
http://u9usercenter.yonyou.com/account/register
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| tel | 电话 | 32 | Y |
| 邮箱 | 64 | Y | |
| wxid | 微信unionid | 64 | Y |
| dis_name | 显示名称 | 64 | Y |
| avatar | 头像 | 64 | N |
| password | 密码 | 64 | Y |
返回值:
{"code":"000000","msg":"ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/account/register4list
传入参数格式:
[{"tel":"电话","email":"邮箱","wxid":"微信unionid","dis_name":"显示名称","avatar":"头像","password":"密码"}]
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| tel | 电话 | 32 | Y |
| 邮箱 | 64 | Y | |
| wxid | 微信unionid | 64 | Y |
| dis_name | 显示名称 | 64 | Y |
| avatar | 头像 | 64 | N |
| password | 密码 | 64 | Y |
返回值:
[{"code":"000000","msg":"ok","data":{"ticket":用户标识,"timestap":时间戳,"userinfo":{"dis_name":显示名称,"avatar":头像地址,"wxid":微信id,"email":邮箱,"tel":电话}},{"code":"错误码","msg":"错误提示","data":{"dis_name":显示名称,"avatar":头像地址,"wxid":微信id,"email":邮箱,"tel":电话}},]
接口地址:
http://u9usercenter.yonyou.com/account/checkusername
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| type | 用户名类型(email邮箱/tel电话/wxid微信id) | 32 | Y |
| value | 用户名值 | 64 | Y |
返回值:
{"code":"000000","msg":"ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/account/resetpassword
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户唯一标识 | 32 | Y |
| oldpassowrd | 原始密码 | 32 | Y |
| password | 新密码 | 32 | Y |
返回值:
{"code":"000000","msg":"ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/service/islogin
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户标识 | 32 | Y |
如果不录入参数,择取cookie中的ticket
返回值:
{"code":"000000","msg":"ok","data":{"ticket":用户标识,"timestap":时间戳,"userinfo":{"dis_name":显示名称,"avatar":头像地址,"wxid":微信id,"email":邮箱,"tel":电话}}}
接口地址:
http://u9usercenter.yonyou.com/service/logout
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户标识 | 32 | Y |
如果不录入参数,择取cookie中的ticket
返回值:
返回值:
{"code":"000000","msg":"ok","data":{}}}
接口地址:
http://u9usercenter.yonyou.com/account/setuserinfo
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户标识 | 32 | Y |
| dis_name | 用户显示名 | 32 | Y |
| 邮箱 | 64 | Y | |
| tel | 手机 | 32 | Y |
| avatar | 用户头像地址 | 32 | Y |
如果不录入参数,择取cookie中的ticket
返回值:
{"code":"000000","msg":"ok","data":{}}}
接口地址:
http://u9usercenter.yonyou.com/account/sendchekcode
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| tel | 电话号码 | 32 | Y |
返回值:
{"code":"000000","msg":"ok","data":{}}}
接口地址:
http://u9usercenter.yonyou.com/account/viladatachekcode
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| tel | 电话号码 | 32 | Y |
| checkcode | 手机校验码 | 32 | Y |
返回值:
{"code":"000000","msg":"ok","data":{}}}
接口地址:
http://u9usercenter.yonyou.com/account/sendpasswordemail
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| 电子邮件 | 32 | Y |
返回值:
{"code":"000000","msg":"ok","data":{}}}
接口地址:
http://u9usercenter.yonyou.com/actionlog/add
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户标识 | 32 | Y |
| accountkey | 应用标识 | 32 | Y |
| action | 动作描述 | 64 | Y |
| action_des | 动作描述 | 64 | Y |
如果不录入参数,择取cookie中的ticket
返回值:
{"code":"000000","msg":"ok","data":{}}}
接口地址:
http://u9usercenter.yonyou.com/wechat/login
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| code | 微信登录界面返回code | 32 | Y |
返回值:
{"code":"000000","msg":"ok","data":{"ticket":用户标识,"isregister":是否注册(1已经注册 0未注册)"timestap":时间戳,"userinfo":{"dis_name":显示名称,"avatar":头像地址,"wxid":微信id,"email":邮箱,"tel":电话}}}
接口地址:
http://u9usercenter.yonyou.com/account/setpwdbyticket
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户标识 | 32 | Y |
| dis_name | 用户显示名 | 32 | Y |
| 邮箱 | 64 | Y | |
| tel | 手机 | 32 | Y |
| avatar | 用户头像地址 | 32 | Y |
| password | 密码 | 32 | Y |
返回值:
{"code":"000000","msg":"ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/account/getuserinfolist
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticketlist | 用户标识串,用“,”分割 | 32 | Y |
返回值:
{"code": "000000","msg": "ok","data": [{"ticket": "27ed0fb950b856b06e1273989422e7d3","userinfo": {"tel": "1333333333785","email": "7851@qq.com","dis_name": "niming785","wxid": "wx1785","avatar": ""}},{"ticket": "6d70cb65d15211726dcce4c0e971e21c","userinfo": {"tel": "1333333333784","email": "7841@qq.com","dis_name": "niming784","wxid": "wx1784","avatar": ""}}]}
接口地址:
http://u9usercenter.yonyou.com/u9info/add
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| name | u9网关标识 | 32 | Y |
| netgate | 网关地址 | 255 | Y |
| port | 网关端口 | 32 | Y |
| customername | 用户名称 | 32 | Y |
返回值:
{"code": "000000","msg": "ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/u9info/update
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| id | u9网关记录id | 32 | Y |
| name | u9网关标识 | 32 | N |
| netgate | 网关地址 | 255 | N |
| port | 网关端口 | 32 | N |
| customername | 用户名称 | 32 | N |
返回值:
{"code": "000000","msg": "ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/u9info/delete
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| id | u9网关记录id | 32 | Y |
返回值:
{"code": "000000","msg": "ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/u9info/delete
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| id | u9网关记录id | 32 | Y |
返回值:
{"code": "000000","msg": "ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/u9info/delete
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| where | 匹配条件目前匹配name字段 | 32 | N |
| currentPage | 当前页码分页用 | 32 | N |
| itemsPerPage | 每页显示数量 | 32 | N |
返回值:
{"code": "000000","msg": "ok","data":[{"id":"id","name":"U9网关标识","netgate":"网关地址","port":"网关端口","customername":"用户名称"}]}
接口地址:
http://u9usercenter.yonyou.com/userroutes/add
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户唯一标识 | 32 | Y |
| netgate | 网关地址 | 255 | Y |
| port | 网关端口 | 32 | Y |
返回值:
{"code": "000000","msg": "ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/userroutes/update
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| id | 用户唯一标识 | 32 | Y |
| netgate | 网关地址 | 255 | Y |
| port | 网关端口 | 32 | Y |
返回值:
{"code": "000000","msg": "ok","data":{}}
接口地址:
http://u9usercenter.yonyou.com/userroutes/delete
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| id | 用户唯一标识 | 32 | Y |
返回值:
{"code": "000000","msg": "ok","data":[{"id":"id","ticket":"用户标识","netgate":"网关地址","port":"网关端口"}]}
接口地址:
http://u9usercenter.yonyou.com/userroutes/getlist
传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户唯一标识 | 32 | Y |
返回值:
{"code": "000000","msg": "ok","data":{}}
所有访问用户中心接口的链接都必须带上相关sign校验,相关校验规则如下:
接入的系统在接入之前需线下申请获得accoutkey作为介入应用的唯一标识。在访问接口的最末尾以get形式拼接参数。参数如下
accountkey:app的唯一key
timestap:unix时间戳
sign:sha1(accountkey+timstap)
sign是通过sha1算法加密的accountkey和时间戳的字符串链 例子如下:
app1分配的accountkey为202cb962ac59075b964b07152d234b70
;当前时间戳为1446452796;那么需要加密的字符串为202cb962ac59075b964b07152d234b701446452796;通过sha1加密后得出结果04234f42cced998f043feb83377e757feebbc261;访问链接为http://server/login;经过参数拼接得出的访问地址为http://server/login?accountkey=202cb962ac59075b964b07152d234b70&tiemstap=1446452796&sign=04234f42cced998f043feb83377e757feebbc261
sha1算法 java代码demo
public static String SHA1(String decript) {try {MessageDigest digest = java.security.MessageDigest.getInstance("SHA-1");digest.update(decript.getBytes());byte messageDigest[] = digest.digest();// Create Hex StringStringBuffer hexString = new StringBuffer();// 字节数组转换为 十六进制 数for (int i = 0; i < messageDigest.length; i++) {String shaHex = Integer.toHexString(messageDigest[i] & 0xFF);if (shaHex.length() < 2) {hexString.append(0);}hexString.append(shaHex);}return hexString.toString();} catch (NoSuchAlgorithmException e) {e.printStackTrace();}return "";}
sha1算法 php代码demo
<?phpsha1($strtemp);
sha1算法 c#代码demo
public static string HashCode(string str){string rethash = "";try{System.Security.Cryptography.SHA1 hash = System.Security.Cryptography.SHA1.Create();System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding();byte[] combined = encoder.GetBytes(str);hash.ComputeHash(combined);rethash = Convert.ToBase64String(hash.Hash);}catch (Exception ex){string strerr = "Error in HashCode : " + ex.Message;}return rethash;}
js中处理sha1加密 可以在页面引用引用相关js的sha1加密库
用法
<!DOCTYPE HTML><html><head><meta charset="utf-8"><title>sha1加密</title><script type="text/ecmascript" src="sha1.js"></script><script type="text/javascript">var sha = hex_sha1('mima123465')alert(sha)</script></head><body></body></html>
页面地址:
http://u9usercenter.yonyou.com/login.html
get传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| redirct | 回调地址 | Y |
页面回调行为:
完成登陆后将回调redirct传入的地址。同时以get形式传入相关用户信息。
例如传入的redirct=“http://www.baidu.com”,则运行后回调地址为http://www.baidu.com?ticket=xxxxxxx&dis_name=wanger&avatar=http://123/1.png
回调传入参数如下
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| ticket | 用户唯一标识 | Y | |
| dis_name | 用户显示名 | Y | |
| avatar | 头像地址 | Y |
页面地址:
http://u9usercenter.yonyou.com/register.html
get传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| redirct | 回调地址 | Y |
页面回调行为:
完成注册后将回调redirct传入的地址。同时以get形式传入相关用户信息。
例如传入的redirct=“http://www.baidu.com”,则运行后回调地址为http://www.baidu.com
回调传入参数如下
无
接口地址:
http://u9usercenter.yonyou.com/resetpassword.html
get传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| redirct | 回调地址 | Y |
页面回调行为:
完成注册后将回调redirct传入的地址。同时以get形式传入相关用户信息。
例如传入的redirct=“http://www.baidu.com”,则运行后回调地址为http://www.baidu.com
回调传入参数如下
无
接口地址:
http://u9usercenter.yonyou.com/updateuserinfo.html
get传入参数:
| 参数名称 | 字段名称 | 字段长度 | 是否必输 |
|---|---|---|---|
| redirct | 回调地址 | Y |
页面回调行为:
完成注册后将回调redirct传入的地址。同时以get形式传入相关用户信息。
例如传入的redirct=“http://www.baidu.com”,则运行后回调地址为http://www.baidu.com
回调传入参数如下
无
| 错误码 | 信息 |
|---|---|
| "000000" | "ok" |
| "100001" | "传入字段不完整" |
| "100002" | "用户没有登录" |
| "100003" | "ticket已经过期" |
| "100004" | "缺少sign参数" |
| "100005" | "sign校验失败" |
| "100006" | "用户名或者密码错误" |
| "100007" | "错误的类型" |
| "100008" | "已经有的数据" |
| "100009" | "缺少原始密码" |
| "100010" | "缺少密码" |
| "100011" | "原始密码输入错误" |
| "100012" | "缺少输入参数" |
| "100013" | "缺少用户名" |
| "100014" | "缺少密码" |
| "100015" | "短信发送不成功" |
| "100016" | "验证码失效" |
| "100017" | "验证码错误" |
| "100018" | "邮件发送不成功" |