models

package
v0.0.0-...-01a291f Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CALLBACK_USER_STATUS_FAILED        = "failed"
	CALLBACK_USER_STATUS_SUCCESSFULLY  = "successfully"
	CALLBACK_USER_STATUS_WAIT_CALLBACK = "wait_callback"
	CALLBACK_USER_STATUS_IN_HAND       = "in_hand"
)
View Source
const (
	OPERATOR_CM = "CM"
	OPERATOR_CT = "CT"
	OPERATOR_CU = "CU"

	ORDER_STATUS_WAIT_PAY      = "wait_pay"
	ORDER_STATUS_WAIT_HANDLE   = "wait_handle"
	ORDER_STATUS_RECHARGING    = "recharging"
	ORDER_STATUS_WAIT_CALLBACK = "wait_callback"
	ORDER_STATUS_FAILED        = "failed"
	ORDER_STATUS_SUCCESSFULLY  = "successfully"
	ORDER_STATUS_UNKNOWN_ERROR = "unknown_error"
	ORDER_STATUS_CACHED        = "cached"
)
View Source
const (
	COMMIT_STATUS_WAIT_COMMIT   = "wait_commit"
	COMMIT_STATUS_IN_HAND       = "in_hand"
	COMMIT_STATUS_WAIT_CALLBACK = "wait_callback"
	COMMIT_STATUS_FAILED        = "failed"
	COMMIT_STATUS_SUCCESSFULLY  = "successfully"
	COMMIT_STATUS_UNKNOWN_ERROR = "unknown_error"
)
View Source
const (
	SUPPLIER_STATUS_ACTIVE  = "active"
	SUPPLIER_STATUS_DISABLE = "disable"
	SUPPLIER_STATUS_STAY    = "stay"
)
View Source
const (
	USER_STATUS_ACTIVE     = "active"
	USER_STATUS_WAIT_CHECK = "wait_check"
	USER_STATUS_FORBIDDEN  = "forbidden"
)

Variables

View Source
var (
	DB    *gorm.DB
	DBErr error
)

Functions

This section is empty.

Types

type CallbackUser

type CallbackUser struct {
	Model
	UserId      int    //'回调用户的ID',
	FlowOrderId int    //'flow_order id',
	OrderId     string // '平台订单号',
	UserOrderId string // '分销商订单号',
	Tel         string // '号码',
	NotifyUrl   string // '回调地址',
	PostData    string // '回调数据',
	NotifyNum   uint8  // '已回调次数',
	Status      string // '状态',
	ReplyStatus string // '响应的http状态码',
	ReplyBody   string // '响应内容body',
}

func (CallbackUser) TableName

func (c CallbackUser) TableName() string

type Cellphone

type Cellphone struct {
	Model
	Operator   string // CM CT CU UN
	Province   string // 省名
	City       string //市名
	ProvinceId uint8
	CityId     uint16
}

func GetCellphone

func GetCellphone(cellphone string) (Cellphone, error)

获取号码归属

func (Cellphone) TableName

func (c Cellphone) TableName() string

type City

type City struct {
	Model
	Name       string
	ProvinceId uint8
	Spelling   string
}

func (City) TableName

func (u City) TableName() string

type FlowOrder

type FlowOrder struct {
	Model
	OrderId           string // '平台订单号,给上下游',
	UserOrderId       string // '分销商的订单号',
	SupplierOrderId   string // '上游的订单号',
	SupplierId        string // '使用上游的标识符',
	UserId            uint
	AccountId         uint
	ProductId         uint    // 'products id',
	SaleProductId     uint    // 'sale_products id',
	SupplierProductId int     // 'supplier_product id',
	Tel               string  // '充值的手机号',
	ProductValue      int     // '充值的流量值 M',
	PayPrice          float32 // '用户支付的价格',
	SupplierPrice     float32 // '交易时上游给的价格',
	NotifyUrl         string  // '下游提供的回调URL',
	Status            string  // '订单状态',
	Ip                string  // 提单ip
	SupplierError     string  // '上游错误代码和描述',
	CallbackError     string  // '回调下游错误描述',
	ErrorCode         string  // '平台错误代码',
	ErrorString       string  // '平台错误描述',
	PayType           uint8   // '支付类型0account 1第三方支付',
	PayId             int     //'支付ID sale_account_logs id  pay_order id',
	Operator          string  // '运营商CM CT CU',
	ProvinceId        uint8   // '号码归属省',
	CityId            uint16  // '号码归属市',
	Source            string  //'订单来源',
}

