123456789101112131415161718192021222324252627 |
- package service
- import (
- "iot_manager_service/app/dao"
- "iot_manager_service/app/model"
- )
- // 中间件管理服务
- var CameraService = new(cameraService)
- type cameraService struct{}
- func (s *cameraService) CreateOrUpdate(req *model.ReqCamera) error {
- // 创建查询实例
- device := dao.CameraDevice{
- ID: req.Code, //设备ID,DID
- Name: req.Name, //集控器名称
- GID: req.GID, //网关ID
- DevType: req.DevType,
- Tenant: req.Tenant,
- State: req.State, //1启用,0禁用
- }
- if err := device.SaveFromWeb(); err != nil {
- return err
- }
- return nil
- }
|