longan пре 2 година
родитељ
комит
353c746792
54 измењених фајлова са 21 додато и 168 уклоњено
  1. 0 5
      app/data/service/environmentDataService.go
  2. 0 2
      app/device/controller/bigController.go
  3. 3 7
      app/device/controller/infoBoardController.go
  4. 0 4
      app/device/controller/ipBroadcastController.go
  5. 0 2
      app/device/controller/lampPoleGroupController.go
  6. 0 2
      app/device/dao/bigScreen.go
  7. 1 3
      app/device/dao/gatewayRelationDao.go
  8. 0 2
      app/device/dao/infoBoardDao.go
  9. 0 3
      app/device/edge_service/cltLedControlService.go
  10. 0 7
      app/device/edge_service/ipCastControlService.go
  11. 0 1
      app/device/service/alarmService.go
  12. 0 1
      app/device/service/gatewayService.go
  13. 0 4
      app/device/service/infoBoardServiceTime.go
  14. 0 5
      app/device/service/intelligentLightingService.go
  15. 5 6
      app/device/service/lampPoleGroupService.go
  16. 0 1
      app/device/service/manholeCoverService.go
  17. 1 3
      app/device/service/workbenchService.go
  18. 0 2
      app/device/service/zigbeeService.go
  19. 1 8
      app/logapi/logController.go
  20. 0 2
      app/logapi/logService.go
  21. 0 1
      app/multimedia/dao/common.go
  22. 0 2
      app/multimedia/dao/publishLibrariesDao.go
  23. 0 2
      app/multimedia/service/libraryService.go
  24. 0 4
      app/multimedia/service/programService.go
  25. 1 16
      app/multimedia/service/publishLibrariesService.go
  26. 0 3
      app/operation/dao/captureOverSpeedDao.go
  27. 0 1
      app/operation/dao/common.go
  28. 2 9
      app/operation/edge_service/forCaptureItsService.go
  29. 0 2
      app/operation/edge_service/forLightEnergyService.go
  30. 0 3
      app/operation/edge_service/forLightRateService.go
  31. 0 1
      app/operation/service/alarmService.go
  32. 1 3
      app/operation/service/captureReportService.go
  33. 0 1
      app/operation/service/captureService.go
  34. 0 2
      app/operation/service/lightingRateService.go
  35. 0 1
      app/record/dao/aKeyAlarmDao.go
  36. 0 1
      app/record/dao/common.go
  37. 0 3
      app/record/edge_service/recordAlarmSos.go
  38. 0 3
      app/record/service/aKeyAlarmRecordService.go
  39. 0 5
      app/security/edge_service/forRewindService.go
  40. 0 2
      app/security/edge_service/forVidiconService.go
  41. 0 2
      app/security/service/multiscreenService.go
  42. 0 2
      app/system/dao/tenant.go
  43. 1 3
      app/system/dao/user.go
  44. 0 1
      app/system/service/userService.go
  45. 0 1
      app/warn/dao/common.go
  46. 0 2
      app/warn/dao/noticeRecordDao.go
  47. 0 1
      app/warn/dao/noticeSetDao.go
  48. 0 1
      app/warn/dao/platformAlarmDao.go
  49. 0 2
      app/warn/edge_service/syncAlarmService.go
  50. 0 2
      app/warn/service/noticeSetService.go
  51. 4 8
      util/cache/redis.go
  52. 0 1
      util/common/common.go
  53. 1 5
      util/es/elastic.go
  54. 0 2
      util/notify/tencent_sms.go

+ 0 - 5
app/data/service/environmentDataService.go

