qixiaoning
2025-08-21 e38654fe9eff4562da4f18f8f018aed7879d493c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package manage
 
import (
    "vamicro/iotData-service/model"
    "vamicro/iotData-service/serializer"
)
 
type HandleWarningService struct {
    Id uint `form:"id" json:"id"`
}
 
func (service *HandleWarningService) Handle() serializer.Response {
    code := 200
    db := model.DB.Table("warnings")
 
    if err := db.Where("id = ?", service.Id).Update("status", 1).Error; err != nil {
        code = 30001
        return serializer.Response{
            Status: code,
            Msg:    "数据库错误",
            Error:  err.Error(),
        }
    }
 
    return serializer.Response{
        Status: code,
        // Data:   warns,
        Msg: "处理成功",
    }
}