Fix swagger data struct error
Some checks failed
Backend Check Build (NixCN CMS) TeamCity build failed
Client CMS Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-29 01:25:12 +08:00
parent f7bde8ef2e
commit 654b196bfd
15 changed files with 136 additions and 316 deletions

View File

@@ -16,7 +16,7 @@ import (
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_auth.ExchangeData true "Exchange Request Credentials" // @Param payload body service_auth.ExchangeData true "Exchange Request Credentials"
// @Success 200 {object} utils.RespStatus{data=service_auth.ExchangeResult} "Successful exchange" // @Success 200 {object} utils.RespStatus{data=service_auth.ExchangeResponse} "Successful exchange"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 401 {object} utils.RespStatus{data=nil} "Unauthorized" // @Failure 401 {object} utils.RespStatus{data=nil} "Unauthorized"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"

View File

@@ -15,7 +15,7 @@ import (
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param payload body service_auth.MagicData true "Magic Link Request Data" // @Param payload body service_auth.MagicData true "Magic Link Request Data"
// @Success 200 {object} utils.RespStatus{data=service_auth.MagicResult} "Successful request" // @Success 200 {object} utils.RespStatus{data=service_auth.MagicResponse} "Successful request"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 403 {object} utils.RespStatus{data=nil} "Turnstile Verification Failed" // @Failure 403 {object} utils.RespStatus{data=nil} "Turnstile Verification Failed"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"

View File

@@ -16,7 +16,7 @@ import (
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param event_id query string true "Event UUID" // @Param event_id query string true "Event UUID"
// @Success 200 {object} utils.RespStatus{data=service_event.CheckinResult} "Successfully generated code" // @Success 200 {object} utils.RespStatus{data=service_event.CheckinResponse} "Successfully generated code"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"
// @Router /event/checkin [get] // @Router /event/checkin [get]
@@ -86,7 +86,7 @@ func (self *EventHandler) CheckinSubmit(c *gin.Context) {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param event_id query string true "Event UUID" // @Param event_id query string true "Event UUID"
// @Success 200 {object} utils.RespStatus{data=service_event.CheckinQueryResult} "Current attendance status" // @Success 200 {object} utils.RespStatus{data=service_event.CheckinQueryResponse} "Current attendance status"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 404 {object} utils.RespStatus{data=nil} "Record Not Found" // @Failure 404 {object} utils.RespStatus{data=nil} "Record Not Found"
// @Router /event/checkin/query [get] // @Router /event/checkin/query [get]

View File

@@ -16,7 +16,7 @@ import (
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param event_id query string true "Event UUID" // @Param event_id query string true "Event UUID"
// @Success 200 {object} utils.RespStatus{data=service_event.InfoResult} "Successful retrieval" // @Success 200 {object} utils.RespStatus{data=service_event.InfoResponse} "Successful retrieval"
// @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input"
// @Failure 404 {object} utils.RespStatus{data=nil} "Event Not Found" // @Failure 404 {object} utils.RespStatus{data=nil} "Event Not Found"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error"

View File

@@ -14,7 +14,7 @@ import (
// @Tags User // @Tags User
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 200 {object} utils.RespStatus{data=service_user.UserTableResult} "Successful retrieval of full user table" // @Success 200 {object} utils.RespStatus{data=service_user.UserTableResponse} "Successful retrieval of full user table"
// @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Database Error)" // @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (Database Error)"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /user/full [get] // @Router /user/full [get]

View File

@@ -56,7 +56,7 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_auth.ExchangeResult" "$ref": "#/definitions/service_auth.ExchangeResponse"
} }
} }
} }
@@ -156,7 +156,7 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_auth.MagicResult" "$ref": "#/definitions/service_auth.MagicResponse"
} }
} }
} }
@@ -561,7 +561,7 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_event.CheckinResult" "$ref": "#/definitions/service_event.CheckinResponse"
} }
} }
} }
@@ -641,7 +641,7 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_event.CheckinQueryResult" "$ref": "#/definitions/service_event.CheckinQueryResponse"
} }
} }
} }
@@ -785,7 +785,7 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_event.InfoResult" "$ref": "#/definitions/service_event.InfoResponse"
} }
} }
} }
@@ -879,7 +879,7 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_user.UserTableResult" "$ref": "#/definitions/service_user.UserTableResponse"
} }
} }
} }
@@ -1261,30 +1261,6 @@ const docTemplate = `{
} }
} }
}, },
"exception.Builder": {
"type": "object",
"properties": {
"endpoint": {
"type": "string"
},
"error": {},
"errorCode": {
"type": "string"
},
"original": {
"type": "string"
},
"service": {
"type": "string"
},
"status": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"service_auth.ExchangeData": { "service_auth.ExchangeData": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -1299,19 +1275,11 @@ const docTemplate = `{
} }
} }
}, },
"service_auth.ExchangeResult": { "service_auth.ExchangeResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "redirect_uri": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
},
"data": {
"type": "object",
"properties": {
"redirect_uri": {
"type": "string"
}
}
} }
} }
}, },
@@ -1338,13 +1306,12 @@ const docTemplate = `{
} }
} }
}, },
"service_auth.MagicResult": { "service_auth.MagicResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "uri": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
}, }
"data": {}
} }
}, },
"service_auth.RefreshData": { "service_auth.RefreshData": {
@@ -1374,35 +1341,19 @@ const docTemplate = `{
} }
} }
}, },
"service_event.CheckinQueryResult": { "service_event.CheckinQueryResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "checkin_at": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
},
"data": {
"type": "object",
"properties": {
"checkin_at": {
"type": "string"
}
}
} }
} }
}, },
"service_event.CheckinResult": { "service_event.CheckinResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "checkin_code": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
},
"data": {
"type": "object",
"properties": {
"checkin_code": {
"type": "string"
}
}
} }
} }
}, },
@@ -1414,25 +1365,17 @@ const docTemplate = `{
} }
} }
}, },
"service_event.InfoResult": { "service_event.InfoResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "end_time": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
}, },
"data": { "name": {
"type": "object", "type": "string"
"properties": { },
"end_time": { "start_time": {
"type": "string" "type": "string"
},
"name": {
"type": "string"
},
"start_time": {
"type": "string"
}
}
} }
} }
}, },
@@ -1468,12 +1411,9 @@ const docTemplate = `{
} }
} }
}, },
"service_user.UserTableResult": { "service_user.UserTableResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": {
"$ref": "#/definitions/shared.CommonResult"
},
"user_table": { "user_table": {
"type": "array", "type": "array",
"items": { "items": {
@@ -1482,17 +1422,6 @@ const docTemplate = `{
} }
} }
}, },
"shared.CommonResult": {
"type": "object",
"properties": {
"exception": {
"$ref": "#/definitions/exception.Builder"
},
"httpCode": {
"type": "integer"
}
}
},
"utils.RespStatus": { "utils.RespStatus": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@@ -45,7 +45,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_auth.ExchangeResult" "$ref": "#/definitions/service_auth.ExchangeResponse"
} }
} }
} }
@@ -145,7 +145,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_auth.MagicResult" "$ref": "#/definitions/service_auth.MagicResponse"
} }
} }
} }
@@ -550,7 +550,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_event.CheckinResult" "$ref": "#/definitions/service_event.CheckinResponse"
} }
} }
} }
@@ -630,7 +630,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_event.CheckinQueryResult" "$ref": "#/definitions/service_event.CheckinQueryResponse"
} }
} }
} }
@@ -774,7 +774,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_event.InfoResult" "$ref": "#/definitions/service_event.InfoResponse"
} }
} }
} }
@@ -868,7 +868,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/service_user.UserTableResult" "$ref": "#/definitions/service_user.UserTableResponse"
} }
} }
} }
@@ -1250,30 +1250,6 @@
} }
} }
}, },
"exception.Builder": {
"type": "object",
"properties": {
"endpoint": {
"type": "string"
},
"error": {},
"errorCode": {
"type": "string"
},
"original": {
"type": "string"
},
"service": {
"type": "string"
},
"status": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"service_auth.ExchangeData": { "service_auth.ExchangeData": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -1288,19 +1264,11 @@
} }
} }
}, },
"service_auth.ExchangeResult": { "service_auth.ExchangeResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "redirect_uri": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
},
"data": {
"type": "object",
"properties": {
"redirect_uri": {
"type": "string"
}
}
} }
} }
}, },
@@ -1327,13 +1295,12 @@
} }
} }
}, },
"service_auth.MagicResult": { "service_auth.MagicResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "uri": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
}, }
"data": {}
} }
}, },
"service_auth.RefreshData": { "service_auth.RefreshData": {
@@ -1363,35 +1330,19 @@
} }
} }
}, },
"service_event.CheckinQueryResult": { "service_event.CheckinQueryResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "checkin_at": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
},
"data": {
"type": "object",
"properties": {
"checkin_at": {
"type": "string"
}
}
} }
} }
}, },
"service_event.CheckinResult": { "service_event.CheckinResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "checkin_code": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
},
"data": {
"type": "object",
"properties": {
"checkin_code": {
"type": "string"
}
}
} }
} }
}, },
@@ -1403,25 +1354,17 @@
} }
} }
}, },
"service_event.InfoResult": { "service_event.InfoResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": { "end_time": {
"$ref": "#/definitions/shared.CommonResult" "type": "string"
}, },
"data": { "name": {
"type": "object", "type": "string"
"properties": { },
"end_time": { "start_time": {
"type": "string" "type": "string"
},
"name": {
"type": "string"
},
"start_time": {
"type": "string"
}
}
} }
} }
}, },
@@ -1457,12 +1400,9 @@
} }
} }
}, },
"service_user.UserTableResult": { "service_user.UserTableResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"common": {
"$ref": "#/definitions/shared.CommonResult"
},
"user_table": { "user_table": {
"type": "array", "type": "array",
"items": { "items": {
@@ -1471,17 +1411,6 @@
} }
} }
}, },
"shared.CommonResult": {
"type": "object",
"properties": {
"exception": {
"$ref": "#/definitions/exception.Builder"
},
"httpCode": {
"type": "integer"
}
}
},
"utils.RespStatus": { "utils.RespStatus": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@@ -41,22 +41,6 @@ definitions:
username: username:
type: string type: string
type: object type: object
exception.Builder:
properties:
endpoint:
type: string
error: {}
errorCode:
type: string
original:
type: string
service:
type: string
status:
type: string
type:
type: string
type: object
service_auth.ExchangeData: service_auth.ExchangeData:
properties: properties:
client_id: client_id:
@@ -66,15 +50,10 @@ definitions:
state: state:
type: string type: string
type: object type: object
service_auth.ExchangeResult: service_auth.ExchangeResponse:
properties: properties:
common: redirect_uri:
$ref: '#/definitions/shared.CommonResult' type: string
data:
properties:
redirect_uri:
type: string
type: object
type: object type: object
service_auth.MagicData: service_auth.MagicData:
properties: properties:
@@ -91,11 +70,10 @@ definitions:
turnstile_token: turnstile_token:
type: string type: string
type: object type: object
service_auth.MagicResult: service_auth.MagicResponse:
properties: properties:
common: uri:
$ref: '#/definitions/shared.CommonResult' type: string
data: {}
type: object type: object
service_auth.RefreshData: service_auth.RefreshData:
properties: properties:
@@ -114,44 +92,29 @@ definitions:
refresh_token: refresh_token:
type: string type: string
type: object type: object
service_event.CheckinQueryResult: service_event.CheckinQueryResponse:
properties: properties:
common: checkin_at:
$ref: '#/definitions/shared.CommonResult' type: string
data:
properties:
checkin_at:
type: string
type: object
type: object type: object
service_event.CheckinResult: service_event.CheckinResponse:
properties: properties:
common: checkin_code:
$ref: '#/definitions/shared.CommonResult' type: string
data:
properties:
checkin_code:
type: string
type: object
type: object type: object
service_event.CheckinSubmitData: service_event.CheckinSubmitData:
properties: properties:
checkin_code: checkin_code:
type: string type: string
type: object type: object
service_event.InfoResult: service_event.InfoResponse:
properties: properties:
common: end_time:
$ref: '#/definitions/shared.CommonResult' type: string
data: name:
properties: type: string
end_time: start_time:
type: string type: string
name:
type: string
start_time:
type: string
type: object
type: object type: object
service_user.UserInfoData: service_user.UserInfoData:
properties: properties:
@@ -174,22 +137,13 @@ definitions:
username: username:
type: string type: string
type: object type: object
service_user.UserTableResult: service_user.UserTableResponse:
properties: properties:
common:
$ref: '#/definitions/shared.CommonResult'
user_table: user_table:
items: items:
$ref: '#/definitions/data.User' $ref: '#/definitions/data.User'
type: array type: array
type: object type: object
shared.CommonResult:
properties:
exception:
$ref: '#/definitions/exception.Builder'
httpCode:
type: integer
type: object
utils.RespStatus: utils.RespStatus:
properties: properties:
code: code:
@@ -226,7 +180,7 @@ paths:
- $ref: '#/definitions/utils.RespStatus' - $ref: '#/definitions/utils.RespStatus'
- properties: - properties:
data: data:
$ref: '#/definitions/service_auth.ExchangeResult' $ref: '#/definitions/service_auth.ExchangeResponse'
type: object type: object
"400": "400":
description: Invalid Input description: Invalid Input
@@ -283,7 +237,7 @@ paths:
- $ref: '#/definitions/utils.RespStatus' - $ref: '#/definitions/utils.RespStatus'
- properties: - properties:
data: data:
$ref: '#/definitions/service_auth.MagicResult' $ref: '#/definitions/service_auth.MagicResponse'
type: object type: object
"400": "400":
description: Invalid Input description: Invalid Input
@@ -512,7 +466,7 @@ paths:
- $ref: '#/definitions/utils.RespStatus' - $ref: '#/definitions/utils.RespStatus'
- properties: - properties:
data: data:
$ref: '#/definitions/service_event.CheckinResult' $ref: '#/definitions/service_event.CheckinResponse'
type: object type: object
"400": "400":
description: Invalid Input description: Invalid Input
@@ -557,7 +511,7 @@ paths:
- $ref: '#/definitions/utils.RespStatus' - $ref: '#/definitions/utils.RespStatus'
- properties: - properties:
data: data:
$ref: '#/definitions/service_event.CheckinQueryResult' $ref: '#/definitions/service_event.CheckinQueryResponse'
type: object type: object
"400": "400":
description: Invalid Input description: Invalid Input
@@ -638,7 +592,7 @@ paths:
- $ref: '#/definitions/utils.RespStatus' - $ref: '#/definitions/utils.RespStatus'
- properties: - properties:
data: data:
$ref: '#/definitions/service_event.InfoResult' $ref: '#/definitions/service_event.InfoResponse'
type: object type: object
"400": "400":
description: Invalid Input description: Invalid Input
@@ -686,7 +640,7 @@ paths:
- $ref: '#/definitions/utils.RespStatus' - $ref: '#/definitions/utils.RespStatus'
- properties: - properties:
data: data:
$ref: '#/definitions/service_user.UserTableResult' $ref: '#/definitions/service_user.UserTableResponse'
type: object type: object
"500": "500":
description: Internal Server Error (Database Error) description: Internal Server Error (Database Error)

View File

@@ -1,3 +1,5 @@
package main package main
//go:generate go run ./cmd/gen_exception/main.go //go:generate go run ./cmd/gen_exception/main.go
//go:generate swag init

View File

@@ -39,7 +39,7 @@ gen-back:
cd {{ project_dir }} && go generate . cd {{ project_dir }} && go generate .
watch-back: watch-back:
watchexec -r -e go,yaml,tpl -i '.devenv/**' -i '.direnv/**' -i 'client/**' -i 'vendor/**' 'swag init && go build -o {{ server_exec_path }} . && cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} {{ server_exec_path }}' watchexec -r -e go,yaml,tpl -i '.devenv/**' -i '.direnv/**' -i 'client/**' -i 'vendor/**' 'go build -o {{ server_exec_path }} . && cd {{ output_dir }} && CONFIG_PATH={{ output_dir }} {{ server_exec_path }}'
dev: clean install generate dev: clean install generate
devenv up --verbose devenv up --verbose

View File

@@ -23,11 +23,13 @@ type ExchangePayload struct {
Data *ExchangeData Data *ExchangeData
} }
type ExchangeResponse struct {
RedirectUri string `json:"redirect_uri"`
}
type ExchangeResult struct { type ExchangeResult struct {
Common shared.CommonResult Common shared.CommonResult
Data *struct { Data *ExchangeResponse
RedirectUri string `json:"redirect_uri"`
}
} }
func (self *AuthServiceImpl) Exchange(payload *ExchangePayload) (result *ExchangeResult) { func (self *AuthServiceImpl) Exchange(payload *ExchangePayload) (result *ExchangeResult) {
@@ -113,16 +115,14 @@ func (self *AuthServiceImpl) Exchange(payload *ExchangePayload) (result *Exchang
SetError(nil). SetError(nil).
Throw(payload.Context) Throw(payload.Context)
resultData := struct { resultData := &ExchangeResponse{url.String()}
RedirectUri string `json:"redirect_uri"`
}{url.String()}
result = &ExchangeResult{ result = &ExchangeResult{
Common: shared.CommonResult{ Common: shared.CommonResult{
HttpCode: 200, HttpCode: 200,
Exception: exception, Exception: exception,
}, },
Data: &resultData, Data: resultData,
} }
return return

View File

@@ -26,9 +26,13 @@ type MagicPayload struct {
Data *MagicData Data *MagicData
} }
type MagicResponse struct {
Uri string `json:"uri"`
}
type MagicResult struct { type MagicResult struct {
Common shared.CommonResult Common shared.CommonResult
Data any Data *MagicResponse
} }
func (self *AuthServiceImpl) Magic(payload *MagicPayload) (result *MagicResult) { func (self *AuthServiceImpl) Magic(payload *MagicPayload) (result *MagicResult) {
@@ -129,7 +133,7 @@ func (self *AuthServiceImpl) Magic(payload *MagicPayload) (result *MagicResult)
HttpCode: 200, HttpCode: 200,
Exception: exception, Exception: exception,
}, },
Data: uriData, Data: &MagicResponse{uriData.Uri},
} }
return return

View File

@@ -20,11 +20,13 @@ type CheckinPayload struct {
Data *CheckinData Data *CheckinData
} }
type CheckinResponse struct {
CheckinCode *string `json:"checkin_code"`
}
type CheckinResult struct { type CheckinResult struct {
Common shared.CommonResult Common shared.CommonResult
Data *struct { Data *CheckinResponse
CheckinCode *string `json:"checkin_code"`
}
} }
func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinResult) { func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinResult) {
@@ -44,6 +46,7 @@ func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinR
Throw(payload.Context), Throw(payload.Context),
}, },
} }
return return
} }
@@ -58,10 +61,9 @@ func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinR
SetOriginal(exception.CommonSuccess). SetOriginal(exception.CommonSuccess).
Throw(payload.Context), Throw(payload.Context),
}, },
Data: &struct { Data: &CheckinResponse{code},
CheckinCode *string `json:"checkin_code"`
}{code},
} }
return return
} }
@@ -123,11 +125,13 @@ type CheckinQueryPayload struct {
Data *CheckinQueryData Data *CheckinQueryData
} }
type CheckinQueryResponse struct {
CheckinAt *time.Time `json:"checkin_at"`
}
type CheckinQueryResult struct { type CheckinQueryResult struct {
Common shared.CommonResult Common shared.CommonResult
Data *struct { Data *CheckinQueryResponse
CheckinAt *time.Time `json:"checkin_at"`
}
} }
func (self *EventServiceImpl) CheckinQuery(payload *CheckinQueryPayload) (result *CheckinQueryResult) { func (self *EventServiceImpl) CheckinQuery(payload *CheckinQueryPayload) (result *CheckinQueryResult) {
@@ -183,9 +187,7 @@ func (self *EventServiceImpl) CheckinQuery(payload *CheckinQueryPayload) (result
SetOriginal(exception.CommonSuccess). SetOriginal(exception.CommonSuccess).
Throw(payload.Context), Throw(payload.Context),
}, },
Data: &struct { Data: &CheckinQueryResponse{checkinAt},
CheckinAt *time.Time `json:"checkin_at"`
}{checkinAt},
} }
return return
} }

View File

@@ -19,13 +19,15 @@ type InfoPayload struct {
Data *InfoData Data *InfoData
} }
type InfoResponse struct {
Name string `json:"name"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
type InfoResult struct { type InfoResult struct {
Common shared.CommonResult Common shared.CommonResult
Data *struct { Data *InfoResponse
Name string `json:"name"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
} }
func (self *EventServiceImpl) Info(payload *InfoPayload) (result *InfoResult) { func (self *EventServiceImpl) Info(payload *InfoPayload) (result *InfoResult) {
@@ -50,16 +52,6 @@ func (self *EventServiceImpl) Info(payload *InfoPayload) (result *InfoResult) {
return return
} }
resultData := struct {
Name string `json:"name"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}{
Name: event.Name,
StartTime: event.StartTime,
EndTime: event.EndTime,
}
result = &InfoResult{ result = &InfoResult{
Common: shared.CommonResult{ Common: shared.CommonResult{
HttpCode: 200, HttpCode: 200,
@@ -71,7 +63,11 @@ func (self *EventServiceImpl) Info(payload *InfoPayload) (result *InfoResult) {
SetOriginal(exception.CommonSuccess). SetOriginal(exception.CommonSuccess).
Throw(payload.Context), Throw(payload.Context),
}, },
Data: &resultData, Data: &InfoResponse{
Name: event.Name,
StartTime: event.StartTime,
EndTime: event.EndTime,
},
} }
return return

View File

@@ -11,9 +11,13 @@ type UserTablePayload struct {
Context context.Context Context context.Context
} }
type UserTableResponse struct {
UserTable *[]data.User `json:"user_table"`
}
type UserTableResult struct { type UserTableResult struct {
Common shared.CommonResult Common shared.CommonResult
Data *[]data.User `json:"user_table"` Data *UserTableResponse
} }
// ListUserFullTable // ListUserFullTable
@@ -58,7 +62,7 @@ func (self *UserServiceImpl) GetUserFullTable(payload *UserTablePayload) (result
HttpCode: 200, HttpCode: 200,
Exception: exception, Exception: exception,
}, },
Data: userFullTable, Data: &UserTableResponse{userFullTable},
} }
return return