type FlowOrderCommit

type FlowOrderCommit struct {
	Model
	FlowOrderId     int    // 'flow_orders id',
	OrderId         string //'平台订单号',
	SupplierId      string //'供应商标识ID',
	Tel             string //'号码',
	SupplierOrderId string // '上游的订单号',
	Status          string // '供应商状态',
	ErrorCode       string //'供应商错误码',
	ErrorString     string // '供应商错误描述',
}

func (FlowOrderCommit) TableName

func (f FlowOrderCommit) TableName() string

type FlowProduct

type FlowProduct struct {
	Product
	SaleProduct
}

func LoadProduct

func LoadProduct(productId string, userId uint) FlowProduct

type Model

type Model struct {
	ID        uint `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Product

type Product struct {
	Model
	ProductId    string  // '自定义产品ID',
	Main         string  // '厂商FCM FCT TCU Viqiyi',
	Name         string  //
	ProductValue int     // '流量MB话费元其他面值',
	ProductType  string  // '定向包,提速包等直冲,卡密等',
	GuidePrice   float32 // '官方价格',
	ProvinceId   uint8
	CityId       uint16
	UseArea      uint8  // '使用范围0全国1省2市3区 ',
	ValidDate    uint8  // '有效期 流量-1跨月0当月其他值天数 话费0',
	Detail       string // '详细描述',
	SoftDelete
}

type Province

type Province struct {
	Model
	Name     string
	Spelling string
}

func (Province) TableName

func (u Province) TableName() string

type SaleAccount

type SaleAccount struct {
	Model
	UserId  uint
	Balance float32 // '余额',
	Credit  float32 // '可用授信额度',
}

func (SaleAccount) TableName

func (s SaleAccount) TableName() string

type SaleAccountLog

type SaleAccountLog struct {
	Model
	UserId     uint
	AccountId  uint
	OrderId    uint
	Payment    float32 // '交易额',
	Before     float32 // '交易前余额',
	After      float32 // '交易后余额',
	Type       string  // '自助充值 后台充值 流量消费 话费 虚拟卡消费',
	ActionUser uint    //'操作人 0系统自动',
	BankId     uint    //'分销商加款打入的银行账户',
	Img        string  // '上传的截图',
	Remark     string
}

type SaleProduct

type SaleProduct struct {
	Model
	UserId       int
	ProductId    int
	Main         string
	Price        float32
	IsSale       uint8
	FreLimit     string
	Strict       uint8
	SupplierList string
	SmsTemplate  int
	Remark       string
	SoftDelete
}

type SoftDelete

type SoftDelete struct {
	DeletedAt *time.Time
}

type SupplierCallback

type SupplierCallback struct {
	Model
	SupplierId      string
	SupplierOrderId string
	OrderId         string
	ClientIp        string
	Reply           string
	RequestMethod   string
	RequestUri      string
	RequestHeader   string
	RequestParams   string
	SoftDelete
}

func (SupplierCallback) TableName

func (c SupplierCallback) TableName() string

type SupplierConfig

type SupplierConfig struct {
	Model
	Title       string
	Config      string
	SyncApi     uint8
	QueryApi    uint8
	CallbackApi uint8
	BankId      int
	Balance     float32
	Status      string // '供应商状态active disable stay',
	SoftDelete
}

func (SupplierConfig) TableName

func (c SupplierConfig) TableName() string

type SupplierProduct

type SupplierProduct struct {
	Model
	SupplierId        string
	SupplierProductId string
	ProductId         int
	Main              string
	Price             float32
	IsSale            uint8
	FreLimit          string
	Remark            string
	SoftDelete
}

type User

type User struct {
	Model
	UserName    string
	Email       string
	Password    string
	Name        string
	Tel         string
	Status      string
	Remark      string
	Company     string
	ApiToken    string
	ApiId       string
	Secret      string
	AllowIp     sql.NullString
	NotifyUrl   string
	PriceLimit  uint8
	HiddenError uint8
	SoftDelete

	SaleAccount SaleAccount `gorm:"foreignkey:UserId"`
}

func ApiLoadUser

func ApiLoadUser(apiId string, ip string) (User, error)

api_id (uid) find user check status and allow ip

func (User) IsActive

func (u User) IsActive() bool

func (User) IsAllowIP

func (u User) IsAllowIP(ip string) bool

Jump to

Keyboard shortcuts

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