Files
jx-print/model/model.go
suyl ec971561bb aa
2021-09-02 16:35:48 +08:00

259 lines
11 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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"
)
const (
OrderTypeFlow = "flow" //充流量
OrderTypeCardValid = "cardValid" //卡有效期
OrderOriginWxMini = "weixinmini"
OrderOriginOpenAPI = "openAPI"
OrderStatusWaitPay = 0 //待支付
OrderStatusPaid = 1 //已支付
OrderStatusPayFail = 2
OrderStatusPayCancel = 3
OrderStatusRefund = 4
PayTypeTL = "tl" //通联支付
)
const (
ConfigTypeSys = "Sys"
)
var (
FieldNormalMap = map[string]string{
FieldDeletedAt: "删除时间",
FieldCreatedAt: "创建时间",
FieldUpdatedAt: "更新时间",
FieldLastOperator: "上次操作人",
FieldID: "ID",
}
)
type TokenInfo struct {
User *User
Token string `json:"token"`
}
type FlowConfig struct {
ID int `json:"id"`
Price int64 `json:"price"`
Flow float64 `json:"flow"`
Unit string `json:"unit"`
}
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 MenuDetail 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"`
MenuID int `json:"menu_id" db:"menu_id"`
Name string `json:"name"`
Content string `json:"content"`
URL string `json:"url" db:"url"`
Method string `json:"method"`
PublicParam string `json:"public_param" db:"public_param"`
PrivateParam string `json:"private_param" db:"private_param"`
CallParam string `json:"call_param" db:"call_param"`
ReturnParam string `json:"return_param" db:"return_param"`
ReturnEX string `json:"return_ex" db:"return_ex"`
}
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表示超了
OfflineCount int `json:"-" db:"offline_count"` //掉线次数
}
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 表示商户自己冲的
OrderID string `json:"order_id" db:"order_id"` //订单号
}
type PayOrder struct {
ID int `json:"id" db:"id"`
CreatedAt *time.Time `json:"created_at" db:"created_at"`
OrderID string `json:"order_id" db:"order_id"` //订单号
UserID string `json:"user_id" db:"user_id"` //用户ID
OrderType string `json:"order_type" db:"order_type"` //订单类型,流量充值等
Origin string `json:"origin"` //订单来源,小程序,开放后台
Status int `json:"status"` //订单状态,待支付2已支付5支付成功110支付失败115
PayPrice int64 `json:"pay_price" db:"pay_price"` //支付金额
TransactionID string `json:"transaction_id" db:"transaction_id"` // 支付成功后支付方生成的事务ID
PayFinishedAt *time.Time `json:"pay_finished_at" db:"pay_finished_at"`
PrepayID string `json:"prepay_id" db:"prepay_id"` // 下单后支付前支付方生成的事务ID
OriginalData *string `json:"original_data" db:"original_data"`
Comment string `json:"comment"` //备注
ThingID string `json:"thing_id" db:"thing_id"` //订单充值项目ID
TypeID string `json:"type_id" db:"type_id"` //类型ID充流量就是套餐对应的id
}
type NewConfig 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 string `json:"type"`
Key string `json:"key"`
Value string `json:"value"`
}