Documentation ¶
Index ¶
- func InitDb(config interface{}) (err error)
- func InitDbByConfig(config interface{}) (err error)
- type Api
- func (api *Api) ExistStadiumQrcode(uniqueId string) (bool, error)
- func (api *Api) GetStadiumQrcode(uniqueId string) (*StadiumQrcode, error)
- func (api *Api) InitDb() (err error)
- func (api *Api) LogStadiumQrcode(uniqueId string, response map[string]interface{}, err error) error
- func (api *Api) NewModel() (m *Model)
- func (api *Api) SaveStadiumQrcode(qrcode *StadiumQrcode) error
- func (api *Api) SetStadiumQrcodeFlag(uniqueId string, flag int) error
- func (api *Api) UpdateStadiumQrcode(uniqueId string, status int, response map[string]interface{}, errlog string) (int64, error)
- type Model
- func (m *Model) ExistStadiumQrcode(uniqueId string) (bool, error)
- func (m *Model) Get(uniqueId string) (*StadiumQrcode, error)
- func (m *Model) Save(qr *StadiumQrcode) error
- func (m *Model) SetFlag(uniqueId string, flag int) error
- func (m *Model) UpdateStadiumQrcode(uniqueId string, status int, response map[string]interface{}, errlog string) (int64, error)
- type QrCodeEvent
- type QrCodeEventType
- type StadiumQrcode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitDbByConfig ¶
func InitDbByConfig(config interface{}) (err error)
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
func (*Api) GetStadiumQrcode ¶
func (api *Api) GetStadiumQrcode(uniqueId string) (*StadiumQrcode, error)
func (*Api) LogStadiumQrcode ¶
func (*Api) SaveStadiumQrcode ¶
func (api *Api) SaveStadiumQrcode(qrcode *StadiumQrcode) error
func (*Api) SetStadiumQrcodeFlag ¶
type Model ¶
type Model struct { Db *xorm.Engine `json:"-" xorm:"-"` Id int `json:"id" xorm:"not null pk autoincr INT(11)"` DeletedAt hsktime.Time `json:"-" xorm:"deleted comment('是否删除') TIMESTAMP"` CreatedAt hsktime.Time `json:"created_at" xorm:"created comment('创建时间') TIMESTAMP"` UpdatedAt hsktime.Time `json:"updated_at" xorm:"updated comment('更新时间') TIMESTAMP"` }
func (*Model) ExistStadiumQrcode ¶
func (*Model) Save ¶
func (m *Model) Save(qr *StadiumQrcode) error
type QrCodeEvent ¶
type QrCodeEvent struct { BrandId int `json:"brand_id"` UniqueId string `json:"unique_id"` //唯一标识符 EventType QrCodeEventType `json:"event_type"` // 时间类型 ExpiredAt int64 `json:"expired_at"` // 有效时间 Data map[string]interface{} `json:"data"` // 时间数据 LastUpdatedAt time.Time `json:"updated_at"` // 上一次更新时间 }
func GenQrcode ¶
func GenQrcode(brandId int, eventType QrCodeEventType, expiredAt int64, data map[string]interface{}) (*QrCodeEvent, string, error)
TODO: 把unique_id 作为二维码body
func ParseQrcode ¶
func ParseQrcode(body string) (*QrCodeEvent, error)
type QrCodeEventType ¶
type QrCodeEventType string
var ( //PersonTimingEnterQrCodeEventType QrCodeEventType = "pt_enter" // 人时 //PersonTimingLeaveQrCodeEventType QrCodeEventType = "pt_leave" // 人时 PersonTimingQrCodeEventType QrCodeEventType = "pt_qrcode" // 人时 VenueTimingQrCodeEventType QrCodeEventType = "vt_qrcode" // 场时 VenueNumberQrCodeEventType QrCodeEventType = "vn_qrcode" // 场次 PersonNumberQrCodeEventType QrCodeEventType = "pn_qrcode" // 人次 CourseVerifyQrcodeEventType QrCodeEventType = "kc_qrcode" // 课程核销二维码 CourseExpVerifyQrcodeEventType QrCodeEventType = "ce_qrcode" // 预约体验课核销 )
type StadiumQrcode ¶
type StadiumQrcode struct { Model `xorm:"extends"` UniqueId string `json:"unique_id" xorm:"not null default '' comment('唯一值') VARCHAR(255) INDEX"` Status int `json:"status" xorm:"not null default 0 comment('状态') TINYINT(1)"` // 0 尚未扫过 1 一扫过 2失效 3 报错 EventType QrCodeEventType `json:"event_type" xorm:"not null default '' comment('二维码事件') VARCHAR(128)"` Flag int `json:"flag" xorm:"not null default 0 comment('处理flag[0/1 未/已]') TINYINT(1)"` // 0 已处理 1 为处理 ExpiredAt int64 `json:"expired_at" xorm:"not null default 0 comment('二维码时效') INT(11)"` Errlog string `json:"errlog" xorm:"not null default '' comment('错误日志') VARCHAR(500)"` Request map[string]interface{} `json:"request" xorm:"json comment('请求数据')"` Response map[string]interface{} `json:"response" xorm:"json comment('响应数据')"` }
func (*StadiumQrcode) GetQrcodeEvent ¶
func (q *StadiumQrcode) GetQrcodeEvent() *QrCodeEvent
Click to show internal directories.
Click to hide internal directories.