models

package
v0.0.0-...-21025f6 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConsumeTableName = "consume"
View Source
var CosCopTabelName = "cus_cop"
View Source
var CustomerTableName = "customer"

Functions

This section is empty.

Types

type Consume

type Consume struct {
	ID        string    `gorm:"column:id;primary_key"`
	CuscopID  string    `gorm:"column:cuscopid"`
	CustPhone string    `gorm:"column:cust_phone"`
	MchPhone  string    `gorm:"column:mch_phone"`
	Amount    int       `gorm:"default:0"`
	SuccessAt time.Time `gorm:"column:success_at"`
}

type ConsumeModel

type ConsumeModel struct {
	CopID    string `json:"code" binding:"required"`
	MchPhone string `json:"mchid" binding:"required"`
}

func (ConsumeModel) Consume

func (con ConsumeModel) Consume(amount int, custPhone string) error

func (ConsumeModel) DailySum

func (con ConsumeModel) DailySum(date time.Time) (dailySumModel DailySumModel, err error)

func (ConsumeModel) List

func (con ConsumeModel) List(start, end time.Time) (cons []Consume, err error)

type CosCop

type CosCop struct {
	CopID  string `gorm:"column:copid"`
	Phone  string
	Status int
	ID     int `gorm:"column:id"`
}

type Coupon

type Coupon struct {
	ID        string
	Title     string
	Code      string
	Amount    int
	StartTime time.Time `gorm:"column:start_time"`
	ExpTime   time.Time `gorm:"column:exp_time"`
	Content   string
	Remarks   string
}

type CouponItem

type CouponItem struct {
	Code            string `json:"code" gorm:"column:code"`
	Denominations   int    `json:"denominations" gorm:"column:amount"`
	OriginCondition int    `json:"originCondition" gorm:"-"`
	Value           int    `json:"value" gorm:"column:amount"`
	Name            string `json:"name" gorm:"column:title"`
	StartAt         Time   `json:"startAt" gorm:"column:start_time"`
	EndAt           Time   `json:"endAt" gorm:"column:exp_time"`
}

type CouponModel

type CouponModel struct {
	ID string
}

func (CouponModel) Get

func (c CouponModel) Get(id string) (coupon Coupon, err error)

func (CouponModel) GetByCusCopID

func (c CouponModel) GetByCusCopID(id string) (coupon Coupon, err error)

type CusCopModel

type CusCopModel struct {
	CopID string `json:"cop_id" binding:"required"`
	Phone string `json:"phone" binding:"required"`
}

func (CusCopModel) Get

func (c CusCopModel) Get(id string) (cc CosCop, err error)

func (CusCopModel) GetByIDAndPhone

func (c CusCopModel) GetByIDAndPhone(status int) (cc CosCop, err error)

func (CusCopModel) GetList

func (c CusCopModel) GetList() (ccs []CouponItem, err error)

func (CusCopModel) HasCouponCode

func (c CusCopModel) HasCouponCode(code int) bool

func (CusCopModel) Insert

func (c CusCopModel) Insert(id int) error

func (CusCopModel) IsNotUseID

func (c CusCopModel) IsNotUseID(id int) bool

type Customer

type Customer struct {
	Phone string `gorm:"primary_key"`
	Name  string
	Type  int
}

type CustomerModel

type CustomerModel struct {
	Phone string `binding:"required"`
	Code  string `binding:"required"`
}

func (CustomerModel) GetCustomer

func (c CustomerModel) GetCustomer(phone string) (customer Customer, err error)

func (CustomerModel) One

func (c CustomerModel) One(phone string) (customer Customer, err error)

type DailySumModel

type DailySumModel struct {
	Date string `json:"date"`
	Sum  int    `json:"sum"`
}

type Time

type Time time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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