del_device.go 486 B

12345678910111213141516171819202122
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package device
  4. import (
  5. "context"
  6. "smart-auth/errors"
  7. "smart-auth/pb/v1"
  8. )
  9. func DelDevice(ctx context.Context, req *v1.DelDeviceRequest) (reply *v1.DelDeviceReply, err error) {
  10. if req.Sn == "" {
  11. return nil, errors.ParamsError
  12. }
  13. DeleteDeviceInfoFromMem(req.Sn, req.DeviceCode)
  14. DeleteDeviceInfoByIdFromMem(req.Sn, req.DeviceCode)
  15. return &v1.DelDeviceReply{}, nil
  16. }