logic

package
v0.0.0-...-592b0ac Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hmacsha256 = "hmacsha256"
	Hmacsha1   = "hmacsha1"
)

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 *model.DeviceInfo, data *dm.DeviceInfo)

func DBToRPCFmt

func DBToRPCFmt(db interface{}) interface{}

func GetFileName

func GetFileName(in *dm.GetDeviceLogReq) bson.D

func GetNullTime

func GetNullTime(time sql.NullTime) int64

func UpdateProduct

func UpdateProduct(old *model.ProductInfo, data *dm.ProductInfo)

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)

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 GetDeviceLogLogic

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

func NewGetDeviceLogLogic

func NewGetDeviceLogLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeviceLogLogic

func (*GetDeviceLogLogic) GetDeviceLog

func (l *GetDeviceLogLogic) GetDeviceLog(in *dm.GetDeviceLogReq) (*dm.GetDeviceLogResp, error)

func (*GetDeviceLogLogic) HandleData

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 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 (l *ManageProductLogic) InsertProduct(in *dm.ManageProductReq) *model.ProductInfo

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

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 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 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