logic

package
v0.0.0-...-5932f04 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hmacsha256 = "hmacsha256"
	Hmacsha1   = "hmacsha1"
)
View Source
const (
	//Connect mqtt connect
	Connect = "connect"
	//Publish mqtt publish
	Publish = "publish"
	//Subscribe mqtt sub
	Subscribe = "subscribe"
	//Unsubscribe mqtt sub
	Unsubscribe = "unsubscribe"
	//Disconnect mqtt disconenct
	Disconnect = "disconnect"
)

Variables

View Source
var TopicPub map[string][]string = map[string][]string{
	"$thing": []string{"$thing/up/property/%s/%s",
		"$thing/up/event/%s/%s",
		"$thing/up/action/%s/%s",
	},
	"$ota": []string{
		"$ota/report/%s/%s",
	},
}
View Source
var TopicSub map[string][]string = map[string][]string{
	"$thing": []string{
		"$thing/down/property/%s/%s",
		"$thing/down/event/%s/%s",
		"$thing/down/action/%s/%s",
	},
	"$ota": []string{
		"$ota/update/%s/%s",
		"$broadcast/rxd/%s/%s",
	},
	"$broadcast": []string{
		"$broadcast/rxd/%s/%s",
	},
}

物理型topic: $thing/up/property/${productID}/${deviceName} 发布 属性上报 $thing/down/property/${productID}/${deviceName} 订阅 属性下发与属性上报响应 $thing/up/event/${productID}/${deviceName} 发布 事件上报 $thing/down/event/${productID}/${deviceName} 订阅 事件上报响应 $thing/up/action/${productID}/${deviceName} 发布 设备响应行为执行结果 $thing/down/action/${productID}/${deviceName} 订阅 应用调用设备行为 系统级topic: $ota/report/${productID}/${deviceName} 发布 固件升级消息上行 $ota/update/${productID}/${deviceName} 订阅 固件升级消息下行 $broadcast/rxd/${productID}/${deviceName} 订阅 广播消息下行 自定义topic: ${productID}/${deviceName}/control 订阅 编辑删除 ${productID}/${deviceName}/data 订阅和发布 编辑删除 ${productID}/${deviceName}/event 发布 ${productID}/${deviceName}/xxxxx 订阅和发布 //自定义 暂不做支持

key 为topic的第一个 value 为该key下的正则表达式

Functions

func ChangeDevice

func ChangeDevice(old *mysql.DeviceInfo, data *dm.DeviceInfo)

func GetNullTime

func GetNullTime(time sql.NullTime) int64

func ToDeviceDescribeLog

func ToDeviceDescribeLog(log *mysql.DeviceLog) *dm.DeviceDescribeLog

func ToDeviceInfo

func ToDeviceInfo(di *mysql.DeviceInfo) *dm.DeviceInfo

func ToProductInfo

func ToProductInfo(pi *mysql.ProductInfo) *dm.ProductInfo

func ToProductTemplate

func ToProductTemplate(pt *mysql.ProductTemplate) *dm.ProductTemplate

func UpdateProductInfo

func UpdateProductInfo(old *mysql.ProductInfo, data *dm.ProductInfo)

func UpdateProductTemplate

func UpdateProductTemplate(old *mysql.ProductTemplate, data *dm.ProductTemplate) (isModify bool)

Types

type AccessAuthLogic

type AccessAuthLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewAccessAuthLogic

func NewAccessAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AccessAuthLogic

func (*AccessAuthLogic) AccessAuth

func (l *AccessAuthLogic) AccessAuth(in *dm.AccessAuthReq) (*dm.Response, error)

func (*AccessAuthLogic) CompareTopic

func (l *AccessAuthLogic) CompareTopic(in *dm.AccessAuthReq) error

type GetDeviceDataLogic

type GetDeviceDataLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetDeviceDataLogic

func NewGetDeviceDataLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeviceDataLogic

func (*GetDeviceDataLogic) GetDeviceData

func (l *GetDeviceDataLogic) GetDeviceData(in *dm.GetDeviceDataReq) (*dm.GetDeviceDataResp, error)

func (*GetDeviceDataLogic) HandleData

func (*GetDeviceDataLogic) HandleDatas

type GetDeviceDescribeLogLogic

type GetDeviceDescribeLogLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetDeviceDescribeLogLogic

func NewGetDeviceDescribeLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeviceDescribeLogLogic

func (*GetDeviceDescribeLogLogic) GetDeviceDescribeLog

获取设备调试信息记录登入登出,操作

type GetDeviceInfoLogic

type GetDeviceInfoLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetDeviceInfoLogic

func NewGetDeviceInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeviceInfoLogic

func (*GetDeviceInfoLogic) GetDeviceInfo

func (l *GetDeviceInfoLogic) GetDeviceInfo(in *dm.GetDeviceInfoReq) (resp *dm.GetDeviceInfoResp, err error)

