jiangshuai
2023-11-10 2ba261ddf0269cf131721605eadf45fd033dc002
bug修改
5个文件已修改
145 ■■■■■ 已修改文件
docs/docs.go 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/material.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/image/image.go 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go
@@ -2224,6 +2224,24 @@
                "CostingMethodAverageCost"
            ]
        },
        "constvar.FileType": {
            "type": "string",
            "enum": [
                "file",
                "picture",
                "thumbnail"
            ],
            "x-enum-comments": {
                "FileType_File": "文件",
                "FileType_Picture": "图片",
                "FileType_Thumbnail": "缩略图"
            },
            "x-enum-varnames": [
                "FileType_File",
                "FileType_Picture",
                "FileType_Thumbnail"
            ]
        },
        "constvar.ForceRemovalStrategy": {
            "type": "integer",
            "enum": [
@@ -2436,6 +2454,26 @@
                "ReservationNever"
            ]
        },
        "models.Attachment": {
            "type": "object",
            "properties": {
                "FileUrl": {
                    "type": "string"
                },
                "ext": {
                    "type": "string"
                },
                "fileName": {
                    "type": "string"
                },
                "fileType": {
                    "$ref": "#/definitions/constvar.FileType"
                },
                "id": {
                    "type": "integer"
                }
            }
        },
        "models.Company": {
            "type": "object",
            "properties": {
@@ -2579,6 +2617,18 @@
                    "description": "数量",
                    "type": "number"
                },
                "attachmentIDs": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                },
                "attachmentList": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/models.Attachment"
                    }
                },
                "barcode": {
                    "description": "条码",
                    "type": "string"
docs/swagger.json
@@ -2212,6 +2212,24 @@
                "CostingMethodAverageCost"
            ]
        },
        "constvar.FileType": {
            "type": "string",
            "enum": [
                "file",
                "picture",
                "thumbnail"
            ],
            "x-enum-comments": {
                "FileType_File": "文件",
                "FileType_Picture": "图片",
                "FileType_Thumbnail": "缩略图"
            },
            "x-enum-varnames": [
                "FileType_File",
                "FileType_Picture",
                "FileType_Thumbnail"
            ]
        },
        "constvar.ForceRemovalStrategy": {
            "type": "integer",
            "enum": [
@@ -2424,6 +2442,26 @@
                "ReservationNever"
            ]
        },
        "models.Attachment": {
            "type": "object",
            "properties": {
                "FileUrl": {
                    "type": "string"
                },
                "ext": {
                    "type": "string"
                },
                "fileName": {
                    "type": "string"
                },
                "fileType": {
                    "$ref": "#/definitions/constvar.FileType"
                },
                "id": {
                    "type": "integer"
                }
            }
        },
        "models.Company": {
            "type": "object",
            "properties": {
@@ -2567,6 +2605,18 @@
                    "description": "数量",
                    "type": "number"
                },
                "attachmentIDs": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                },
                "attachmentList": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/models.Attachment"
                    }
                },
                "barcode": {
                    "description": "条码",
                    "type": "string"
docs/swagger.yaml
@@ -33,6 +33,20 @@
    - CostingMethodStandardPrice
    - CostingMethodFIFO
    - CostingMethodAverageCost
  constvar.FileType:
    enum:
    - file
    - picture
    - thumbnail
    type: string
    x-enum-comments:
      FileType_File: 文件
      FileType_Picture: 图片
      FileType_Thumbnail: 缩略图
    x-enum-varnames:
    - FileType_File
    - FileType_Picture
    - FileType_Thumbnail
  constvar.ForceRemovalStrategy:
    enum:
    - 1
@@ -203,6 +217,19 @@
    - WhetherTypeAsk
    - WhetherTypeAlways
    - ReservationNever
  models.Attachment:
    properties:
      FileUrl:
        type: string
      ext:
        type: string
      fileName:
        type: string
      fileType:
        $ref: '#/definitions/constvar.FileType'
      id:
        type: integer
    type: object
  models.Company:
    properties:
      createTime:
@@ -302,6 +329,14 @@
      amount:
        description: 数量
        type: number
      attachmentIDs:
        items:
          type: integer
        type: array
      attachmentList:
        items:
          $ref: '#/definitions/models.Attachment'
        type: array
      barcode:
        description: 条码
        type: string
models/material.go
@@ -341,7 +341,7 @@
        db      = slf.build()
    )
    if err := db.Count(&total).Error; err != nil {
    if err := db.Model(&Material{}).Count(&total).Error; err != nil {
        return records, total, fmt.Errorf("find count err: %v", err)
    }
    if slf.PageNum*slf.PageSize > 0 {
utils/image/image.go
@@ -44,7 +44,13 @@
            b = sz.Y
        }
        thumbnailImg = canvas.(*image.YCbCr).SubImage(image.Rect(l, t, r, b)).(*image.YCbCr)
        if ycbcr, ok := canvas.(*image.YCbCr); ok {
            thumbnailImg = ycbcr.SubImage(image.Rect(l, t, r, b)).(*image.YCbCr)
        } else if rgba, ok := canvas.(*image.RGBA); ok {
            thumbnailImg = rgba.SubImage(image.Rect(l, t, r, b)).(*image.RGBA)
        } else {
            return nil, errors.New("未识别的图片色彩类型")
        }
    } else {
        w := width
        h := height