mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-11-30 03:07:40 +08:00
feat: add upgrade
This commit is contained in:
parent
9c18320115
commit
3dbc47e2fc
@ -6,7 +6,7 @@ parse.delete_field = ACL,objectId,updatedAt,createdAt
|
||||
##--------------------------------------------------------------------
|
||||
## parse config
|
||||
##--------------------------------------------------------------------
|
||||
parse.parse_server = http://192.168.1.122:1337
|
||||
parse.parse_server = http://127.0.0.1:1337
|
||||
parse.parse_path = /parse/
|
||||
parse.parse_appid = 8c7f62065812e504f3e21c9826963d7c
|
||||
parse.parse_master_key = b2bd55d3b36edd652b5b912391ada90c
|
||||
|
@ -91,7 +91,7 @@
|
||||
"post": {
|
||||
"summary": "数据批处理",
|
||||
"description": "为了减少网络往返的时间,可以使用批处理端点在一次调用中创建、更新或删除多达50个对象。",
|
||||
"position" : 0,
|
||||
"position": 0,
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
@ -342,6 +342,71 @@
|
||||
"tags": [
|
||||
"Basic"
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"summary": "版本升级",
|
||||
"description": "版本升级",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "升级类型",
|
||||
"in": "query",
|
||||
"name": "type",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"default": "dgiot",
|
||||
"enum": [
|
||||
"all",
|
||||
"dgiot",
|
||||
"amis",
|
||||
"admin",
|
||||
"tdengine",
|
||||
"postgres",
|
||||
"gofastd",
|
||||
"parse",
|
||||
"erlang"
|
||||
]
|
||||
},
|
||||
{
|
||||
"in": "body",
|
||||
"name": "info",
|
||||
"description": "版本信息",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"url": {
|
||||
"description": "软件名称",
|
||||
"type": "string",
|
||||
"example": "dgiot_edge_v10.tar.gz"
|
||||
},
|
||||
"md5": {
|
||||
"description": "校验码",
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns success"
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Server Internal error"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Basic"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,13 @@ do_request(get_upgrade, _Body, _Context, Req) ->
|
||||
%% io:format("~s ~p SessionToken = ~p.~n", [?FILE, ?LINE, SessionToken]),
|
||||
dgiot_parse_utils:update(SessionToken);
|
||||
|
||||
%%%% 版本升级
|
||||
do_request(post_upgrade, _Body, _Context, Req) ->
|
||||
Cookies = cowboy_req:parse_cookies(Req),
|
||||
SessionToken = proplists:get_value(<<"departmentToken">>, Cookies),
|
||||
%% io:format("~s ~p SessionToken = ~p.~n", [?FILE, ?LINE, SessionToken]),
|
||||
dgiot_parse_utils:update(SessionToken);
|
||||
|
||||
%% 服务器不支持的API接口
|
||||
do_request(_OperationId, _Args, _Context, _Req) ->
|
||||
{error, <<"Not Allowed.">>}.
|
||||
|
@ -172,8 +172,8 @@ do_request(put_user, #{<<"username">> := UserName} = Body, #{<<"sessionToken">>
|
||||
do_request(get_users_id, Body, #{<<"sessionToken">> := SessionToken}, _Req) ->
|
||||
case dgiot_parse_auth:get_user(Body, SessionToken) of
|
||||
{ok, Data} ->
|
||||
dgiot_role:load_user(),
|
||||
dgiot_parse_auth:load_roleuser(),
|
||||
%% dgiot_role:load_user(),
|
||||
%% dgiot_parse_auth:load_roleuser(),
|
||||
{200, Data};
|
||||
{error, Error} -> {500, Error}
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user