From c3e29c801e067bff3241db25082c8fb6ae14667f Mon Sep 17 00:00:00 2001 From: godLei6 <603785348@qq.com> Date: Wed, 13 Sep 2023 10:20:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20action=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=B8=8D=E5=B8=A6=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/disvr/internal/domain/deviceMsg/msgThing/req.go | 4 +--- .../internal/logic/productmanage/productInfoCreateLogic.go | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/disvr/internal/domain/deviceMsg/msgThing/req.go b/src/disvr/internal/domain/deviceMsg/msgThing/req.go index 557200f4e..5bf7faa83 100644 --- a/src/disvr/internal/domain/deviceMsg/msgThing/req.go +++ b/src/disvr/internal/domain/deviceMsg/msgThing/req.go @@ -60,9 +60,7 @@ func (d *Req) FmtReqParam(t *schema.Model, tt schema.ParamType) error { // 校验设备上报的参数合法性 func (d *Req) VerifyReqParam(t *schema.Model, tt schema.ParamType) (map[string]Param, error) { - if len(d.Params) == 0 { - return nil, errors.Parameter.AddDetail("need add params") - } + getParam := make(map[string]Param, len(d.Params)) switch tt { diff --git a/src/dmsvr/internal/logic/productmanage/productInfoCreateLogic.go b/src/dmsvr/internal/logic/productmanage/productInfoCreateLogic.go index 1a8e4cb70..84656916e 100644 --- a/src/dmsvr/internal/logic/productmanage/productInfoCreateLogic.go +++ b/src/dmsvr/internal/logic/productmanage/productInfoCreateLogic.go @@ -2,7 +2,6 @@ package productmanagelogic import ( "context" - "fmt" "github.com/i-Things/things/src/dmsvr/internal/repo/relationDB" "path" "regexp" @@ -142,7 +141,7 @@ func (l *ProductInfoCreateLogic) ProductInfoCreate(in *dm.ProductInfo) (*dm.Resp if in.ProductID != "" { expr := `[0-9A-Za-z]{11,11}` match, _ := regexp.MatchString(expr, in.ProductID) - fmt.Println(match) + //fmt.Println(match) if !match { return nil, errors.Parameter.WithMsg("产品id格式不对,格式为11位数字和英文字母组成的字符串") } From c994ea4ea3eef757fccb47054e17596d0ea67eb3 Mon Sep 17 00:00:00 2001 From: godLei6 <603785348@qq.com> Date: Wed, 13 Sep 2023 23:00:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=BD=B1=E5=AD=90=E6=9C=AA=E6=94=AF=E6=8C=81pg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/disvr/internal/repo/relationDB/shadow.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/disvr/internal/repo/relationDB/shadow.go b/src/disvr/internal/repo/relationDB/shadow.go index e230de06d..037fcdde6 100644 --- a/src/disvr/internal/repo/relationDB/shadow.go +++ b/src/disvr/internal/repo/relationDB/shadow.go @@ -33,7 +33,7 @@ func (p *ShadowRepo) MultiUpdate(ctx context.Context, data []*shadow.Info) error } err := p.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error { for _, v := range vals { - err := tx.Unscoped().Delete(&DiDeviceShadow{}, "productID = ? and deviceName = ? and dataID = ?", + err := tx.Unscoped().Delete(&DiDeviceShadow{}, "product_id = ? and device_name = ? and data_id = ?", v.ProductID, v.DeviceName, v.DataID).Error if err != nil { return errors.Database.AddDetail(err) @@ -48,9 +48,9 @@ func (p *ShadowRepo) MultiUpdate(ctx context.Context, data []*shadow.Info) error return err } func (p *ShadowRepo) fmtFilter(ctx context.Context, f shadow.Filter) *gorm.DB { - db := p.db.WithContext(ctx).Where("productID = ?", f.ProductID).Where("deviceName = ?", f.DeviceName) + db := p.db.WithContext(ctx).Where("product_id = ?", f.ProductID).Where("device_name = ?", f.DeviceName) if len(f.DataIDs) != 0 { - db = db.Where("dataID in ?", f.DataIDs) + db = db.Where("data_id in ?", f.DataIDs) } if f.UpdatedDeviceStatus != 0 { if f.UpdatedDeviceStatus == shadow.UpdatedDevice {