@@ -19,16 +19,13 @@ type environmentDataService struct{}
 
 func (s *environmentDataService) DataSync() {
 	devices := device.OptoSensorService.GetAll()
-	//fmt.Printf("devices = %v \n", devices)
 	if len(devices) == 0 {
 		return
 	}
 
 	var environmentDatas []dao.EnvironmentData
 	for _, d := range devices {
-		//fmt.Printf("d.Sn = %v \n", d.Sn)
 		creatTime, values := cache.GetDeviceData(d.Sn)
-		//fmt.Printf("values = %v \n", values)
 		now := time.Now()
 		environmentData := dao.EnvironmentData{
 			DeviceId:   d.ID,
@@ -78,7 +75,6 @@ func (s *environmentDataService) DataSync() {
 		b, _ := json.Marshal(&environmentData)
 		cache.Redis.Set(fmt.Sprintf(model.EnvironmentDataKey, d.ID), string(b), 0)
 	}
-	//fmt.Printf("environmentDatas = %v \n", environmentDatas)
 	environment := &dao.EnvironmentData{}
 	err := environment.BatchSave(environmentDatas)
 	if err != nil {
@@ -105,7 +101,6 @@ func (s *environmentDataService) Get(deviceId int) *dao.EnvironmentData {
 	if err == nil {
 		err = json.Unmarshal([]byte(result), &EnvironmentData)
 		if err != nil {
-			fmt.Printf("err = %v \n", err)
 			return nil
 		}
 		return &EnvironmentData

+ 0 - 2
app/device/controller/bigController.go

@@ -1,7 +1,6 @@
 package controller
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
 	"iot_manager_service/app/device/dao"
@@ -45,7 +44,6 @@ func (big *bigScreen) DevicesStatus(ctx *gin.Context) {
 
 // Energy 能耗: /api/longchi/largescreen/overview/energy-consumption
 func (big *bigScreen) Energy(ctx *gin.Context) {
-	fmt.Printf("Start:%v,End:%v\n", ctx.Query("startDate"), ctx.Query("endDate"))
 	rsp := service.BigServer.GetEnergy(ctx.Query("startDate"), ctx.Query("endDate"))
 	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Success, rsp))
 }

+ 3 - 7
app/device/controller/infoBoardController.go

@@ -1,7 +1,6 @@
 package controller
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"iot_manager_service/app/device/dao"
 	"iot_manager_service/app/device/model"
@@ -162,7 +161,6 @@ func (s *infoBoardCtl) CronSyncBrightnessAndMusicvolume() {
 	board := dao.InfoBoard{}
 	list, err := board.GetAllDevicesNotTenant()
 	if err != nil {
-		fmt.Printf("err = %v \n", err)
 		return
 	}
 	for _, led := range list {
@@ -182,7 +180,6 @@ func (s *infoBoardCtl) CronSyncLedPaying(id int) {
 	}
 	list, err := board.GetAllDevicesNotTenant()
 	if err != nil {
-		fmt.Printf("CronSyncLedPaying err = %v \n", err)
 		return
 	}
 	for _, led := range list {
@@ -190,16 +187,15 @@ func (s *infoBoardCtl) CronSyncLedPaying(id int) {
 		currPaying := cache.GetDeviceLedData(led.Sn)
 		if retState == "1" && len(currPaying) != 0 {
 			playing := currPaying["playing"].(string) //得到当前正播放的节目
-			fmt.Printf("led信息屏设备Sn = %v 当前正在播放[%v]", led.Sn, playing)
 			playJson := service2.PublishLibrariesService.LedPaying(led.ID, playing)
 			if playJson != "" {
 				service.InfoBoardService.EdgePushLedProgram(led.TenantId, led.Sn, playJson)
-				fmt.Printf("需要更新\n")
+				//需要更新
 			} else {
-				//fmt.Printf("无需更新\n")
+				//无需更新
 			}
 		} else {
-			//fmt.Printf("led设备不在线Sn = %v \n", led.Sn)
+			//led设备不在线Sn = %v \n", led.Sn
 		}
 	}
 }

+ 0 - 4
app/device/controller/ipBroadcastController.go

@@ -1,7 +1,6 @@
 package controller
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"iot_manager_service/app/device/dao"
 	"iot_manager_service/app/device/edge_service"
@@ -156,12 +155,10 @@ func (c *ipBroadcastCtl) CronSyncIpCastPaying(id int) {
 	}
 	list, err := board.GetAllDevicesNotTenant()
 	if err != nil {
-		fmt.Printf("CronSyncIPCastPaying err = %v \n", err)
 		return
 	}
 	for _, IPCast := range list {
 		device, _ := service.IpBroadcastService.Get(IPCast.ID)
-		//fmt.Printf("device = %v \n", device)
 		if device.PlayState == "空闲" {
 			playJson, ptype := service2.PublishLibrariesService.IPCastPaying(IPCast.ID)
 			if playJson != "" {
@@ -170,7 +167,6 @@ func (c *ipBroadcastCtl) CronSyncIpCastPaying(id int) {
 					return
 				}
 			} else {
-				//fmt.Printf("无需更新\n")
 			}
 		}
 	}

+ 0 - 2
app/device/controller/lampPoleGroupController.go

@@ -1,7 +1,6 @@
 package controller
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"iot_manager_service/app/device/dao"
 	"iot_manager_service/app/device/model"
@@ -90,7 +89,6 @@ func (c *lampPoleGroupCtl) Remove(ctx *gin.Context) {
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		return
 	}
-	fmt.Printf("req = %v", req)
 	err := service.LampPoleGroupService.Remove(claims.UserId, claims.TenantId, req.IDs, req.Name)
 	if err != nil {
 		ctx.JSON(http.StatusOK, err)

+ 0 - 2
app/device/dao/bigScreen.go

@@ -1,7 +1,6 @@
 package dao
 
 import (
-	"fmt"
 	"iot_manager_service/util/logger"
 )
 
@@ -120,7 +119,6 @@ func GetEnvData(id string) Environment {
 	Db.Select("air, create_date, temperature, humidity, pm25, pm10, noise, hpa, wind_direction, wind_speed").
 		Table("data_environment").Where("device_id=?", id).
 		Order("create_date DESC").Limit(1).Find(&env)
-	fmt.Printf("==============env:%+v\n", env)
 	return env
 }
 

+ 1 - 3
app/device/dao/gatewayRelationDao.go

@@ -1,11 +1,10 @@
 package dao
 
 import (
-	"fmt"
 	"time"
 )
 
-//GatewayRelation 网关挂载设备关联信息表
+// GatewayRelation 网关挂载设备关联信息表
 type GatewayRelation struct {
 	ID                 int       `gorm:"type:int;primary_key"` //编号 网关ID
 	CameraCount        int       `gorm:"type:int;default 0" comment:"球机数量"`
@@ -59,7 +58,6 @@ func (c *GatewayRelation) Update() error {
 		if relation.Total > 0 {
 			return Db.Model(&c).Where(" id = ? ", gatewayId).Updates(&relation).Error
 		} else {
-			fmt.Printf("id=%v, relation.Total = %v \n", c.ID, relation.Total)
 			return Db.Model(&c).Where(" id = ? ", gatewayId).Updates(map[string]interface{}{"total": 0}).Error
 		}
 	} else {

+ 0 - 2
app/device/dao/infoBoardDao.go

@@ -1,7 +1,6 @@
 package dao
 
 import (
-	"fmt"
 	"gorm.io/gorm"
 	"iot_manager_service/util/common"
 	"time"
@@ -139,7 +138,6 @@ func (c InfoBoard) GetDevicesByIds(ids string) []InfoBoard {
 	var devices []InfoBoard
 	Db.Model(&c).Where("id in ("+ids+")"+" and tenant_id = ?  and is_deleted = 0",
 		c.TenantId).Scan(&devices)
-	fmt.Printf("devices = %v", devices)
 	return devices
 }
 

+ 0 - 3
app/device/edge_service/cltLedControlService.go

@@ -38,7 +38,6 @@ func (f CltLedControlService) RequestApi(reqData CltLedControlReq) {
 
 	client := &http.Client{}
 	marshal, _ := json.Marshal(reqData.PostData)
-	fmt.Printf("playJson = %v \n", string(marshal))
 
 	req, err := http.NewRequest(method, url, strings.NewReader(string(marshal)))
 	if err != nil {
@@ -65,8 +64,6 @@ func (f CltLedControlService) RequestApi(reqData CltLedControlReq) {
 		return
 	}
 	if cltLedControlRes.Code != 0 {
-		fmt.Printf("RequestApi url = %v \n", url)
-		fmt.Printf("reqData = %v \n", reqData)
 		logger.Logger.Errorf("CltLedControlService cltLedControlRes %v", cltLedControlRes.Msg)
 		return
 	}

+ 0 - 7
app/device/edge_service/ipCastControlService.go

@@ -92,7 +92,6 @@ func (f IpCastControlService) RequestApi(reqData IpCastControlReq) (map[string]i
 	method := "POST"
 	client := &http.Client{}
 	marshal, _ := json.Marshal(reqData.PostData)
-	//fmt.Printf("playJson = %v \n", string(marshal))
 	req, err := http.NewRequest(method, url, strings.NewReader(string(marshal)))
 	if err != nil {
 		logger.Logger.Errorf("IpCastControlService NewRequest %v", err.Error())
@@ -118,10 +117,7 @@ func (f IpCastControlService) RequestApi(reqData IpCastControlReq) (map[string]i
 		logger.Logger.Errorf("IpCastControlService Unmarshal %v", err.Error())
 		return nil, err
 	}
-	//fmt.Printf("IpCastControlRes = %v \n", IpCastControlRes)
 	if IpCastControlRes["Ret"] == 1000 {
-		fmt.Printf("RequestApi url = %v \n", url)
-		fmt.Printf("reqData = %v \n", reqData)
 		logger.Logger.Errorf("IpCastControlService  %v", IpCastControlRes)
 		return nil, err
 	}
@@ -148,7 +144,6 @@ func (f IpCastControlService) UploadMp3GetFileId(imgUrl string, fileName string)
 	client := &http.Client{}
 	req, err := http.NewRequest(method, url, response.Body)
 	if err != nil {
-		fmt.Println(err)
 		logger.Logger.Errorf("IpCastControlService UploadMp3GetFileId 1 %v", err.Error())
 		return "", err
 	}
@@ -156,7 +151,6 @@ func (f IpCastControlService) UploadMp3GetFileId(imgUrl string, fileName string)
 
 	res, err := client.Do(req)
 	if err != nil {
-		fmt.Println(err)
 		logger.Logger.Errorf("IpCastControlService UploadMp3GetFileId 2 %v", err.Error())
 		return "", err
 	}
@@ -164,7 +158,6 @@ func (f IpCastControlService) UploadMp3GetFileId(imgUrl string, fileName string)
 
 	body, err := ioutil.ReadAll(res.Body)
 	if err != nil {
-		fmt.Println(err)
 		logger.Logger.Errorf("IpCastControlService UploadMp3GetFileId 3 %v", err.Error())
 		return "", err
 	}

+ 0 - 1
app/device/service/alarmService.go

@@ -56,7 +56,6 @@ func (s *alarmService) CreateOrUpdate(userId int64, tenantId string, req dao.Ala
 		logger.Logger.Errorf("Update IsExistedByNameAndCode \n")
 		return common.ParamsInvalidResponse(model.RepeatedName, nil)
 	}
-	fmt.Printf("device = %v", device)
 	if err := device.Update(); err != nil {
 		logger.Logger.Errorf("Update err = %s \n", err.Error())
 		return common.FailResponse(err.Error(), nil)

+ 0 - 1
app/device/service/gatewayService.go

@@ -106,7 +106,6 @@ func (s *gatewayService) List(searchValue string, current, size int) ([]model.Ga
 		detail := model.GatewayDetail{Gateway: d}
 		relation, _ := GatewayRelationService.Get(d.ID)
 
-		//fmt.Printf("d.ID = %v", d.ID)
 		//查数据
 		relation2 := dao.GatewayRelation{
 			ID: d.ID,

+ 0 - 4
app/device/service/infoBoardServiceTime.go

@@ -29,8 +29,6 @@ func (s *infoBoardService) Get(id int) (model.InfoBoardDetail, *common.Errors) {
 		return model.InfoBoardDetail{}, common.FailResponse(err.Error(), nil)
 	}
 	detail := s.rewriteBoardDetail(getDevice)
-	fmt.Printf("detail = %v \n", detail.BootStartTime)
-	fmt.Printf("detail = %v \n", detail.Condition)
 	return detail, nil
 }
 
@@ -291,10 +289,8 @@ func isNight() bool {
 	now := time.Now()
 	hour := now.Hour()
 	if hour >= 18 || hour < 6 {
-		//fmt.Println("现在是晚上")
 		return true
 	} else {
-		//fmt.Println("现在不是晚上")
 		return false
 	}
 }

+ 0 - 5
app/device/service/intelligentLightingService.go

@@ -43,7 +43,6 @@ func (s *intelligentLightingService) GetDetailByLight(tenantId string, id int, r
 			detail.LampPoleName = lightControl.LampPoleName
 		}
 	}
-	//fmt.Printf("id = %v", id)
 	detail.LightRelMap = s.GetLightRelation(tenantId, id, reqType)
 	return detail, nil
 }
@@ -58,8 +57,6 @@ func (s *intelligentLightingService) GetLightRelation(tenantId string, rId, rela
 		TenantId:     tenantId,
 	}
 	relations, _ := intelligentLight.GetByRidAndType()
-	//fmt.Printf("rId = %v", rId)
-	//fmt.Printf("relations = %v", relations)
 	if len(relations) == 0 {
 		return detail
 	}
@@ -175,7 +172,6 @@ func (s *intelligentLightingService) Relation(userId int64, tenantId string, pub
 	intelligentLight.LightID = lightId
 	intelligentLight.Update()
 	//TODO:这里要调用边缘接口同步
-	//fmt.Printf("intelligentLight = %v", intelligentLight)
 
 	service.OperationHisService.Save(userId, tenantId, common.OperationStrategyRelation, common.ModuleTypeLightStrategy,
 		common.DeviceTypeLightControl, common.GetDeviceObject(publicId, "保存策略"+string(lightId)), common.OperationSuccess)
@@ -218,7 +214,6 @@ func (s *intelligentLightingService) ChangeHandSwitch(userId int64, tenantId str
 	for _, control := range list {
 		sn = append(sn, control.Sn)
 	}
-	fmt.Printf("操作的sn = %v", sn)
 	// 这里要调用云端 操作灯控
 	var forLightControlReq edge_service.ForLightControlReq
 	forLightControlReq.Codes = sn

+ 5 - 6
app/device/service/lampPoleGroupService.go

@@ -94,7 +94,6 @@ func (s *lampPoleGroupService) Remove(userId int64, tenantId string, id int, nam
 		UpdateUser: userId,
 		UpdateTime: common.Time(time.Now()),
 	}
-	fmt.Printf("device = %v", device)
 	//todo
 	// service.lampPoleService.CountRelation()
 	err := device.Delete()
@@ -108,7 +107,7 @@ func (s *lampPoleGroupService) Remove(userId int64, tenantId string, id int, nam
 	return nil
 }
 
-func (s *lampPoleGroupService) GetList(tenantId string, ) ([]*dao.LampPoleGroup, *common.Errors) {
+func (s *lampPoleGroupService) GetList(tenantId string) ([]*dao.LampPoleGroup, *common.Errors) {
 	var devices []*dao.LampPoleGroup
 	err := cache.Redis.Get(getLampPoleGroupListRedisKey(tenantId)).Scan(&devices)
 	if err == nil {
@@ -128,11 +127,11 @@ func (s *lampPoleGroupService) GetList(tenantId string, ) ([]*dao.LampPoleGroup,
 	return devices, nil
 }
 
-func getLampPoleGroupListRedisKey(tenantId string, ) string {
+func getLampPoleGroupListRedisKey(tenantId string) string {
 	return fmt.Sprintf(model.LampPoleGroupList, tenantId)
 }
 
-func (s *lampPoleGroupService) GetFiltration(tenantId string, ) ([]*dao.LampPoleGroup, *common.Errors) {
+func (s *lampPoleGroupService) GetFiltration(tenantId string) ([]*dao.LampPoleGroup, *common.Errors) {
 	var devices []*dao.LampPoleGroup
 	err := cache.Redis.Get(getGroupFiltrationListRedisKey(tenantId)).Scan(&devices)
 	if err == nil {
@@ -157,11 +156,11 @@ func (s *lampPoleGroupService) GetFiltration(tenantId string, ) ([]*dao.LampPole
 	return devices, nil
 }
 
-func getGroupFiltrationListRedisKey(tenantId string, ) string {
+func getGroupFiltrationListRedisKey(tenantId string) string {
 	return fmt.Sprintf(model.GroupFiltrationList, tenantId)
 }
 
-func (s *lampPoleGroupService) GetTree(tenantId string, ) ([]*dao.LampPoleGroup, *common.Errors) {
+func (s *lampPoleGroupService) GetTree(tenantId string) ([]*dao.LampPoleGroup, *common.Errors) {
 	// todo use redis cache
 	device := &dao.LampPoleGroup{
 		TenantId:  tenantId,

+ 0 - 1
app/device/service/manholeCoverService.go

@@ -110,7 +110,6 @@ func (s *manholeCoverService) GetList(tenantId string) ([]*dao.ManholeCover, *co
 
 func (s *manholeCoverService) Setting(tenantId string, id int, threshold string) error {
 	split := strings.Split(threshold, ",")
-	//fmt.Printf("split = %v \n", split)
 	leanAngle, _ := strconv.Atoi(split[0])
 	batteryAlarm, _ := strconv.ParseFloat(split[1], 64)
 	minTemp, _ := strconv.ParseFloat(split[2], 64)

+ 1 - 3
app/device/service/workbenchService.go

@@ -91,7 +91,7 @@ func (s *workbenchService) LightRate(tenantId string, req model.ReqLightRates) (
 	return &rsp, nil
 }
 
-//工作台-采集点
+// 工作台-采集点
 func (s *workbenchService) Aqi(tenantId string) (interface{}, interface{}) {
 	aqi, err := dao.GetAqi(tenantId)
 	if err != nil {
@@ -165,14 +165,12 @@ func (s *workbenchService) getLightRateData(method string, tenantId string, req
 		return nil, err
 	}
 	var list []operationModel.ResponseLightingRate
-	//fmt.Printf("LightEnergys = %v", LightEnergys)
 	var months []string
 	if method == "month" {
 		months = common.GetTimeMonths(req.StartTime, req.EndTime) //时间范围 月
 	} else {
 		months = common.GetTimeDays(req.StartTime, req.EndTime) //时间范围 天
 	}
-	//fmt.Printf("months = %v \n", months)
 	for _, month := range months {
 		// 能耗数据汇总
 		var monthEnergyNum float64 //能耗

+ 0 - 2
app/device/service/zigbeeService.go

@@ -1,7 +1,6 @@
 package service
 
 import (
-	"fmt"
 	"iot_manager_service/app/device/dao"
 	"iot_manager_service/app/device/model"
 	"iot_manager_service/app/system/service"
@@ -58,7 +57,6 @@ func (s *zigbeeService) CreateOrUpdate(userId int64, tenantId string, req dao.Zi
 	if device.IsExistedByNameAndCode() {
 		return common.ParamsInvalidResponse("编码不能重复,请重新填写!", nil)
 	}
-	fmt.Printf("device = %v", device)
 	if err := device.Update(); err != nil {
 		logger.Logger.Errorf("Update err = %s \n", err.Error())
 		return common.FailResponse(err.Error(), nil)

+ 1 - 8
app/logapi/logController.go

@@ -2,8 +2,6 @@ package logapi
 
 import (
 	"context"
-	"encoding/json"
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"github.com/olivere/elastic"
 	"iot_manager_service/util/common"
@@ -49,10 +47,6 @@ func (l logController) List(ctx *gin.Context) {
 		q2 = elastic.NewMatchQuery("req_uri", reqUri)
 		query.Must(q2)
 	}
-	//调试-打印DSL
-	source, _ := query.Source()
-	data, _ := json.MarshalIndent(source, "", "  ")
-	fmt.Printf("source: \n%+v", string(data))
 	//执行并响应
 	result, err3 := LogService.search(indexName, page, size, query)
 	if err3 != nil {
@@ -75,14 +69,13 @@ func (l logController) List(ctx *gin.Context) {
 
 // Detail 日志详情
 func (l logController) Detail(ctx *gin.Context) {
-	fmt.Printf("okkk")
 	var id, indexName string
 	indexName = ctx.Query("indexName")
 	id = ctx.Query("id")
 
 	do, err := es.Client.Get().Index(indexName).Type("_doc").Id(id).Do(context.Background())
 	if err != nil {
-		fmt.Printf("\nerror=%v\n", err)
+		ctx.JSON(http.StatusInternalServerError, common.SuccessResponse("查询失败", err))
 	} else {
 		//响应数据给前端
 		ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, do))

+ 0 - 2
app/logapi/logService.go

@@ -3,7 +3,6 @@ package logapi
 import (
 	"context"
 	"encoding/json"
-	"fmt"
 	"github.com/olivere/elastic"
 	"iot_manager_service/util/es"
 )
@@ -31,7 +30,6 @@ func (l logService) search(indexName string,
 	var a logVO
 	var total int64
 	if total = result.Hits.TotalHits; total > 0 {
-		fmt.Printf("Found a total of %d apilog\n", result.Hits.TotalHits)
 		// Iterate through results
 		for _, hit := range result.Hits.Hits {
 			// hit.Index contains the name of the index

+ 0 - 1
app/multimedia/dao/common.go

@@ -17,7 +17,6 @@ func InitDB(db *gorm.DB) {
 		{&PublishLibraries{}, "已发布节目单库"},
 	}
 	for _, val := range models {
-		//fmt.Println(val.Model)
 		err := Db.Set("gorm:table_options", "comment '"+val.Comment+"'").AutoMigrate(val.Model)
 		if err != nil {
 			panic(fmt.Sprintf("AutoMigrate err : %v", err))

+ 0 - 2
app/multimedia/dao/publishLibrariesDao.go

@@ -1,7 +1,6 @@
 package dao
 
 import (
-	"fmt"
 	"iot_manager_service/util/common"
 	"time"
 )
@@ -54,7 +53,6 @@ func (c *PublishLibraries) GetList(offset int, limit int) ([]PublishLibraries, i
 }
 
 func (c *PublishLibraries) Create() error {
-	fmt.Printf("c = %v", c)
 	return Db.Model(&c).Save(c).Error
 }
 

+ 0 - 2
app/multimedia/service/libraryService.go

@@ -46,7 +46,6 @@ func (s *libraryService) List(tenantId string, searchValue string, current, size
 	if sysType != -1 {
 		library.SysType = sysType
 	}
-	//fmt.Printf("sysType = %v", sysType)
 	libraries, total, err := library.GetLibraries(offset, limit)
 	if err != nil {
 		return nil, 0, common.FailResponse(err.Error(), nil)
@@ -160,7 +159,6 @@ func (s *libraryService) Submit(tenantId string, userId int64, req dao.Library)
 	library.UpdateUser = userId
 	library.UpdateTime = time.Now()
 
-	fmt.Printf("library = %v", library)
 	if library.ID == 0 {
 		library.CreateTime = time.Now()
 		library.CreateUser = userId

+ 0 - 4
app/multimedia/service/programService.go

@@ -152,12 +152,9 @@ func (s *programService) GetLibraryList(tenantId string, programId int) ([]dao.L
 	for _, relation := range relations {
 		libraryIds = append(libraryIds, relation.LibraryId)
 	}
-	//fmt.Printf("libraryIds = %v", libraryIds)
 	library := &dao.Library{TenantId: tenantId}
 	libraries, err := library.GetLibrariesByIds(libraryIds)
 	for i, librarie := range libraries {
-		//fmt.Printf("relations = %v \n", relations)
-		//fmt.Printf("librarie = %v \n", librarie)
 		if librarie.LibDuration == 0 {
 			libraries[i].LibDuration = 3 //图片默认给个3秒
 		}
@@ -224,7 +221,6 @@ func (s *programService) RelationDeviceListByIds(tenantId string, sysType int, d
 	deviceList := []model.ProgramDeviceList{}
 	if sysType == model.SysTypeInfoBar {
 		infoBoardDevices := deviceService.InfoBoardService.GetByIds(tenantId, deviceIds)
-		//fmt.Printf("infoBoardDevices = %v", infoBoardDevices)
 		for _, device := range infoBoardDevices {
 			deviceList = append(deviceList, model.ProgramDeviceList{
 				DeviceName:   device.InfoName,

+ 1 - 16
app/multimedia/service/publishLibrariesService.go

@@ -51,15 +51,12 @@ func (s *publishLibrariesService) Audit(req model.ReqProgramAudit) error {
 	if err != nil {
 		return err
 	}
-	update := PublishLibrariesService.Create(&program, req)
-	fmt.Printf("update = %v", update)
-
+	PublishLibrariesService.Create(&program, req)
 	return nil
 }
 
 // SaveOrUpdate 保存
 func (s *publishLibrariesService) Create(program *dao.Program, req model.ReqProgramAudit) *common.Errors {
-	fmt.Printf("program = %v", program)
 	remarks := "多媒体系统"
 	if program.SysType == 1 {
 		remarks = "广播系统"
@@ -99,7 +96,6 @@ func (s *publishLibrariesService) Create(program *dao.Program, req model.ReqProg
 		logger.Logger.Errorf("Create err = %s \n", err.Error())
 		return common.FailResponse(err.Error(), nil)
 	}
-	fmt.Printf("libraries = %v", libraries)
 	//TODO: 日志保存
 	return common.SuccessResponse(common.Succeeded, nil)
 }
@@ -178,7 +174,6 @@ func (s *publishLibrariesService) LedPaying(ledId int, playing string) string {
 		return ""
 	}
 
-	//fmt.Printf("librarie = %v \n", librarie)
 	program, _ := s.GetProgram(int(librarie.ID))
 	relation := &dao.ProgramRelation{
 		ProgramId: program,
@@ -196,7 +191,6 @@ func (s *publishLibrariesService) LedPaying(ledId int, playing string) string {
 	for _, relation := range relations {
 		libraryIds = append(libraryIds, relation.LibraryId)
 	}
-	//fmt.Printf("libraryIds = %v \n", libraryIds)
 	library := &dao.Library{TenantId: librarie.TenantId}
 	getLibrariesByIds, _ := library.GetLibrariesByIds(libraryIds)
 	if len(getLibrariesByIds) < 1 {
@@ -222,16 +216,12 @@ func (s *publishLibrariesService) LedPaying(ledId int, playing string) string {
 	cltLedLibraries.Imageinfo.InEffect.Type = "2"
 	//cltLedLibraries.Imageinfo.InEffect.Time = strconv.Itoa(relations[0].Duration)
 	cltLedLibraries.Imageinfo.InEffect.Time = "1500"
-	fmt.Printf("cltLedLibraries = %v \n", cltLedLibraries)
 	marshal, err := json.Marshal(cltLedLibraries)
 	if err != nil {
-		fmt.Printf("LedPaying err = %v \n", err)
 		return ""
 	}
-	fmt.Printf("cltLedLibraries = %v \n", string(marshal))
 
 	str := string(marshal)
-	//fmt.Printf("str = %v \n", str)
 	return str
 }
 
@@ -261,7 +251,6 @@ func (s *publishLibrariesService) IPCastPaying(id int) (string, int) {
 		//没有新节目不更新
 		return "", 0
 	}
-	//fmt.Printf("libraries = %v \n", libraries)
 	var librarie dao.PublishLibraries
 	//判断当前到底要放哪个节目
 	for _, library := range libraries {
@@ -273,7 +262,6 @@ func (s *publishLibrariesService) IPCastPaying(id int) (string, int) {
 			currTime := time.Now()
 			parse, err := time.Parse("2006-01-02 15:04", fmt.Sprintf("%v %v", time.Now().Format("2006-01-02"), library.JsTime))
 			if err != nil {
-				fmt.Printf("IPCastPaying parse err = %v \n", err)
 				logger.Logger.Errorf("IPCastPaying parse err = %v \n", err)
 				continue
 			}
@@ -285,7 +273,6 @@ func (s *publishLibrariesService) IPCastPaying(id int) (string, int) {
 			cTime := time.Now()
 			kTime, err := time.Parse("2006-01-02 15:04", fmt.Sprintf("%v %v", time.Now().Format("2006-01-02"), library.KsTime))
 			if err != nil {
-				fmt.Printf("IPCastPaying kTime err = %v \n", err)
 				logger.Logger.Errorf("IPCastPaying kTime err = %v \n", err)
 			}
 			//这里要作限制 ,只有是当前时分 才操作
@@ -295,7 +282,6 @@ func (s *publishLibrariesService) IPCastPaying(id int) (string, int) {
 		}
 		librarie = library
 	}
-	//fmt.Printf("librarie = %v \n", librarie)
 	program, _ := s.GetProgram(int(librarie.ID))
 	relation := &dao.ProgramRelation{
 		ProgramId: program,
@@ -316,7 +302,6 @@ func (s *publishLibrariesService) IPCastPaying(id int) (string, int) {
 		logger.Logger.Errorf("无素材")
 		return "", 0
 	}
-	//fmt.Printf("getLibrariesByIds = %v \n", getLibrariesByIds)
 	// 音频播放
 	if librarie.Ptype == 1 {
 		paytime := diffTime(librarie.KsTime, librarie.JsTime)

+ 0 - 3
app/operation/dao/captureOverSpeedDao.go

@@ -38,8 +38,6 @@ func (c CaptureOverSpeed) BatchCreate(his []CaptureOverSpeed) error {
 
 // Gets 记录列表
 func (c CaptureOverSpeed) Gets(captureSn string, req model.RequestCaptureOverSpeed) ([]CaptureOverSpeed, int64, error) {
-	//fmt.Printf("size = %v \n", size)
-	//fmt.Printf("current = %v \n", current)
 	var list []CaptureOverSpeed
 	db := Db.Model(&c).Where(&CaptureOverSpeed{CaptureSn: captureSn})
 	db.Where("time between ? and ?", req.StartTime+" 00:00:00", req.EndTime+" 23:59:59")
@@ -50,6 +48,5 @@ func (c CaptureOverSpeed) Gets(captureSn string, req model.RequestCaptureOverSpe
 	if errors.Is(err, gorm.ErrRecordNotFound) {
 		err = nil
 	}
-	//fmt.Printf("count = %v", count)
 	return list, count, err
 }

+ 0 - 1
app/operation/dao/common.go

@@ -15,7 +15,6 @@ func InitDB(db *gorm.DB) {
 		{&ManholeCoverDao{}, "井盖数据记录表"},
 	}
 	for _, val := range models {
-		//fmt.Println(val.Model)
 		err := Db.Set("gorm:table_options", "comment '"+val.Comment+"'").AutoMigrate(val.Model)
 		if err != nil {
 			panic(fmt.Sprintf("AutoMigrate err : %v", err))

+ 2 - 9
app/operation/edge_service/forCaptureItsService.go

@@ -92,16 +92,14 @@ func (f ForCaptureIts) Vehicleplate(reqPostData ForCaptureItsReq) ([]ForCaptureI
 	return f.pubPost(reqPostData, api)
 }
 
-//公用 post请求
+// 公用 post请求
 func (f ForCaptureIts) pubPost(reqPostData ForCaptureItsReq, api string) ([]ForCaptureItsData, error) {
 	cfg := config.Instance()
 	api = cfg.Foreign.IotEdgeUrl + api
-	//fmt.Printf("api = %v \n", api)
 	if !strings.Contains(reqPostData.Start, ":") {
 		reqPostData.Start = reqPostData.Start + " 00:00:00"
 		reqPostData.End = reqPostData.End + " 23:59:59"
 	}
-	//fmt.Printf("reqPostData = %v \n", reqPostData)
 	method := "POST"
 	client := &http.Client{}
 	marshal, _ := json.Marshal(reqPostData)
@@ -119,7 +117,6 @@ func (f ForCaptureIts) pubPost(reqPostData ForCaptureItsReq, api string) ([]ForC
 	if err != nil {
 		return nil, err
 	}
-	//fmt.Printf("body = %v", string(body))
 	result := ForCaptureItsRes{}
 	err = json.Unmarshal(body, &result)
 	if err != nil {
@@ -128,7 +125,6 @@ func (f ForCaptureIts) pubPost(reqPostData ForCaptureItsReq, api string) ([]ForC
 	if result.Code != 0 {
 		panic(result.Msg)
 	}
-	//fmt.Printf("result.Data = %v", result.Data)
 	return result.Data, nil
 }
 
@@ -143,7 +139,7 @@ type SyncOverSpeedRecordData struct {
 	Flag  int    `json:"flag"`
 }
 
-//同步超速车牌号返回数据
+// 同步超速车牌号返回数据
 type syncOverSpeedRecordDataRes struct {
 	Code int                       `json:"code"`
 	Msg  string                    `json:"msg"`
@@ -166,7 +162,6 @@ func (r *ForCaptureIts) SyncOverSpeedRecord(maxId int64, maxUpDateTime string, s
 		startStr := parse.Format("2006-01-02 15:04:05")
 		url = fmt.Sprintf("%v?id=%d&start=%v&end=%v", api, maxId, url2.QueryEscape(startStr), url2.QueryEscape(time.Now().Format("2006-01-02 15:04:05")))
 	}
-	//fmt.Printf("url = %v", url)
 	method := "GET"
 	client := &http.Client{}
 	req, err := http.NewRequest(method, url, nil)
@@ -183,7 +178,6 @@ func (r *ForCaptureIts) SyncOverSpeedRecord(maxId int64, maxUpDateTime string, s
 	if err != nil {
 		return nil, err
 	}
-	//fmt.Printf("body = %v", string(body))
 	result := syncOverSpeedRecordDataRes{}
 	err = json.Unmarshal(body, &result)
 	if err != nil {
@@ -192,6 +186,5 @@ func (r *ForCaptureIts) SyncOverSpeedRecord(maxId int64, maxUpDateTime string, s
 	if result.Code != 0 {
 		panic(result.Msg)
 	}
-	//fmt.Printf("result.Data = %v", result.Data)
 	return result.Data, nil
 }

+ 0 - 2
app/operation/edge_service/forLightEnergyService.go

@@ -52,7 +52,6 @@ func (r *ForLightEnergy) GetLightEnergy(reqPostData ForLightEnergyReq) (map[stri
 	if err != nil {
 		return nil, err
 	}
-	//fmt.Printf("body = %v", string(body))
 	result := ForLightEnergyRes{}
 	err = json.Unmarshal(body, &result)
 	if err != nil {
@@ -61,6 +60,5 @@ func (r *ForLightEnergy) GetLightEnergy(reqPostData ForLightEnergyReq) (map[stri
 	if result.Code != 0 {
 		panic(result.Msg)
 	}
-	//fmt.Printf("result.Data = %v", result.Data)
 	return result.Data, nil
 }

+ 0 - 3
app/operation/edge_service/forLightRateService.go

@@ -2,7 +2,6 @@ package edge_service
 
 import (
 	"encoding/json"
-	"fmt"
 	"github.com/mitchellh/mapstructure"
 	"io/ioutil"
 	"iot_manager_service/config"
@@ -58,7 +57,6 @@ func (r *ForLightRate) GetLightRate(reqPostData ForLightRateReq) ([]ForLightRate
 	if err != nil {
 		return nil, err
 	}
-	//fmt.Printf("body = %v", string(body))
 	result := ForLightRateRes{}
 	err = json.Unmarshal(body, &result)
 	if err != nil {
@@ -74,6 +72,5 @@ func (r *ForLightRate) GetLightRate(reqPostData ForLightRateReq) ([]ForLightRate
 		return nil, err
 	}
 	println(data["data"])
-	fmt.Printf("list = %v \n", list)
 	return list, nil
 }

+ 0 - 1
app/operation/service/alarmService.go

@@ -29,7 +29,6 @@ func (s alarmService) getData(method string, tenantId string, req model.RequestA
 	} else {
 		countDates = common.GetTimeDays(req.StartTime, req.EndTime) //时间范围 天
 	}
-	//fmt.Printf("alarms = %v \n", alarms)
 	//数据按时间范围 填充
 	var list []model.ResponseAlarm
 	for _, countDate := range countDates {

+ 1 - 3
app/operation/service/captureReportService.go

@@ -49,8 +49,6 @@ func (s captureReportService) GetList(tenantId string, req model.RequestCaptureR
 			countTimes = append(countTimes, ii)
 		}
 	}
-	//fmt.Printf("nlist = %v \n", nlist)
-	//fmt.Printf("countTimes = %v \n", countTimes)
 	//	types := []int{14, 26, 17, 10, 33, 25, 146, 8, 9}
 	for _, countTime := range countTimes {
 		list = append(list, model.ResponseCaptureReport{
@@ -71,7 +69,7 @@ func (s captureReportService) GetList(tenantId string, req model.RequestCaptureR
 	return list, err
 }
 
-//得到边缘接口 时间范围数据
+// 得到边缘接口 时间范围数据
 func (s captureReportService) getData(tenantId string, req model.RequestCaptureReportFilter) (int, []edge_service.ForCaptureItsData, error) {
 	//区分按月或按日
 	flag := 1 //月

+ 0 - 1
app/operation/service/captureService.go

@@ -39,7 +39,6 @@ func (s captureService) getVehicleTotalData(flag int, tenantId string, req model
 		End:   req.EndTime,
 		Flag:  flag,
 	})
-	//fmt.Printf("forData = %v \n", forData)
 	var countTimes []string
 	if flag == 1 {
 		countTimes = common.GetTimeMonths(req.StartTime, req.EndTime) //时间范围 月

+ 0 - 2
app/operation/service/lightingRateService.go

@@ -57,14 +57,12 @@ func (s lightingRateService) getData(method string, tenantId string, req model.R
 		return nil, err
 	}
 	var list []model.ResponseLightingRate
-	//fmt.Printf("LightEnergys = %v", LightEnergys)
 	var months []string
 	if method == "month" {
 		months = common.GetTimeMonths(req.StartTime, req.EndTime) //时间范围 月
 	} else {
 		months = common.GetTimeDays(req.StartTime, req.EndTime) //时间范围 天
 	}
-	//fmt.Printf("months = %v \n", months)
 	for _, month := range months {
 		// 能耗数据汇总
 		var monthEnergyNum float64 //能耗

+ 0 - 1
app/record/dao/aKeyAlarmDao.go

@@ -59,7 +59,6 @@ func (a AkeyAlarmRecord) GetMaxIdAndUpDateTime() (int64, string) {
 
 func (a AkeyAlarmRecord) BatchCreate(record []edge_service.RecordAlarmSosData) error {
 	his, err := a.assembleRecordHis(record)
-	//fmt.Printf("his = %v", his)
 	if err != nil {
 		return err
 	}

+ 0 - 1
app/record/dao/common.go

@@ -14,7 +14,6 @@ func InitDB(db *gorm.DB) {
 		{&AkeyAlarmRecord{}, "一键求助记录表"},
 	}
 	for _, val := range models {
-		//fmt.Println(val.Model)
 		err := Db.Set("gorm:table_options", "comment '"+val.Comment+"'").AutoMigrate(val.Model)
 		if err != nil {
 			panic(fmt.Sprintf("AutoMigrate err : %v", err))

+ 0 - 3
app/record/edge_service/recordAlarmSos.go

@@ -31,7 +31,6 @@ func (r *RecordAlarmSos) SyncRecord(maxId int64, maxUpDateTime string) ([]Record
 	cfg := config.Instance()
 	api := cfg.Foreign.IotEdgeUrl + "/data/v1/sos/sync"
 	url := fmt.Sprintf("%v?id=%d&&updatedat=%v", api, maxId, url2.QueryEscape(maxUpDateTime))
-	//fmt.Printf("url = %v", url)
 	method := "GET"
 	client := &http.Client{}
 	req, err := http.NewRequest(method, url, nil)
@@ -48,7 +47,6 @@ func (r *RecordAlarmSos) SyncRecord(maxId int64, maxUpDateTime string) ([]Record
 	if err != nil {
 		return nil, err
 	}
-	//fmt.Printf("body = %v", string(body))
 	result := RecordAlarmSosReq{}
 	err = json.Unmarshal(body, &result)
 	if err != nil {
@@ -57,6 +55,5 @@ func (r *RecordAlarmSos) SyncRecord(maxId int64, maxUpDateTime string) ([]Record
 	if result.Code != 0 {
 		panic(result.Msg)
 	}
-	//fmt.Printf("result.Data = %v", result.Data)
 	return result.Data, nil
 }

+ 0 - 3
app/record/service/aKeyAlarmRecordService.go

@@ -1,7 +1,6 @@
 package service
 
 import (
-	"fmt"
 	"iot_manager_service/app/record/dao"
 	"iot_manager_service/app/record/edge_service"
 )
@@ -33,10 +32,8 @@ func (s aKeyAlarmRecordService) Refresh() {
 	up := edge_service.RecordAlarmSos{}
 	maxId, maxUpDateTime := dao.AkeyAlarmRecord{}.GetMaxIdAndUpDateTime()
 	recordLightUpDatas, err := up.SyncRecord(maxId, maxUpDateTime)
-	//fmt.Printf("recordLightUpDatas = %v", recordLightUpDatas)
 	dao.AkeyAlarmRecord{}.BatchCreate(recordLightUpDatas)
 	if err != nil {
-		fmt.Printf("Refresh err.Error() = %v", err)
 		return
 	}
 }

+ 0 - 5
app/security/edge_service/forRewindService.go

@@ -14,29 +14,24 @@ type ForRewindService struct {
 
 // getRewindApi 公用请求接口
 func (f *ForRewindService) getRewindApi(url string) (string, error) {
-	//fmt.Printf("url = %v", url)
 	method := "GET"
 
 	client := &http.Client{}
 	req, err := http.NewRequest(method, url, nil)
 
 	if err != nil {
-		fmt.Println(err)
 		return "", nil
 	}
 	res, err := client.Do(req)
 	if err != nil {
-		fmt.Println(err)
 		return "", nil
 	}
 	defer res.Body.Close()
 
 	body, err := ioutil.ReadAll(res.Body)
 	if err != nil {
-		fmt.Println(err)
 		return "", nil
 	}
-	fmt.Println(string(body))
 	return string(body), err
 }
 

+ 0 - 2
app/security/edge_service/forVidiconService.go

@@ -36,7 +36,6 @@ func (f *ForVidiconService) Ptzhome(code string, name string, flag int) (bool, e
 
 // getVidiconApi 公用请求接口
 func (f *ForVidiconService) getVidiconApi(url string) (bool, error) {
-	//fmt.Printf("url = %v", url)
 	method := "GET"
 	client := &http.Client{}
 	req, err := http.NewRequest(method, url, nil)
@@ -52,7 +51,6 @@ func (f *ForVidiconService) getVidiconApi(url string) (bool, error) {
 	if err != nil {
 		return false, err
 	}
-	//fmt.Printf("body = %v", string(body))
 	result := VidiconRespose{}
 	err = json.Unmarshal(body, &result)
 	if err != nil {

+ 0 - 2
app/security/service/multiscreenService.go

@@ -26,7 +26,6 @@ func (s multiscreenService) List(claims *middleware.Claims) ([]model.Placement,
 		ids = append(ids, strconv.Itoa(idInt))
 	}
 	//devices := deviceDao.CameraDevice{}.GetDevicesByIds(strings.Join(ids, ","))
-	//fmt.Printf("devices = %v", devices)
 	var list []model.Placement
 	for i, id := range idsSplit {
 		idInt, _ := strconv.Atoi(id)
@@ -45,7 +44,6 @@ func (s multiscreenService) List(claims *middleware.Claims) ([]model.Placement,
 		}
 		list = append(list, placement)
 	}
-	//fmt.Printf("list = %v", list)
 	return list, nil
 }
 

+ 0 - 2
app/system/dao/tenant.go

@@ -1,7 +1,6 @@
 package dao
 
 import (
-	"fmt"
 	"time"
 )
 
@@ -92,7 +91,6 @@ func (c *Tenant) Update() error {
 func (c *Tenant) GetAll() ([]Tenant, error) {
 	var tenants []Tenant
 	err := Db.Model(&c).Where("is_deleted = 0").Find(&tenants).Error
-	fmt.Printf("[]Tenant:%v\n", tenants)
 	return tenants, err
 }
 

+ 1 - 3
app/system/dao/user.go

@@ -1,7 +1,6 @@
 package dao
 
 import (
-	"fmt"
 	"time"
 )
 
@@ -100,8 +99,7 @@ func (c *User) UpdateRoles(userIds []string, roleIds string) error {
 // IsExist :account是否已存在 true为存在,false不存在
 func (c *User) IsExist() bool {
 	var s string
-	r := Db.Model(&c).Select("account").Where("account = ?", c.Account).First(&s).Error
-	fmt.Printf("ERROR:%v\n account:%v\n return:%v\n", r, s, s != "")
+	Db.Model(&c).Select("account").Where("account = ?", c.Account).First(&s)
 	return s != ""
 }
 

+ 0 - 1
app/system/service/userService.go

@@ -226,7 +226,6 @@ func (s *userService) UpAvatar(tenantId string, userId int64, fileHeader *multip
 	url := config.Instance().Minio.Link + "/" + bucket + "/" + objectName
 	dao.Avatar = url
 	dao.Update()
-	fmt.Printf("\n=====user:%+v\n", dao)
 	var link = model.Link{Link: url}
 	return &link
 }

+ 0 - 1
app/warn/dao/common.go

@@ -17,7 +17,6 @@ func InitDB(db *gorm.DB) {
 		{&BusinessTactics{}, "业务策略"},
 	}
 	for _, val := range models {
-		//fmt.Println(val.Model)
 		err := Db.Set("gorm:table_options", "comment '"+val.Comment+"'").AutoMigrate(val.Model)
 		if err != nil {
 			panic(fmt.Sprintf("AutoMigrate err : %v", err))

+ 0 - 2
app/warn/dao/noticeRecordDao.go

@@ -1,7 +1,6 @@
 package dao
 
 import (
-	"fmt"
 	"gorm.io/gorm"
 	"iot_manager_service/app/warn/model"
 	"iot_manager_service/util/common"
@@ -59,7 +58,6 @@ func (r NoticeRecord) GetList(filter model.RequestNoticeRecordFilter) ([]NoticeR
 
 	err := db.Preload("PlatformAlarm").Order("id desc").Find(&list).Error
 
-	fmt.Printf("total = %v", total)
 	return list, total, err
 }
 

+ 0 - 1
app/warn/dao/noticeSetDao.go

@@ -73,6 +73,5 @@ func (s *NoticeSet) Delete() error {
 func (s NoticeSet) GetNoticeList(deviceType int, sn string) ([]NoticeSet, error) {
 	var list []NoticeSet
 	err := Db.Where("device_sn=999999").Or("device_type=?", deviceType).Or("device_sn=?", sn).Find(&list).Error
-	//fmt.Printf("err = %v \n", err)
 	return list, err
 }

+ 0 - 1
app/warn/dao/platformAlarmDao.go

@@ -70,7 +70,6 @@ func (a PlatformAlarm) Gets(filter model.RequestPlatFormAlartFilter) ([]Platform
 	}
 	var count int64
 	db.Count(&count)
-	//fmt.Printf("count = %v", count)
 	return list, count, err
 }
 

+ 0 - 2
app/warn/edge_service/syncAlarmService.go

@@ -55,7 +55,6 @@ func (r *RecordAlarmRecord) SyncAlartRecord(maxId int64, maxUpDateTime string) (
 	if err != nil {
 		return nil, err
 	}
-	//fmt.Printf("body = %v", string(body))
 	result := RecordAlarmRecordRes{}
 	err = json.Unmarshal(body, &result)
 	if err != nil {
@@ -64,6 +63,5 @@ func (r *RecordAlarmRecord) SyncAlartRecord(maxId int64, maxUpDateTime string) (
 	if result.Code != 0 {
 		panic(result.Msg)
 	}
-	//fmt.Printf("result.Data = %v", result.Data)
 	return result.Data, nil
 }

+ 0 - 2
app/warn/service/noticeSetService.go

@@ -1,7 +1,6 @@
 package service
 
 import (
-	"fmt"
 	systemDao "iot_manager_service/app/system/dao"
 	systemService "iot_manager_service/app/system/service"
 	"iot_manager_service/app/warn/dao"
@@ -111,7 +110,6 @@ func (s noticeSetService) getNoteiceSets(tenantId string) map[string]dao.NoticeS
 	news := make(map[string]dao.NoticeSet)
 	for _, set := range list {
 		key := set.TenantId + strconv.Itoa(set.RType) + strconv.Itoa(set.DeviceType) + strconv.Itoa(set.DeviceId)
-		fmt.Printf("xxxkey = %v", key)
 		set.BusinessUserIdsName = strings.ReplaceAll(set.BusinessUserIdsName, " | ", ",")
 		set.DevUserIdsName = strings.ReplaceAll(set.DevUserIdsName, " | ", ",")
 		news[key] = set

+ 4 - 8
util/cache/redis.go

@@ -1,8 +1,8 @@
 package cache
 
 import (
-	"fmt"
 	"github.com/go-redis/redis"
+	"github.com/sirupsen/logrus"
 	"iot_manager_service/config"
 	"iot_manager_service/util/common"
 	"strconv"
@@ -15,7 +15,6 @@ func InitRedis() error {
 	cfg := config.Instance()
 	addr := cfg.Redis.Host
 
-	fmt.Printf("addr = %v \n", addr)
 	Redis = redis.NewClient(&redis.Options{
 		Addr:         addr,
 		DialTimeout:  10 * time.Second,
@@ -42,11 +41,11 @@ const (
 	TIME          = "time"
 )
 
-//GetDeviceState 获取设备状态 1在线 2离线
+// GetDeviceState 获取设备状态 1在线 2离线
 func GetDeviceState(id string) (retTime time.Time, retState string) {
 	defer func() {
 		if err1 := recover(); err1 != nil {
-			fmt.Println("GetDeviceState err = ", err1)
+			logrus.Errorln("GetDeviceState err = ", err1)
 		}
 	}()
 	retTime = time.Time{}
@@ -54,8 +53,6 @@ func GetDeviceState(id string) (retTime time.Time, retState string) {
 	//redis中 1在线 0离线
 	//todo 需要统一
 	list, err := Redis.HMGet(DeviceStateKey+id, TLast, ONLINE).Result()
-	//fmt.Printf("list = %v id=%v \n", list, DeviceStateKey+id)
-	//fmt.Printf("err = %v \n", err)
 	if err == nil && list[0] != nil || list[1] != nil {
 		t, err1 := common.MlParseTime(list[0].(string))
 		s, err0 := strconv.Atoi(list[1].(string))
@@ -72,7 +69,6 @@ func GetDeviceState(id string) (retTime time.Time, retState string) {
 // GetSwitchState 查灯是否开关
 func GetSwitchState(id string) bool {
 	_, values := GetDeviceData(id)
-	//fmt.Printf("id=%v  values = %v \n", id, values)
 	value, ok := values[1]
 	if ok && value > 1 {
 		return true
@@ -80,7 +76,7 @@ func GetSwitchState(id string) bool {
 	return false
 }
 
-//GetDeviceData 获取设备数据 时间 key-value
+// GetDeviceData 获取设备数据 时间 key-value
 func GetDeviceData(id string) (retTime time.Time, values map[int]float32) {
 	values = make(map[int]float32)
 	if mapData, err := Redis.HGetAll(DeviceDataKey + id).Result(); err == nil {

+ 0 - 1
util/common/common.go

@@ -221,7 +221,6 @@ func GetTimeDays(start_time, stop_time string) []string {
 	end := []rune(stop_time)
 	tm1, _ := time.Parse("2006-01-02", string(star[:10]))
 	tm2, _ := time.Parse("2006-01-02", string(end[:10]))
-	//fmt.Printf("star = %v \n", string(star[:10]))
 	sInt := tm1.Unix()
 	eInt := tm2.Unix()
 	var args []string

+ 1 - 5
util/es/elastic.go

@@ -2,7 +2,6 @@ package es
 
 import (
 	"context"
-	"fmt"
 	"github.com/olivere/elastic"
 	"iot_manager_service/config"
 	"log"
@@ -41,8 +40,5 @@ func delTicker() {
 
 // DelIndex 删除索引
 func delIndex(indexName string) {
-	res, err := Client.DeleteIndex(indexName).Do(context.Background())
-	if err != nil {
-		fmt.Printf("res:%v\nerror:%v\n", res, err)
-	}
+	Client.DeleteIndex(indexName).Do(context.Background())
 }

+ 0 - 2
util/notify/tencent_sms.go

@@ -3,7 +3,6 @@ package notify
 import (
 	"encoding/json"
 	errors2 "errors"
-	"fmt"
 	"iot_manager_service/config"
 	"strings"
 
@@ -96,7 +95,6 @@ func SendTencentSms(receiverPhoneNumbers []string, smsTemplateId string, values
 	response, err := client.SendSms(request)
 	// 处理异常
 	if _, ok := err.(*errors.TencentCloudSDKError); ok {
-		fmt.Printf("An API error has returned: %s", err)
 		return err
 	}
 	// 非SDK异常,直接失败。实际代码中可以加入其他的处理。