diff --git a/docs/docs.go b/docs/docs.go index 8a5d1d9..ef40956 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1232,6 +1232,49 @@ var doc = `{ } } }, + "/api/cron/exec/{id}": { + "patch": { + "security": [ + { + "LoginToken": [] + } + ], + "description": "手动执行单条任务", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API.cron" + ], + "summary": "手动执行单条任务", + "parameters": [ + { + "type": "string", + "description": "hashId", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/cron.detailResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/code.Failure" + } + } + } + } + }, "/api/cron/used": { "patch": { "security": [ @@ -1457,47 +1500,6 @@ var doc = `{ } } } - }, - "patch": { - "security": [ - { - "LoginToken": [] - } - ], - "description": "手动执行单条任务", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "API.cron" - ], - "summary": "手动执行单条任务", - "parameters": [ - { - "type": "string", - "description": "hashId", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/cron.detailResponse" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/code.Failure" - } - } - } } }, "/api/login": { diff --git a/docs/swagger.json b/docs/swagger.json index e148093..85b1c6a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1216,6 +1216,49 @@ } } }, + "/api/cron/exec/{id}": { + "patch": { + "security": [ + { + "LoginToken": [] + } + ], + "description": "手动执行单条任务", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "API.cron" + ], + "summary": "手动执行单条任务", + "parameters": [ + { + "type": "string", + "description": "hashId", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/cron.detailResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/code.Failure" + } + } + } + } + }, "/api/cron/used": { "patch": { "security": [ @@ -1441,47 +1484,6 @@ } } } - }, - "patch": { - "security": [ - { - "LoginToken": [] - } - ], - "description": "手动执行单条任务", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "API.cron" - ], - "summary": "手动执行单条任务", - "parameters": [ - { - "type": "string", - "description": "hashId", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/cron.detailResponse" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/code.Failure" - } - } - } } }, "/api/login": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index d72d09b..aa5f91d 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1477,32 +1477,6 @@ paths: summary: 获取单条任务详情 tags: - API.cron - patch: - consumes: - - application/json - description: 手动执行单条任务 - parameters: - - description: hashId - in: path - name: id - required: true - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/cron.detailResponse' - "400": - description: Bad Request - schema: - $ref: '#/definitions/code.Failure' - security: - - LoginToken: [] - summary: 手动执行单条任务 - tags: - - API.cron post: consumes: - application/x-www-form-urlencoded @@ -1594,6 +1568,33 @@ paths: summary: 编辑任务 tags: - API.cron + /api/cron/exec/{id}: + patch: + consumes: + - application/json + description: 手动执行单条任务 + parameters: + - description: hashId + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/cron.detailResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/code.Failure' + security: + - LoginToken: [] + summary: 手动执行单条任务 + tags: + - API.cron /api/cron/used: patch: consumes: diff --git a/internal/api/cron/func_execute.go b/internal/api/cron/func_execute.go index 60f56d7..1a5e186 100755 --- a/internal/api/cron/func_execute.go +++ b/internal/api/cron/func_execute.go @@ -27,7 +27,7 @@ type executeResponse struct { // @Param id path string true "hashId" // @Success 200 {object} detailResponse // @Failure 400 {object} code.Failure -// @Router /api/cron/{id} [patch] +// @Router /api/cron/exec/{id} [patch] // @Security LoginToken func (h *handler) Execute() core.HandlerFunc { return func(ctx core.Context) { diff --git a/internal/api/cron/handler.go b/internal/api/cron/handler.go index 7b6c66d..69de4aa 100644 --- a/internal/api/cron/handler.go +++ b/internal/api/cron/handler.go @@ -44,7 +44,7 @@ type Handler interface { // Execute 手动执行任务 // @Tags API.cron - // @Router /api/cron/{id} [patch] + // @Router /api/cron/exec/{id} [patch] Execute() core.HandlerFunc } diff --git a/scripts/restart.sh b/scripts/restart.sh deleted file mode 100755 index ea19f4c..0000000 --- a/scripts/restart.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -shellExit() -{ -if [ $1 -eq 1 ]; then - printf "\nfailed!!!\n\n" - exit 1 -fi -} - -printf "\nRestart server port:9999 \n\n" - -lsof -i:9999 | grep LISTEN | awk '{print $2}' | xargs kill -s SIGINT && go run ./main.go -env fat -shellExit $? - -printf "\nDone.\n\n" diff --git a/scripts/swagger.bat b/scripts/swagger.bat index 0f077b8..91f1f08 100644 --- a/scripts/swagger.bat +++ b/scripts/swagger.bat @@ -3,7 +3,7 @@ chcp 65001 echo. echo Regenerating swagger doc echo. -go install github.com/swaggo/swag/cmd/swag@latest +go install github.com/swaggo/swag/cmd/swag@v1.7.4 swag init echo. echo Done. \ No newline at end of file diff --git a/scripts/swagger.sh b/scripts/swagger.sh index cd29225..9ebbaf2 100755 --- a/scripts/swagger.sh +++ b/scripts/swagger.sh @@ -1,5 +1,5 @@ #!/bin/bash printf "\nRegenerating swagger doc\n\n" -go install github.com/swaggo/swag/cmd/swag@latest +go install github.com/swaggo/swag/cmd/swag@v1.7.4 time swag init printf "\nDone.\n\n" \ No newline at end of file