文档
测试

registerByOauth

POST
api/v1/registerByOauth

接口描述

第三方注册

请求参数

参数名
类型
描述
必填
openid
string
第三方标示openid
必填
nick
string
昵称
必填
avatar
string
头像
必填
gender
integer
性别 0未知 1男性 2女性
必填
province
string
省份
必填
city
string
城市
必填
返回结果
string
code=0 注册成功 code=201 已注册
必填

php请求demo

$client = new \GuzzleHttp\Client(); $response = $client->post( 'http://sns.shenruxiang.com/api/v1/registerByOauth', [ 'headers' => [ 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'json' => [ 'openid' => 'quisquam', 'nick' => 'voluptas', 'avatar' => 'officia', 'gender' => 11, 'province' => 'nostrum', 'city' => 'qui', '返回结果' => 'modi', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body));

JS请求demo

const url = new URL( "http://sns.shenruxiang.com/api/v1/registerByOauth" ); let headers = { "Content-Type": "application/json", "Accept": "application/json", }; let body = { "openid": "quisquam", "nick": "voluptas", "avatar": "officia", "gender": 11, "province": "nostrum", "city": "qui", "\u8fd4\u56de\u7ed3\u679c": "modi" } fetch(url, { method: "POST", headers: headers, body: body }) .then(response => response.json()) .then(json => console.log(json));

返回值

{ "code": 0, "msg": "请求成功", "data": { "id": 84, "user_name": "1599482388989", "nick": "昵称", "avatar": "\/avatar.jpg", "phone": "13012796666", "status": 1, "wechat": "", "openid": "111213213213", "province": "河北", "city": "石家庄", "token": "0d6dbab97bef8e7ed37ae10025e38df4", "login_time": "2020-09-07 12:39:48", "expire_time": 1608122388, "created_at": "2020-09-07 12:39:48", "session_key": null } }

bash

curl -X POST \ "http://sns.shenruxiang.com/api/v1/registerByOauth" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"openid":"quisquam","nick":"voluptas","avatar":"officia","gender":11,"province":"nostrum","city":"qui","\u8fd4\u56de\u7ed3\u679c":"modi"}'