device

package
v0.0.0-...-6321720 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindLocation

func BindLocation(clt *mp.Client, deviceIdentifier *DeviceIdentifier, poiId int64) (err error)

配置设备与门店的关联关系

func BindPage

func BindPage(clt *mp.Client, para *BindPageParameters) (err error)

func Update

func Update(clt *mp.Client, deviceIdentifier *DeviceIdentifier, comment string) (err error)

编辑设备信息

Types

type ApplyIdParameters

type ApplyIdParameters struct {
	Quantity    int    `json:"quantity"`          // 必须, 申请的设备ID的数量,单次新增设备超过500个,需走人工审核流程
	ApplyReason string `json:"apply_reason"`      // 必须, 申请理由,不超过100个字
	Comment     string `json:"comment,omitempty"` // 可选, 备注,不超过15个汉字或30个英文字母
	PoiId       *int64 `json:"poi_id,omitempty"`  // 可选, 设备关联的门店ID,关联门店后,在门店1KM的范围内有优先摇出信息的机会。
}

type ApplyIdResult

type ApplyIdResult struct {
	ApplyId      int64  `json:"apply_id"`      // 申请的批次ID,可用在“查询设备列表”接口按批次查询本次申请成功的设备ID。
	AuditStatus  int    `json:"audit_status"`  // 审核状态。0:审核未通过、1:审核中、2:审核已通过;若单次申请的设备ID数量小于等于500个,系统会进行快速审核;若单次申请的设备ID数量大于500个,会在三个工作日内完成审核
	AuditComment string `json:"audit_comment"` // 审核备注,包括审核不通过的原因
}

func ApplyId

func ApplyId(clt *mp.Client, para *ApplyIdParameters) (rslt *ApplyIdResult, err error)

申请设备ID

type ApplyStatus

type ApplyStatus struct {
	ApplyTime    int64  `json:"apply_time"`    // 提交申请的时间戳
	AuditStatus  int    `json:"audit_status"`  // 审核状态。0:审核未通过、1:审核中、2:审核已通过;审核会在三个工作日内完成
	AuditComment string `json:"audit_comment"` // 审核备注,包括审核不通过的原因
	AuditTime    int64  `json:"audit_time"`    // 确定审核结果的时间戳,若状态为审核中,则该时间值为0
}

func GetApplyStatus

func GetApplyStatus(clt *mp.Client, applyId int64) (status *ApplyStatus, err error)

查询设备ID申请审核状态

type BindPageParameters

type BindPageParameters struct {
	DeviceIdentifier *DeviceIdentifier `json:"device_identifier,omitempty"` // 必须, 设备标识
	PageIds          []int64           `json:"page_ids,omitempty"`          // 必须, 待关联的页面列表
	Bind             int               `json:"bind"`                        // 必须, 关联操作标志位, 0为解除关联关系,1为建立关联关系
	Append           int               `json:"append"`                      // 必须, 新增操作标志位, 0为覆盖,1为新增
}

type Device

type Device struct {
	DeviceBase
	Comment string `json:"comment"`  // 设备的备注信息
	PageIds string `json:"page_ids"` // 与此设备关联的页面ID列表,用逗号隔开
	Status  int    `json:"status"`   // 激活状态,0:未激活,1:已激活(但不活跃),2:活跃
	PoiId   int64  `json:"poi_id"`   // 设备关联的门店ID,关联门店后,在门店1KM的范围内有优先摇出信息的机会。门店相关信息具体可查看门店相关的接口文档
}

type DeviceBase

type DeviceBase struct {
	DeviceId int64  `json:"device_id"`
	UUID     string `json:"uuid"`
	Major    int    `json:"major"`
	Minor    int    `json:"minor"`
}

type DeviceIdentifier

type DeviceIdentifier struct {
	// 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先
	DeviceId *int64 `json:"device_id,omitempty"`

	// UUID、major、minor,三个信息需填写完整,若填了设备编号,则可不填此信息。
	UUID  string `json:"uuid,omitempty"`
	Major *int   `json:"major,omitempty"`
	Minor *int   `json:"minor,omitempty"`
}

设备标识

func NewDeviceIdentifier1

func NewDeviceIdentifier1(deviceId int64) *DeviceIdentifier

func NewDeviceIdentifier2

func NewDeviceIdentifier2(uuid string, major, minor int) *DeviceIdentifier

func NewDeviceIdentifier3

func NewDeviceIdentifier3(deviceId int64, uuid string, major, minor int) *DeviceIdentifier

type DeviceIterator

type DeviceIterator struct {
	// contains filtered or unexported fields
}

DeviceIterator

iter, err := NewDeviceIterator(*mp.Client, *SearchQuery)
if err != nil {
    // TODO: 增加你的代码
}

for iter.HasNext() {
    items, err := iter.NextPage()
    if err != nil {
        // TODO: 增加你的代码
    }
    // TODO: 增加你的代码
}

func NewDeviceIterator

func NewDeviceIterator(clt *mp.Client, query *SearchQuery) (iter *DeviceIterator, err error)

func (*DeviceIterator) HasNext

func (iter *DeviceIterator) HasNext() bool

func (*DeviceIterator) NextPage

func (iter *DeviceIterator) NextPage() (devices []Device, err error)

func (*DeviceIterator) TotalCount

func (iter *DeviceIterator) TotalCount() int

type SearchQuery

type SearchQuery struct {
	Type              int                 `json:"type"`                         // 查询类型。1:查询设备id列表中的设备;2:分页查询所有设备信息;3:分页查询某次申请的所有设备信息
	DeviceIdentifiers []*DeviceIdentifier `json:"device_identifiers,omitempty"` // 指定的设备 ; 当type为1时,此项为必填
	ApplyId           *int64              `json:"apply_id,omitempty"`           // 批次ID,申请设备ID时所返回的批次ID;当type为3时,此项为必填
	Begin             *int                `json:"begin,omitempty"`              // 设备列表的起始索引值
	Count             *int                `json:"count,omitempty"`              // 待查询的设备数量,不能超过50个
}

func NewSearchQuery1

func NewSearchQuery1(deviceIdentifiers []*DeviceIdentifier) *SearchQuery

func NewSearchQuery2

func NewSearchQuery2(begin, count int) *SearchQuery

func NewSearchQuery3

func NewSearchQuery3(applyId int64, begin, count int) *SearchQuery

type SearchResult

type SearchResult struct {
	TotalCount int      `json:"total_count"` // 商户名下的设备总量
	ItemCount  int      `json:"item_count"`  // 查询的设备数量
	Devices    []Device `json:"devices"`     // 查询的设备信息列表
}
func Search(clt *mp.Client, query *SearchQuery) (rslt *SearchResult, err error)

查询设备列表.

Jump to

Keyboard shortcuts

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