183 lines
7.4 KiB
Go
183 lines
7.4 KiB
Go
package model
|
||
|
||
import (
|
||
"time"
|
||
)
|
||
|
||
const (
|
||
SessionKey = "jxCode"
|
||
RegisterKey = "jxRegister"
|
||
|
||
PrinterStatusNormal = 1 //打印机状态正常
|
||
PrinterStatusWithouPaper = 2 //缺纸
|
||
PrinterStatusOverFlow = -2 //缺流量
|
||
|
||
PrinterOnline = 1 //在线
|
||
PrinterOffline = 0 //离线
|
||
|
||
StatusAll = -9
|
||
|
||
FlowIncomeTypeJX = 1 //表示每月自动划转
|
||
FlowIncomeTypeUser = 2 //表示是用户自己冲的
|
||
)
|
||
|
||
const (
|
||
ErrCodeSuccess = "0"
|
||
ErrCodeNormal = "-1"
|
||
|
||
ErrCodeToken = "-1000"
|
||
)
|
||
|
||
const (
|
||
FieldDeletedAt = "deleted_at"
|
||
FieldCreatedAt = "created_at"
|
||
FieldUpdatedAt = "updated_at"
|
||
FieldLastOperator = "last_operator"
|
||
FieldID = "id"
|
||
)
|
||
|
||
var (
|
||
FieldNormalMap = map[string]string{
|
||
FieldDeletedAt: "删除时间",
|
||
FieldCreatedAt: "创建时间",
|
||
FieldUpdatedAt: "更新时间",
|
||
FieldLastOperator: "上次操作人",
|
||
FieldID: "ID",
|
||
}
|
||
)
|
||
|
||
type TokenInfo struct {
|
||
User *User
|
||
Token string `json:"token"`
|
||
}
|
||
|
||
type PrintInfo struct {
|
||
PrintNo string `json:"print_no" form:"print_no" binding:"required"` //打印机编号
|
||
Name string `json:"name" form:"name"` //打印机备注
|
||
//SIM string `json:"sim" form:"sim"` //流量卡号码
|
||
}
|
||
|
||
type PagedInfo struct {
|
||
TotalCount int `json:"totalCount"`
|
||
Data interface{} `json:"data"`
|
||
}
|
||
|
||
type ModelIDCULD struct {
|
||
ID int `json:"id" db:"id"`
|
||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||
LastOperator string `json:"last_operator" db:"last_operator"`
|
||
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
|
||
}
|
||
|
||
type User struct {
|
||
ID int `json:"id" db:"id"`
|
||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||
LastOperator string `json:"last_operator" db:"last_operator"`
|
||
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
|
||
UserID string `json:"user_id" db:"user_id"` // 内部唯一标识
|
||
Password string `json:"password"` //密码
|
||
Name string `json:"name"` // 外部显示标识(当前可以重复)
|
||
Mobile string `json:"mobile"`
|
||
Email string `json:"email"`
|
||
Avatar string `json:"avatar"` // 头像
|
||
Status int8 `json:"status"`
|
||
Type int8 `json:"type"` // 用户类型
|
||
Company string `json:"company"` //公司名称
|
||
CityCode int `json:"city_code" db:"city_code"`
|
||
DistrictCode int `json:"district_code" db:"district_code"`
|
||
Address string `json:"address"`
|
||
|
||
IDCardNo string `json:"id_card_no" db:"id_card_no"` // 身份证号
|
||
Remark string `json:"remark"`
|
||
|
||
LastLoginAt *time.Time `json:"last_login_at" db:"last_login_at"`
|
||
LastLoginIP string `json:"last_login_ip" db:"last_login_ip"`
|
||
LastLoginType string `json:"last_login_type" db:"last_login_type"`
|
||
}
|
||
|
||
type Apps struct {
|
||
ID int `json:"id" db:"id"`
|
||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||
LastOperator string `json:"last_operator" db:"last_operator"`
|
||
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
|
||
UserID string `json:"user_id" db:"user_id"` //属于哪个账号的
|
||
Name string `json:"name"` //应用名称
|
||
Type int `json:"type"` //应用类型
|
||
AppKey string `json:"app_key" db:"app_key"` //Key
|
||
Status int `json:"status"` //状态
|
||
Mobile string `json:"mobile"` //手机号
|
||
}
|
||
|
||
type Menu struct {
|
||
ID int `json:"id" db:"id"`
|
||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||
LastOperator string `json:"last_operator" db:"last_operator"`
|
||
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
|
||
Name string `json:"name"` //功能名
|
||
URL string `json:"url" db:"url"` //路径
|
||
ImgURL string `json:"img_url" db:"img_url"` //图标
|
||
Level int `json:"level"` //级别
|
||
ParentID int `json:"parent_id" db:"parent_id"` //父功能ID
|
||
Color string `json:"color"` //颜色
|
||
Content string `json:"content"` //菜单内容
|
||
}
|
||
|
||
type Printer struct {
|
||
ID int `json:"id" db:"id"`
|
||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||
LastOperator string `json:"last_operator" db:"last_operator"`
|
||
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
|
||
AppID int `json:"app_id" db:"app_id"` //应用编号
|
||
PrintNo string `json:"print_no" db:"print_no"` //打印机编号
|
||
PrintKey string `json:"print_key" db:"print_key"` //打印机识别码
|
||
Name string `json:"name"` //打印机备注名
|
||
Status int `json:"status"` //打印机状态
|
||
IsOnline int `json:"is_online" db:"is_online"` //1在线,0离线
|
||
IccID string `json:"icc_id" db:"icc_id"` //sim卡号
|
||
Sound string `json:"sound"` //声音类型 sounda ,b,c,d,e,f,g
|
||
Volume int `json:"volume"` //音量,1-5 ,对应打印机2-10
|
||
FlowFlag int `json:"flow_flag" db:"flow_flag"` //是否超流量了,1表示超了
|
||
}
|
||
|
||
type PrintMsg struct {
|
||
ID int `json:"id" db:"id"`
|
||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||
LastOperator string `json:"last_operator" db:"last_operator"`
|
||
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
|
||
MsgID string `json:"msg_id" db:"msg_id"` //消息ID
|
||
PrintNo string `json:"print_no" db:"print_no"` //打印机编号
|
||
OrderNo int `json:"order_no" db:"order_no"` //订单序号
|
||
Content string `json:"content"` //订单内容
|
||
Status int `json:"status"` //打印状态
|
||
Comment string `json:"comment"` //失败原因
|
||
}
|
||
|
||
//流量支出
|
||
type SimFlowExpend struct {
|
||
ID int `json:"id" db:"id"`
|
||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||
LastOperator string `json:"last_operator" db:"last_operator"`
|
||
IccID string `json:"icc_id" db:"icc_id"` //sim卡iccid
|
||
Flow float64 `json:"flow"` //流量数
|
||
FlowUnit string `json:"flow_unit" db:"flow_unit"` //流量单位
|
||
}
|
||
|
||
//流量划入
|
||
type SimFlowIncome struct {
|
||
ID int `json:"id" db:"id"`
|
||
CreatedAt *time.Time `json:"created_at" db:"created_at"`
|
||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
|
||
LastOperator string `json:"last_operator" db:"last_operator"`
|
||
IccID string `json:"icc_id" db:"icc_id"` //sim卡iccid
|
||
Flow float64 `json:"flow"` //流量数
|
||
FlowUnit string `json:"flow_unit" db:"flow_unit"` //流量单位
|
||
IncomeType int `json:"income_type" db:"income_type"` //1 表示系统每月自动划转,2 表示商户自己冲的
|
||
}
|