cameraService.go 585 B

123456789101112131415161718192021222324252627
  1. package service
  2. import (
  3. "iot_manager_service/app/dao"
  4. "iot_manager_service/app/model"
  5. )
  6. // 中间件管理服务
  7. var CameraService = new(cameraService)
  8. type cameraService struct{}
  9. func (s *cameraService) CreateOrUpdate(req *model.ReqCamera) error {
  10. // 创建查询实例
  11. device := dao.CameraDevice{
  12. ID: req.Code, //设备ID,DID
  13. Name: req.Name, //集控器名称
  14. GID: req.GID, //网关ID
  15. DevType: req.DevType,
  16. Tenant: req.Tenant,
  17. State: req.State, //1启用,0禁用
  18. }
  19. if err := device.SaveFromWeb(); err != nil {
  20. return err
  21. }
  22. return nil
  23. }