Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/test' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
godLei6 committed Sep 18, 2023
2 parents dbb08e8 + c994ea4 commit 0e284d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/disvr/internal/domain/deviceMsg/msgThing/req.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/disvr/internal/repo/relationDB/shadow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package productmanagelogic

import (
"context"
"fmt"
"github.com/i-Things/things/src/dmsvr/internal/repo/relationDB"
"path"
"regexp"
Expand Down Expand Up @@ -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位数字和英文字母组成的字符串")
}
Expand Down

0 comments on commit 0e284d4

Please sign in to comment.