代码拉取完成,页面将自动刷新
package deviceMsgEvent
import (
"context"
"gitee.com/unitedrhino/share/domain/deviceMsg"
"gitee.com/unitedrhino/share/utils"
remoteconfiglogic "gitee.com/unitedrhino/things/service/dmsvr/internal/logic/remoteconfig"
"gitee.com/unitedrhino/things/service/dmsvr/internal/svc"
"gitee.com/unitedrhino/things/service/dmsvr/pb/dm"
"github.com/zeromicro/go-zero/core/logx"
)
type ConfigLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ConfigLogic {
return &ConfigLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *ConfigLogic) Handle(msg *deviceMsg.PublishMsg) (respMsg *deviceMsg.PublishMsg, err error) {
l.Infof("%s req=%+v", utils.FuncName(), msg)
//获取最新配置
resp1, err := remoteconfiglogic.NewRemoteConfigLastReadLogic(l.ctx, l.svcCtx).RemoteConfigLastRead(&dm.RemoteConfigLastReadReq{
ProductID: msg.ProductID,
})
resp := &deviceMsg.CommonMsg{
Method: deviceMsg.RemoteConfigReply,
//Timestamp: time.Now().UnixMilli(),
Data: resp1.Info.Content,
}
return &deviceMsg.PublishMsg{
Handle: msg.Handle,
Type: msg.Type,
Payload: resp.Bytes(),
ProductID: msg.ProductID,
DeviceName: msg.DeviceName,
ProtocolCode: msg.ProtocolCode,
}, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。