mirror of
https://github.com/easychen/pushdeer.git
synced 2025-01-06 04:55:33 +08:00
修改错误返回,添加error字段,描述详细信息
This commit is contained in:
parent
30a1285d49
commit
ab2d820360
@ -30,7 +30,7 @@ class PushDeerDeviceController extends Controller
|
||||
|
||||
$uid = $_SESSION['uid'];
|
||||
if (strlen($uid) < 1) {
|
||||
return http_result(['error'=>'uid错误'], -1);
|
||||
return send_error('uid错误', ErrorCode('ARGS'));
|
||||
}
|
||||
|
||||
$the_device = [];
|
||||
@ -54,15 +54,15 @@ class PushDeerDeviceController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$pd_device = PushDeerDevice::where('id', $validated['id'])->get(['id', 'uid', 'name', 'type', 'device_id', 'is_clip'])->first();
|
||||
|
||||
if ($pd_device->uid == $_SESSION['uid']) {
|
||||
$pd_device->name = $validated['name'];
|
||||
$pd_device->save();
|
||||
return http_result(['message'=>'done']);
|
||||
if ($pd_device = PushDeerDevice::where('id', $validated['id'])->get(['id', 'uid', 'name', 'type', 'device_id', 'is_clip'])->first()) {
|
||||
if ($pd_device->uid == $_SESSION['uid']) {
|
||||
$pd_device->name = $validated['name'];
|
||||
$pd_device->save();
|
||||
return http_result(['message'=>'done']);
|
||||
}
|
||||
}
|
||||
|
||||
return http_result(['message'=>'error']);
|
||||
return send_error('设备不存在或已注销', ErrorCode('ARGS'));
|
||||
}
|
||||
|
||||
public function remove(Request $request)
|
||||
@ -73,13 +73,13 @@ class PushDeerDeviceController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$pd_device = PushDeerDevice::where('id', $validated['id'])->get(['id', 'uid', 'name', 'type', 'device_id', 'is_clip'])->first();
|
||||
|
||||
if ($pd_device->uid == $_SESSION['uid']) {
|
||||
$pd_device->delete();
|
||||
return http_result(['message'=>'done']);
|
||||
if ($pd_device = PushDeerDevice::where('id', $validated['id'])->get(['id', 'uid', 'name', 'type', 'device_id', 'is_clip'])->first()) {
|
||||
if ($pd_device->uid == $_SESSION['uid']) {
|
||||
$pd_device->delete();
|
||||
return http_result(['message'=>'done']);
|
||||
}
|
||||
}
|
||||
|
||||
return http_result(['message'=>'error']);
|
||||
return send_error('设备不存在或已注销', ErrorCode('ARGS'));
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class PushDeerKeyController extends Controller
|
||||
{
|
||||
$uid = $_SESSION['uid'];
|
||||
if (strlen($uid) < 1) {
|
||||
return http_result(['error'=>'uid错误'], -1);
|
||||
return send_error('uid错误', ErrorCode('ARGS'));
|
||||
}
|
||||
|
||||
$the_key = [];
|
||||
@ -45,15 +45,15 @@ class PushDeerKeyController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$pd_key = PushDeerKey::where('id', $validated['id'])->get(['id', 'name','uid', 'key','created_at'])->first();
|
||||
|
||||
if ($pd_key->uid == $_SESSION['uid']) {
|
||||
$pd_key->name = $validated['name'];
|
||||
$pd_key->save();
|
||||
return http_result(['message'=>'done']);
|
||||
if ($pd_key = PushDeerKey::where('id', $validated['id'])->get(['id', 'name','uid', 'key','created_at'])->first()) {
|
||||
if ($pd_key->uid == $_SESSION['uid']) {
|
||||
$pd_key->name = $validated['name'];
|
||||
$pd_key->save();
|
||||
return http_result(['message'=>'done']);
|
||||
}
|
||||
}
|
||||
|
||||
return http_result(['message'=>'error']);
|
||||
send_error('Key不存在或已删除', ErrorCode('ARGS'));
|
||||
}
|
||||
|
||||
public function regen(Request $request)
|
||||
@ -64,15 +64,15 @@ class PushDeerKeyController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$pd_key = PushDeerKey::where('id', $validated['id'])->get(['id', 'name','uid', 'key','created_at'])->first();
|
||||
|
||||
if ($pd_key->uid == $_SESSION['uid']) {
|
||||
$pd_key->key = 'PDU'.$pd_key->uid.'T'.Str::random(32);
|
||||
$pd_key->save();
|
||||
return http_result(['message'=>'done']);
|
||||
if ($pd_key = PushDeerKey::where('id', $validated['id'])->get(['id', 'name','uid', 'key','created_at'])->first()) {
|
||||
if ($pd_key->uid == $_SESSION['uid']) {
|
||||
$pd_key->key = 'PDU'.$pd_key->uid.'T'.Str::random(32);
|
||||
$pd_key->save();
|
||||
return http_result(['message'=>'done']);
|
||||
}
|
||||
}
|
||||
|
||||
return http_result(['message'=>'error']);
|
||||
send_error('Key不存在或已删除', ErrorCode('ARGS'));
|
||||
}
|
||||
|
||||
public function remove(Request $request)
|
||||
@ -83,13 +83,13 @@ class PushDeerKeyController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$pd_key = PushDeerKey::where('id', $validated['id'])->get(['id','name', 'uid', 'key','created_at'])->first();
|
||||
|
||||
if ($pd_key->uid == $_SESSION['uid']) {
|
||||
$pd_key->delete();
|
||||
return http_result(['message'=>'done']);
|
||||
if ($pd_key = PushDeerKey::where('id', $validated['id'])->get(['id','name', 'uid', 'key','created_at'])->first()) {
|
||||
if ($pd_key->uid == $_SESSION['uid']) {
|
||||
$pd_key->delete();
|
||||
return http_result(['message'=>'done']);
|
||||
}
|
||||
}
|
||||
|
||||
return http_result(['message'=>'error']);
|
||||
send_error('Key不存在或已删除', ErrorCode('ARGS'));
|
||||
}
|
||||
}
|
||||
|
@ -86,13 +86,13 @@ class PushDeerMessageController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$pd_message = PushDeerMessage::where('id', $validated['id'])->get(['id', 'uid', 'text', 'desp', 'type','created_at'])->first();
|
||||
|
||||
if ($pd_message->uid == $_SESSION['uid']) {
|
||||
$pd_message->delete();
|
||||
return http_result(['message'=>'done']);
|
||||
if ($pd_message = PushDeerMessage::where('id', $validated['id'])->get(['id', 'uid', 'text', 'desp', 'type','created_at'])->first()) {
|
||||
if ($pd_message->uid == $_SESSION['uid']) {
|
||||
$pd_message->delete();
|
||||
return http_result(['message'=>'done']);
|
||||
}
|
||||
}
|
||||
|
||||
return http_result(['message'=>'error']);
|
||||
return send_error('消息不存在或已删除', ErrorCode('ARGS'));
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,7 @@ class PushDeerUserController extends Controller
|
||||
return http_result(['token'=>$token]);
|
||||
}
|
||||
|
||||
|
||||
return http_result(['error'=>'id_token解析错误'], -1);
|
||||
return send_error('id_token解析错误', ErrorCode('ARGS'));
|
||||
}
|
||||
|
||||
//
|
||||
@ -90,6 +89,6 @@ class PushDeerUserController extends Controller
|
||||
}
|
||||
|
||||
|
||||
return http_result(['error'=>'id_token解析错误'], -1);
|
||||
return send_error('id_token解析错误', ErrorCode('ARGS'));
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ function getUserDataFromIdentityToken($idToken)
|
||||
return [ 'email' => $appleSignInPayload->getEmail() , 'uid' => $appleSignInPayload->getUser() ];
|
||||
}
|
||||
|
||||
function http_result($content, $code=0)
|
||||
function http_result($content, $code=0, $error='')
|
||||
{
|
||||
return ['code'=>$code, 'content'=>$content];
|
||||
return ['code'=>$code, 'content'=>$content,'error'=>$error];
|
||||
}
|
||||
|
||||
function send_error($msg, $code = '9999')
|
||||
{
|
||||
return response()->json(http_result($msg, $code));
|
||||
return response()->json(http_result($msg, $code, $msg));
|
||||
}
|
||||
|
||||
function uid()
|
||||
@ -74,6 +74,8 @@ function ios_send($is_clip, $device_token, $text, $desp = '', $dev = true)
|
||||
$response = $client->post('http://127.0.0.1:'. $port .'/api/push', [
|
||||
GuzzleHttp\RequestOptions::JSON => $json
|
||||
]);
|
||||
return $response->getBody()->getContents();
|
||||
$ret = $response->getBody()->getContents();
|
||||
error_log('push error'. $ret);
|
||||
return $ret;
|
||||
;
|
||||
}
|
||||
|
528
doc/api/PushDeerOS.json
Normal file
528
doc/api/PushDeerOS.json
Normal file
@ -0,0 +1,528 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "PushDeerOS",
|
||||
"description": "This document was generated from the branch master.\n\nIf you are a contributor to this project, you may access it here: https://paw.cloud/account/teams/68874/projects/93784",
|
||||
"version": "v0.0.0",
|
||||
"contact": {
|
||||
"name": "easychen",
|
||||
"url": "https://paw.cloud/account/teams/68874"
|
||||
}
|
||||
},
|
||||
"host": "127.0.0.1:8800",
|
||||
"schemes": [
|
||||
"http"
|
||||
],
|
||||
"basePath": "/",
|
||||
"paths": {
|
||||
"/login/fake": {
|
||||
"get": {
|
||||
"summary": "① 模拟登入",
|
||||
"description": "",
|
||||
"operationId": "f683f576-feeb-4fe9-aa1d-b6475dcb766b",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/info": {
|
||||
"post": {
|
||||
"summary": "② 获取当前用户数据",
|
||||
"description": "",
|
||||
"operationId": "b1f341b4-6d22-4d24-bfa5-3e49e4f0cc96",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/device/reg": {
|
||||
"post": {
|
||||
"summary": "③ 注册设备",
|
||||
"description": "",
|
||||
"operationId": "379f4336-f61a-4d13-b5e3-509377e76bf0",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "Easy的iPad",
|
||||
"name": "name",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "device-token",
|
||||
"name": "device_id",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "0",
|
||||
"name": "is_clip",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/device/list": {
|
||||
"post": {
|
||||
"summary": "④ 设备列表",
|
||||
"description": "",
|
||||
"operationId": "0ae9bdc1-cb0f-4638-b23b-291b8da147ff",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/device/remove": {
|
||||
"post": {
|
||||
"summary": "⑤ 删除已注册的设备",
|
||||
"description": "",
|
||||
"operationId": "1ba892c0-a0cd-4d37-b2fc-535f183c8a95",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "2",
|
||||
"name": "id",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/device/rename": {
|
||||
"post": {
|
||||
"summary": "⑤ 重命名设备",
|
||||
"description": "",
|
||||
"operationId": "30d5ba13-a659-4c5b-b9f8-6dd22419ba85",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "2",
|
||||
"name": "id",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "修改后的设备名称",
|
||||
"name": "name",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/key/gen": {
|
||||
"post": {
|
||||
"summary": "⑥ 生成一个新key",
|
||||
"description": "",
|
||||
"operationId": "587a9253-0307-4fc4-840e-80e1a33174cc",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/key/regen": {
|
||||
"post": {
|
||||
"summary": "⑦ 重置一个key ",
|
||||
"description": "",
|
||||
"operationId": "4e2198d8-8882-4bec-b340-53569f85147c",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "1",
|
||||
"name": "id",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/key/rename": {
|
||||
"post": {
|
||||
"summary": "⑦ 重命名key",
|
||||
"description": "",
|
||||
"operationId": "b65efcd2-2617-4922-bb25-c14449a96d70",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "1",
|
||||
"name": "id",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "新key",
|
||||
"name": "name",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/key/list": {
|
||||
"post": {
|
||||
"summary": "⑧ key 列表",
|
||||
"description": "",
|
||||
"operationId": "f3edecf8-f032-445e-82bb-0f9be9be5537",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/key/remove": {
|
||||
"post": {
|
||||
"summary": "⑨ 删除一个key",
|
||||
"description": "",
|
||||
"operationId": "e73b75ef-2817-4c64-a88f-86a2d4332506",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "1",
|
||||
"name": "id",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/message/push": {
|
||||
"post": {
|
||||
"summary": "⑩推送消息",
|
||||
"description": "",
|
||||
"operationId": "ad7666c1-6f53-4af8-a093-d8def50feb88",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "PDU1TU6klE1gx6oJU9DE7wWr5nWD7aizcicHX",
|
||||
"name": "pushkey",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "这是什么呀1111",
|
||||
"name": "text",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/message/list": {
|
||||
"post": {
|
||||
"summary": "⑩① 消息列表",
|
||||
"description": "",
|
||||
"operationId": "9ec18878-1974-4cc5-8e70-b612359f84cf",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/message/remove": {
|
||||
"post": {
|
||||
"summary": "⑩② 删除消息",
|
||||
"description": "",
|
||||
"operationId": "f4f868ed-621f-4500-b71e-55aa78226c93",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"name": "Cookie",
|
||||
"required": false,
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "8d57dae1ca8502c784697bb4177bbdcd",
|
||||
"name": "token",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "1",
|
||||
"name": "id",
|
||||
"required": false,
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "no response description was provided for this operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
68
doc/api/PushDeerOS.sh
Normal file
68
doc/api/PushDeerOS.sh
Normal file
@ -0,0 +1,68 @@
|
||||
## ① 模拟登入
|
||||
curl "http://127.0.0.1:8800/login/fake" \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ② 获取当前用户数据
|
||||
curl -X "POST" "http://127.0.0.1:8800/user/info" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ③ 注册设备
|
||||
curl -X "POST" "http://127.0.0.1:8800/device/reg" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ④ 设备列表
|
||||
curl -X "POST" "http://127.0.0.1:8800/device/list" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑤ 删除已注册的设备
|
||||
curl -X "POST" "http://127.0.0.1:8800/device/remove" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑤ 重命名设备
|
||||
curl -X "POST" "http://127.0.0.1:8800/device/rename" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑥ 生成一个新key
|
||||
curl -X "POST" "http://127.0.0.1:8800/key/gen" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑦ 重置一个key
|
||||
curl -X "POST" "http://127.0.0.1:8800/key/regen" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑦ 重命名key
|
||||
curl -X "POST" "http://127.0.0.1:8800/key/rename" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑧ key 列表
|
||||
curl -X "POST" "http://127.0.0.1:8800/key/list" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑨ 删除一个key
|
||||
curl -X "POST" "http://127.0.0.1:8800/key/remove" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑩推送消息
|
||||
curl -X "POST" "http://127.0.0.1:8800/message/push" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑩① 消息列表
|
||||
curl -X "POST" "http://127.0.0.1:8800/message/list" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
||||
|
||||
## ⑩② 删除消息
|
||||
curl -X "POST" "http://127.0.0.1:8800/message/remove" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
|
||||
-H 'Cookie: PHPSESSID=8d57dae1ca8502c784697bb4177bbdcd'
|
Loading…
Reference in New Issue
Block a user