// Copyright 2019 github.com. All rights reserved. // Use of this source code is governed by github.com. package device import ( "context" "smart-auth/consts" "smart-auth/model" "smart-auth/pb/v1" "github.com/jaryhe/gopkgs/database" ) func GetAllDustSn(ctx context.Context, req *v1.GetAllDustSnRequest) (reply *v1.GetAllDustSnReply, err error) { p := model.DeviceAll{} where := map[string]interface{}{ "DeviceCode":consts.DeviceTypeDust, "VerifyStatus":1, } list, err := p.QueryAll(database.DB(), where) if err != nil { return nil, err } reply = &v1.GetAllDustSnReply{} reply.Sns = make([]string, len(list)) for i, v := range list { reply.Sns[i] = v.SN } return reply, nil }