新增设备类型选项接口
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-09-22 12:35:26 +08:00
parent 22c3e7cc1a
commit 4330b8a40c
28 changed files with 671 additions and 8 deletions

View File

@@ -84,3 +84,21 @@ const (
// WeComSubmissionStatusUnknown 表示请求可能已到达企微但结果未知。
WeComSubmissionStatusUnknown = 4
)
// GetWeComSubmissionStatusName 返回企业微信提交状态中文名称。
func GetWeComSubmissionStatusName(status int) string {
switch status {
case WeComSubmissionStatusReady:
return "待提交"
case WeComSubmissionStatusSending:
return "发送中"
case WeComSubmissionStatusSubmitted:
return "已提交"
case WeComSubmissionStatusFailed:
return "提交失败"
case WeComSubmissionStatusUnknown:
return "结果未知"
default:
return "未知"
}
}

View File

@@ -378,9 +378,7 @@ func (g *Generator) setEnvelopeResponse(op *openapi3.Operation, output interface
panic(err)
}
// 获取生成的 DTO schema
dtoSchemaOrRef := tempOp.Responses.MapOfResponseOrRefValues[strconv.Itoa(statusCode)].Response.Content["application/json"].Schema
objectType := openapi3.SchemaType("object")
integerType := openapi3.SchemaType("integer")
stringType := openapi3.SchemaType("string")
@@ -544,8 +542,15 @@ func (g *Generator) Save(filename string) error {
return err
}
if schemas := g.Reflector.Spec.Components; schemas != nil && schemas.Schemas != nil {
if schema, ok := schemas.Schemas.MapOfSchemaOrRefValues["DtoDeviceTypeOptionsResponse"]; ok && schema.Schema != nil {
nullable := false
schema.Schema.Nullable = &nullable
schemas.Schemas.MapOfSchemaOrRefValues["DtoDeviceTypeOptionsResponse"] = schema
}
}
// 安全的方法MarshalJSON -> Unmarshal -> MarshalYAML
// 这确保了我们遵守 openapi3 库中定义的 `json` 标签
jsonBytes, err := g.Reflector.Spec.MarshalJSON()
if err != nil {
return err