type GetProductInfoLogic

type GetProductInfoLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetProductInfoLogic

func NewGetProductInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductInfoLogic

func (*GetProductInfoLogic) GetProductInfo

func (l *GetProductInfoLogic) GetProductInfo(in *dm.GetProductInfoReq) (resp *dm.GetProductInfoResp, err error)

type GetProductTemplateLogic

type GetProductTemplateLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetProductTemplateLogic

func NewGetProductTemplateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductTemplateLogic

func (*GetProductTemplateLogic) GetProductTemplate

获取产品信息

type LoginAuthLogic

type LoginAuthLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewLoginAuthLogic

func NewLoginAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginAuthLogic

func (*LoginAuthLogic) CmpPwd

func (l *LoginAuthLogic) CmpPwd(in *dm.LoginAuthReq) error

func (*LoginAuthLogic) GetPwdInfo

func (l *LoginAuthLogic) GetPwdInfo(password string) (*PwdInfo, error)

func (*LoginAuthLogic) LoginAuth

func (l *LoginAuthLogic) LoginAuth(in *dm.LoginAuthReq) (*dm.Response, error)

func (*LoginAuthLogic) UpdateLoginTime

func (l *LoginAuthLogic) UpdateLoginTime()

type ManageDeviceLogic

type ManageDeviceLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewManageDeviceLogic

func NewManageDeviceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ManageDeviceLogic

func (*ManageDeviceLogic) AddDevice

func (l *ManageDeviceLogic) AddDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)

func (*ManageDeviceLogic) CheckDevice

func (l *ManageDeviceLogic) CheckDevice(in *dm.ManageDeviceReq) (bool, error)

发现返回true 没有返回false

func (*ManageDeviceLogic) CheckProduct

func (l *ManageDeviceLogic) CheckProduct(in *dm.ManageDeviceReq) (bool, error)

发现返回true 没有返回false

func (*ManageDeviceLogic) DelDevice

func (l *ManageDeviceLogic) DelDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)

func (*ManageDeviceLogic) ManageDevice

func (l *ManageDeviceLogic) ManageDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)

func (*ManageDeviceLogic) ModifyDevice

func (l *ManageDeviceLogic) ModifyDevice(in *dm.ManageDeviceReq) (*dm.DeviceInfo, error)

type ManageProductLogic

type ManageProductLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewManageProductLogic

func NewManageProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ManageProductLogic

func (*ManageProductLogic) AddProduct

func (l *ManageProductLogic) AddProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)

func (*ManageProductLogic) CheckProduct

func (l *ManageProductLogic) CheckProduct(in *dm.ManageProductReq) (bool, error)

发现返回true 没有返回false

func (*ManageProductLogic) DelProduct

func (l *ManageProductLogic) DelProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)

func (*ManageProductLogic) InsertProduct

根据用户的输入生成对应的数据库数据

func (*ManageProductLogic) ManageProduct

func (l *ManageProductLogic) ManageProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)

func (*ManageProductLogic) ModifyProduct

func (l *ManageProductLogic) ModifyProduct(in *dm.ManageProductReq) (*dm.ProductInfo, error)

type ManageProductTemplateLogic

type ManageProductTemplateLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewManageProductTemplateLogic

func NewManageProductTemplateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ManageProductTemplateLogic

func (*ManageProductTemplateLogic) AddProductTemplate

func (*ManageProductTemplateLogic) InsertProductTemplate

func (*ManageProductTemplateLogic) ManageProductTemplate

产品模板管理

func (*ManageProductTemplateLogic) ModifyProductTemplate

type PwdInfo

type PwdInfo struct {
	HmacHandle func(data string, secret []byte) string
	// contains filtered or unexported fields
}

password 字段格式为: ${token};hmac 签名方法 其中 hmac 签名方法字段填写第三步用到的摘要算法,可选的值有 hmacsha256 和 hmacsha1。

type SendActionLogic

type SendActionLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewSendActionLogic

func NewSendActionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendActionLogic

func (*SendActionLogic) SendAction

func (l *SendActionLogic) SendAction(in *dm.SendActionReq) (*dm.SendActionResp, error)

type SendDeviceMsgLogic

type SendDeviceMsgLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewSendDeviceMsgLogic

func NewSendDeviceMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendDeviceMsgLogic

func (*SendDeviceMsgLogic) SendDeviceMsg

func (l *SendDeviceMsgLogic) SendDeviceMsg(in *dm.SendDeviceMsgReq) (*dm.SendDeviceMsgResp, error)

设备端发送信息

type SendPropertyLogic

type SendPropertyLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewSendPropertyLogic

func NewSendPropertyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendPropertyLogic

func (*SendPropertyLogic) SendProperty

func (l *SendPropertyLogic) SendProperty(in *dm.SendPropertyReq) (*dm.SendPropertyResp, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL