瀏覽代碼

添加ip音柱

sixian 2 年之前
父節點
當前提交
c80d241cc0

+ 19 - 19
app/data/controller/calcTask.go

@@ -7,10 +7,10 @@ import (
 	"io/ioutil"
 	"iot_manager_service/app/data/model"
 	"iot_manager_service/app/data/service"
-	controller "iot_manager_service/app/device/controller"
-	device "iot_manager_service/app/device/service"
-	system "iot_manager_service/app/system/dao"
-	warnService "iot_manager_service/app/warn/service"
+	deviceCtl "iot_manager_service/app/device/controller"
+	deviceSer "iot_manager_service/app/device/service"
+	recordCtl "iot_manager_service/app/record/controller"
+	warnSer "iot_manager_service/app/warn/service"
 	"iot_manager_service/util/cache"
 	"iot_manager_service/util/logger"
 	"net/http"
@@ -23,45 +23,45 @@ func CalcTask() {
 	daySpec := "0 1 0 * * ?"
 	c := cron.New()
 	_ = c.AddFunc(hourSpec, func() {
-		devices := device.GarbageService.GetAll()
+		devices := deviceSer.GarbageService.GetAll()
 		var deviceIds []string
 		for _, d := range devices {
 			deviceIds = append(deviceIds, d.DeviceIMei)
 		}
 		GarbageDataSync(deviceIds)
 	})
+
+	//【环境传感】日数据
 	_ = c.AddFunc(hourSpec, func() {
 		service.EnvironmentDataService.DataSync()
 	})
-
+	//【环境传感】天数据
 	_ = c.AddFunc(daySpec, func() {
 		service.EnvironmentDataService.DayDataSync()
 	})
-
-	//处理告警消息
+	//【告警管理】处理告警消息
 	_ = c.AddFunc(hourSpec, func() {
-		//抓取数据
-		tenant := system.Tenant{}
-		tenants, _, _ := tenant.GetTenants(0, 1000)
-		for _, t := range tenants {
-			warnService.PlatformAlarmService.Refresh(t.TenantId)
-		}
+		//同步告警
+		warnSer.PlatformAlarmService.SyncAlarm()
 		//发送告警
-		warnService.TaskWarnService.HandlingAlarms()
+		warnSer.TaskWarnService.HandlingAlarms()
+	})
+	//【一键告警】同步记录
+	c.AddFunc("*/59 * * * * ?", func() {
+		recordCtl.AKeyAlarmRecord.SosRecordSync()
 	})
-
 	//【led信息屏】每天早上07:10同步亮度与音量
 	c.AddFunc("0 10 7 * * ?", func() {
 		//c.AddFunc("*/10 * * * * ?", func() {
-		controller.InfoBoard.CronSyncBrightnessAndMusicvolume()
+		deviceCtl.InfoBoard.CronSyncBrightnessAndMusicvolume()
 	})
 	//【led信息屏】每天晚上18:10同步亮度与音量
 	c.AddFunc("0 10 18 * * ?", func() {
-		controller.InfoBoard.CronSyncBrightnessAndMusicvolume()
+		deviceCtl.InfoBoard.CronSyncBrightnessAndMusicvolume()
 	})
 	//【led信息屏】播放节目同步
 	c.AddFunc("*/10 * * * * ?", func() {
-		controller.InfoBoard.CronSyncLedPaying(0)
+		deviceCtl.InfoBoard.CronSyncLedPaying(0)
 	})
 	c.Start()
 }

+ 5 - 0
app/device/controller/infoBoardController.go

@@ -71,6 +71,11 @@ func (c *infoBoardCtl) CreateOrUpdate(ctx *gin.Context) {
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		return
 	}
+	if req.ID > 0 {
+		//更新 排程
+		c.CronSyncLedPaying(req.ID)
+		//fmt.Printf("req.ID = %v \n", req.ID)
+	}
 	err := service.InfoBoardService.CreateOrUpdate(claims.UserId, claims.TenantId, req)
 	ctx.JSON(http.StatusOK, err)
 }

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

