123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package service
- import (
- "iot_manager_service/app/device/dao"
- "iot_manager_service/util"
- "time"
- )
- // 中间件管理服务
- var LightConditionService = new(lightConditionService)
- type lightConditionService struct{}
- func (s *lightConditionService) Get(id int) (*dao.LightCondition, *util.Errors) {
- // 创建查询实例
- condition := &dao.LightCondition{
- ID: id,
- }
- err := condition.Get()
- if err != nil {
- return nil, util.FailResponse(err.Error(), nil)
- }
- return condition, nil
- }
- func (s *lightConditionService) CreateOrUpdate(req dao.LightCondition) *util.Errors {
- return nil
- }
- func (s *lightConditionService) Remove(id int) *util.Errors {
- // 创建查询实例
- device := &dao.Gateway{
- ID: id,
- IsDeleted: 1,
- UpdateUser: "TODO", // todo 使用登录态
- UpdateTime: time.Now(),
- }
- //todo
- // service.gatewayService.CountRelation()
- //todo operation record
- err := device.Delete()
- if err != nil {
- return util.FailResponse(err.Error(), nil)
- }
- return nil
- }
|