@@ -3,6 +3,7 @@ package controller
 import (
 	"github.com/gin-gonic/gin"
 	"iot_manager_service/app/device/dao"
+	"iot_manager_service/app/device/edge_service"
 	"iot_manager_service/app/device/model"
 	"iot_manager_service/app/device/service"
 	"iot_manager_service/app/middleware"
@@ -109,6 +110,14 @@ func (c *ipBroadcastCtl) SettingVolume(ctx *gin.Context) {
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		return
 	}
+	if req.SoundVolume <= 1 {
+		req.SoundVolume = 1
+	}
+	err2 := edge_service.IpCastControlService{}.SetVol(req.CastSn, req.SoundVolume)
+	if err2 != nil {
+		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err2.Error(), nil))
+		return
+	}
 	err := service.IpBroadcastService.CreateOrUpdate(claims.UserId, claims.TenantId, req)
 	ctx.JSON(http.StatusOK, err)
 }

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

@@ -0,0 +1,127 @@
+package edge_service
+
+import (
+	"encoding/json"
+	"errors"
+	"fmt"
+	"io/ioutil"
+	"iot_manager_service/config"
+	"iot_manager_service/util/common"
+	"iot_manager_service/util/logger"
+	"net/http"
+	"strings"
+)
+
+// IpCastControlService ip音柱连续控制接口
+type IpCastControlService struct{}
+
+type IpCastControlReq struct {
+	Action   string                 `json:"action"`
+	PostData map[string]interface{} `json:"postData"`
+}
+
+type TermInfo struct {
+	AreaID int    `json:"AreaID"`
+	From   string `json:"From"`
+	ID     int    `json:"ID"`
+	IP     string `json:"IP"`
+	Name   string `json:"Name"`
+	Online int    `json:"Online"`
+	State  int    `json:"State"`
+	Tasks  int    `json:"Tasks"`
+	Vol    int    `json:"Vol"`
+}
+
+// GetTermIds 取设备列表和状态
+func (f IpCastControlService) GetTermIds() (terminfos map[string]TermInfo, err error) {
+	var reqData IpCastControlReq
+	reqData.Action = "GetTermIds"
+	m := make(map[string]interface{})
+	reqData.PostData = m
+	mapStr, err := f.RequestApi(reqData)
+	if err != nil {
+		return terminfos, err
+	}
+	terms, ok := mapStr["Terms"]
+	if ok {
+		marshal, _ := json.Marshal(terms)
+		var terminfosList []TermInfo
+		err := json.Unmarshal(marshal, &terminfosList)
+		terms := make(map[string]TermInfo)
+		for _, info := range terminfosList {
+			info.Vol = int(common.MapRange(float64(info.Vol), 1, 16, 1, 100))
+			terms[info.Name] = info
+		}
+		terminfos = terms
+		if err != nil {
+			return nil, err
+		}
+		return terminfos, nil
+	}
+	return terminfos, err
+}
+
+func (f IpCastControlService) RequestApi(reqData IpCastControlReq) (map[string]interface{}, error) {
+	cfg := config.Instance()
+	url := fmt.Sprintf("%v/%v", cfg.Foreign.IpCastEdgeUrl, reqData.Action)
+	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())
+		return nil, err
+	}
+	req.Header.Add("Content-Type", "application/json")
+	res, err := client.Do(req)
+	if err != nil {
+		logger.Logger.Errorf("IpCastControlService Do %v", err.Error())
+		return nil, err
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		logger.Logger.Errorf("IpCastControlService ReadAll %v", err.Error())
+		return nil, err
+	}
+
+	var IpCastControlRes map[string]interface{}
+	err = json.Unmarshal(body, &IpCastControlRes)
+	if err != nil {
+		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
+	}
+	return IpCastControlRes, nil
+}
+
+// SetVol 设置音量
+func (f IpCastControlService) SetVol(sn string, vol int) error {
+	terminfos, err2 := f.GetTermIds()
+	if err2 != nil {
+		return err2
+	}
+	term, ok := terminfos[sn]
+	if !ok {
+		return errors.New("devices not found\tsn=" + sn)
+	}
+	var reqData IpCastControlReq
+	reqData.Action = "TermVolSet"
+	m := make(map[string]interface{})
+	m["TermIds"] = []int{term.ID}
+	m["Volume"] = int(common.MapRange(float64(vol), 1, 100, 1, 16))
+	reqData.PostData = m
+	_, err := f.RequestApi(reqData)
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 5 - 3
app/device/service/infoBoardService.go

@@ -216,13 +216,15 @@ func (s *infoBoardService) EdgeCmd(tenant, sn string, cmdNum, id int) {
 		}
 		dev, _ := device.GetDevice()
 		action = "ssched"
-		param["sleep"] = dev.BootEndTime
-		param["wakeup"] = dev.BootStartTime
+		sleep := dev.BootEndTime + ":00"
+		param["sleep"] = sleep[0:8]
+		wakeup := dev.BootStartTime + ":00"
+		param["wakeup"] = wakeup[0:8]
 		if dev.NeverCloseDown == 1 {
 			param["sleep"] = ""
 			param["wakeup"] = ""
 		}
-		param["reboot"] = "01:30" //每日重启时间
+		param["reboot"] = "12:30:10" //每日重启时间
 		s.reqEdge(tenant, edgePost, param, action)
 	case 101: //更新亮度 音量, 这里需要做成定时任务去跑
 		device := &dao.InfoBoard{

+ 35 - 7
app/device/service/ipBroadcastService.go

@@ -2,9 +2,9 @@ package service
 
 import (
 	"iot_manager_service/app/device/dao"
+	"iot_manager_service/app/device/edge_service"
 	"iot_manager_service/app/device/model"
 	"iot_manager_service/app/system/service"
-	"iot_manager_service/util/cache"
 	"iot_manager_service/util/common"
 	"iot_manager_service/util/logger"
 	"time"
@@ -23,12 +23,26 @@ func (s *ipBroadcastService) Get(id int) (*model.IpBroadcastDetail, *common.Erro
 	if err != nil {
 		return nil, common.FailResponse(err.Error(), nil)
 	}
-	endTime, state := cache.GetDeviceState(device.CastSn)
+	terms, err := edge_service.IpCastControlService{}.GetTermIds()
+	if err != nil {
+		return nil, common.FailResponse(err.Error(), nil)
+	}
+	//endTime, state := cache.GetDeviceState(device.CastSn)
+	info, ok := terms[device.CastSn]
+	state := "2"
+	if ok {
+		if info.Online == 1 {
+			state = "1"
+			device.SoundVolume = info.Vol
+			device.IPAddress = info.IP
+		}
+	}
+
 	return &model.IpBroadcastDetail{
 		IpBroadcast:  *device,
 		RunState:     state,
 		NetworkState: state,
-		EndLineTime:  endTime,
+		//EndLineTime:  endTime,
 	}, nil
 }
 
@@ -69,6 +83,10 @@ func (s *ipBroadcastService) CreateOrUpdate(userId int64, tenantId string, req d
 
 func (s *ipBroadcastService) List(searchValue string, current, size int) ([]model.IpBroadcastDetail, int64, *common.Errors) {
 	device := dao.IpBroadcast{}
+	terms, err := edge_service.IpCastControlService{}.GetTermIds()
+	if err != nil {
+		return nil, 0, nil
+	}
 	if searchValue != "" {
 		device.CastSn = searchValue
 		device.CastName = searchValue
@@ -82,12 +100,22 @@ func (s *ipBroadcastService) List(searchValue string, current, size int) ([]mode
 	}
 	var details []model.IpBroadcastDetail
 	for _, d := range devices {
-		endTime, state := cache.GetDeviceState(d.CastSn)
+		//endTime, state := cache.GetDeviceState(d.CastSn)
+		info, ok := terms[d.CastSn]
+		state := "2"
+		if ok {
+			if info.Online == 1 {
+				state = "1"
+				d.SoundVolume = info.Vol
+				d.IPAddress = info.IP
+			}
+		}
 		details = append(details, model.IpBroadcastDetail{
 			IpBroadcast:  d,
 			RunState:     state,
 			NetworkState: state,
-			EndLineTime:  endTime,
+
+			//EndLineTime:  endTime,
 		})
 	}
 	return details, total, nil
@@ -110,7 +138,7 @@ func (s *ipBroadcastService) Remove(userId int64, tenantId string, id int) *comm
 	return nil
 }
 
-func (s *ipBroadcastService) GetList(tenantId string, ) ([]dao.IpBroadcast, *common.Errors) {
+func (s *ipBroadcastService) GetList(tenantId string) ([]dao.IpBroadcast, *common.Errors) {
 	device := &dao.IpBroadcast{
 		TenantId:  tenantId,
 		IsDeleted: 0,
@@ -139,7 +167,7 @@ func (s *ipBroadcastService) GetByLampPole(id int) []dao.IpBroadcast {
 	return device.GetDevicesByLampPole()
 }
 
-func (s *ipBroadcastService) GetAll(tenantId string, ) []dao.IpBroadcast {
+func (s *ipBroadcastService) GetAll(tenantId string) []dao.IpBroadcast {
 	device := &dao.IpBroadcast{
 		TenantId:  tenantId,
 		IsDeleted: 0,

+ 24 - 24
app/multimedia/dao/publishLibrariesDao.go

@@ -8,31 +8,31 @@ import (
 
 type PublishLibraries struct {
 	ID               int64       `gorm:"column:id;type:int(10) unsigned;primary_key;AUTO_INCREMENT;comment:编号" json:"id"`
-	Name             string      `gorm:"column:name;type:varchar(64);comment:名称" json:"name"`                                           // 名称
-	Resolution       int         `gorm:"column:resolution;type:int(11);comment:分辨率" json:"resolution"`                                  // 分辨率
-	Duration         int64       `gorm:"column:duration;type:bigint(20);default:0;comment:统计文件时长" json:"duration"`                      // 统计文件时长
-	FileSize         int64       `gorm:"column:file_size;type:bigint(20);default:0;comment:统计文件大小" json:"fileSize"`                     // 统计文件大小
-	InfoId           string      `gorm:"column:info_id;type:varchar(4000);comment:信息屏ID 组合" json:"infoId"`                              // 信息屏ID 组合
-	ImgDuration      int         `gorm:"column:img_duration;type:int(11);default:0;comment:图片播放时长(毫秒)" json:"imgDuration"`              // 图片播放时长(毫秒)
-	StartTime        common.Time `gorm:"column:start_time;type:date;comment:播放开始时间" json:"startTime"`                                   // 播放开始时间
-	EndTime          common.Time `gorm:"column:end_time;type:date;comment:播放结束时间" json:"endTime"`                                       // 播放结束时间
+	Name             string      `gorm:"column:name;type:varchar(64);comment:名称" json:"name"`                                                       // 名称
+	Resolution       int         `gorm:"column:resolution;type:int(11);comment:分辨率" json:"resolution"`                                             // 分辨率
+	Duration         int64       `gorm:"column:duration;type:bigint(20);default:0;comment:统计文件时长" json:"duration"`                              // 统计文件时长
+	FileSize         int64       `gorm:"column:file_size;type:bigint(20);default:0;comment:统计文件大小" json:"fileSize"`                             // 统计文件大小
+	InfoId           string      `gorm:"column:info_id;type:varchar(4000);comment:信息屏ID 组合" json:"infoId"`                                       // 信息屏ID 组合
+	ImgDuration      int         `gorm:"column:img_duration;type:int(11);default:0;comment:图片播放时长(毫秒)" json:"imgDuration"`                    // 图片播放时长(毫秒)
+	StartTime        common.Time `gorm:"column:start_time;type:date;comment:播放开始时间" json:"startTime"`                                           // 播放开始时间
+	EndTime          common.Time `gorm:"column:end_time;type:date;comment:播放结束时间" json:"endTime"`                                               // 播放结束时间
 	NotificationType string      `gorm:"column:notification_type;type:varchar(60);comment:通知类型 组合1短信2邮件3电话4微信" json:"notificationType"` // 通知类型 组合1短信2邮件3电话4微信
-	CreateTime       time.Time   `gorm:"column:create_time;type:datetime;comment:新增时间" json:"createTime"`                               // 新增时间
-	CreateUser       int64       `gorm:"column:create_user;type:varchar(60);comment:增记录操作用户ID" json:"createUser"`                       // 新增记录操作用户ID
-	CreateName       string      `gorm:"column:create_name;type:varchar(64);comment:新增用户姓名" json:"createName"`                          // 新增用户姓名
-	UpdateTime       time.Time   `gorm:"column:update_time;type:datetime;comment:修改时间" json:"updateTime"`                               // 修改时间
-	UpdateUser       string      `gorm:"column:update_user;type:varchar(60);comment:修改用户" json:"updateUser"`                            // 修改用户
-	IsDeleted        int         `gorm:"column:is_deleted;type:int(11);default:0;comment:是否删除 0=未删除,1=删除" json:"isDeleted"`             // 是否删除 0=未删除,1=删除
-	Status           int         `gorm:"column:status;type:int(11);comment:状态 0审核1播放2暂停3取消4过期5审核不通过" json:"status"`                     // 状态 0审核1播放2暂停3取消4过期5审核不通过
-	TenantId         string      `gorm:"column:tenant_id;type:varchar(12);comment:租户ID" json:"tenantTd"`                                // 租户ID
-	Remarks          string      `gorm:"column:remarks;type:varchar(4000);comment:系统类型:0-多媒体系统,1-广播系统" json:"remarks"`                  // 备注
-	SysType          int         `gorm:"column:sys_type;type:int(11);default:0;comment:编号" json:"sysStype"`                             // 系统类型:0-多媒体系统,1-广播系统
-	KsTime           string      `gorm:"column:ks_time;type:varchar(50);comment:播放开始时间" json:"ksTime"`                                  // 播放开始时间
-	JsTime           string      `gorm:"column:js_time;type:varchar(50);comment:播放结束时间" json:"jsTime"`                                  // 播放结束时间
+	CreateTime       time.Time   `gorm:"column:create_time;type:datetime;comment:新增时间" json:"createTime"`                                         // 新增时间
+	CreateUser       int64       `gorm:"column:create_user;type:varchar(60);comment:增记录操作用户ID" json:"createUser"`                              // 新增记录操作用户ID
+	CreateName       string      `gorm:"column:create_name;type:varchar(64);comment:新增用户姓名" json:"createName"`                                  // 新增用户姓名
+	UpdateTime       time.Time   `gorm:"column:update_time;type:datetime;comment:修改时间" json:"updateTime"`                                         // 修改时间
+	UpdateUser       string      `gorm:"column:update_user;type:varchar(60);comment:修改用户" json:"updateUser"`                                      // 修改用户
+	IsDeleted        int         `gorm:"column:is_deleted;type:int(11);default:0;comment:是否删除 0=未删除,1=删除" json:"isDeleted"`                  // 是否删除 0=未删除,1=删除
+	Status           int         `gorm:"column:status;type:int(11);comment:状态 0审核1播放2暂停3取消4过期5审核不通过" json:"status"`                  // 状态 0审核1播放2暂停3取消4过期5审核不通过
+	TenantId         string      `gorm:"column:tenant_id;type:varchar(12);comment:租户ID" json:"tenantTd"`                                            // 租户ID
+	Remarks          string      `gorm:"column:remarks;type:varchar(4000);comment:系统类型:0-多媒体系统,1-广播系统" json:"remarks"`                   // 备注
+	SysType          int         `gorm:"column:sys_type;type:int(11);default:0;comment:编号" json:"sysStype"`                                         // 系统类型:0-多媒体系统,1-广播系统
+	KsTime           string      `gorm:"column:ks_time;type:varchar(50);comment:播放开始时间" json:"ksTime"`                                          // 播放开始时间
+	JsTime           string      `gorm:"column:js_time;type:varchar(50);comment:播放结束时间" json:"jsTime"`                                          // 播放结束时间
 	FileId           int         `gorm:"column:file_id;type:int(11);comment:文件ID,系统类型为广播系统时使用" json:"fileId"`                           // 文件ID,系统类型为广播系统时使用
-	TaskId           int         `gorm:"column:task_id;type:int(11);comment:任务ID,发布后才有用于控制启动与停止" json:"taskId"`                         // 任务ID,发布后才有用于控制启动与停止
-	PlayTime         int         `gorm:"column:play_time;type:int(11);default:1;comment:播放次数(1-100)" json:"playTime"`                   // 播放次数(1-100)
-	PlayInterval     int         `gorm:"column:play_interval;type:int(11);default:0;comment: 播放间隔(0-360秒)" json:"playInterval"`         // 播放间隔(0-360秒)
+	TaskId           int         `gorm:"column:task_id;type:int(11);comment:任务ID,发布后才有用于控制启动与停止" json:"taskId"`                       // 任务ID,发布后才有用于控制启动与停止
+	PlayTime         int         `gorm:"column:play_time;type:int(11);default:1;comment:播放次数(1-100)" json:"playTime"`                             // 播放次数(1-100)
+	PlayInterval     int         `gorm:"column:play_interval;type:int(11);default:0;comment: 播放间隔(0-360秒)" json:"playInterval"`                  // 播放间隔(0-360秒)
 
 	PlayPeriod     string `gorm:"-"  json:"playPeriod"`              //播放期间
 	ResolutionName string `gorm:"-" json:"resolutionName"`           //分辨率
@@ -70,7 +70,7 @@ func (c *PublishLibraries) GetProgram() (int, error) {
 // GetProgramByLedId 取led信息屏当前播放的节目 ID
 func (c *PublishLibraries) GetProgramByLedId(ledId int) (PublishLibraries, error) {
 	var librarie PublishLibraries
-	err := Db.Debug().Model(&c).Where("info_id IN (?) and is_deleted = 0 and status = 1 and sys_type = 0 and start_time <= CURDATE()", ledId).Order("id desc").First(&librarie).Error
+	err := Db.Debug().Model(&c).Where("info_id IN (?) and is_deleted = 0 and status = 1 and sys_type = 0 and start_time <= CURDATE()  AND a.end_time >= CURDATE()", ledId).Order("id desc").First(&librarie).Error
 	return librarie, err
 }
 

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

@@ -166,6 +166,11 @@ func (s *publishLibrariesService) LedPaying(ledId int, playing string) string {
 		logger.Logger.Errorf("LedPaying err = %v \n", err)
 		return ""
 	}
+	if librarie.ID < 1 {
+		//没有新节目不更新
+		return ""
+	}
+
 	//fmt.Printf("librarie = %v \n", librarie)
 	program, _ := s.GetProgram(int(librarie.ID))
 	relation := &dao.ProgramRelation{
@@ -207,7 +212,6 @@ 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"
-
 	marshal, err := json.Marshal(cltLedLibraries)
 	if err != nil {
 		fmt.Printf("LedPaying err = %v \n", err)

+ 5 - 1
app/record/controller/aKeyAlarmRecordController.go

@@ -58,11 +58,15 @@ func (c *aKeyAlarmRecordCtl) List(ctx *gin.Context) {
 
 // refresh 同步sos记录
 func (c *aKeyAlarmRecordCtl) Refresh(ctx *gin.Context) {
+	c.SosRecordSync()
+	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, nil))
+}
+
+func (c *aKeyAlarmRecordCtl) SosRecordSync() {
 	recordService := service.AKeyAlarmRecordService
 	go func() {
 		recordService.Refresh()
 	}()
-	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, nil))
 }
 
 // Detail 查看详情

+ 10 - 0
app/warn/service/platformAlarmService.go

@@ -1,6 +1,7 @@
 package service
 
 import (
+	system "iot_manager_service/app/system/dao"
 	"iot_manager_service/app/warn/dao"
 	edgeService "iot_manager_service/app/warn/edge_service"
 	"iot_manager_service/app/warn/model"
@@ -44,6 +45,15 @@ func (s platformAlarmService) GetList(tenantId string, filter model.RequestPlatF
 	return list, i, err
 }
 
+func (s platformAlarmService) SyncAlarm() {
+	//抓取数据
+	tenant := system.Tenant{}
+	tenants, _, _ := tenant.GetTenants(0, 1000)
+	for _, t := range tenants {
+		s.Refresh(t.TenantId)
+	}
+}
+
 // Refresh 同步边缘接口报警数据
 func (s platformAlarmService) Refresh(tenantId string) error {
 	viewDao := dao.ViewsAllCode{TenantId: tenantId}

+ 1 - 0
config/config.go

@@ -80,6 +80,7 @@ type minio struct {
 
 type foreign struct {
 	IotEdgeUrl        string `yaml:"iot_edge_url"`
+	IpCastEdgeUrl     string `yaml:"ip_cast_edge_url"`
 	SecurityRewindUrl string `yaml:"security_rewind_url"`
 }
 

+ 1 - 0
config/config.yaml

@@ -41,6 +41,7 @@ minio:
 foreign:
   iot_edge_url: "http://192.168.110.248:8195"
   security_rewind_url: "http://local.centos.jd.com:8196"
+  ip_cast_edge_url: "http://1.117.161.196:10063"
 
 #告警通知相关
 monit-notice: