Documentation ¶
Index ¶
- Constants
- Variables
- func GetWuid() uint64
- func JsCode2Session(jsCode string) (string, string, error)
- type Address
- func (addr *Address) CreateAddress(dto *AddressDTO) error
- func (addr *Address) DeleteAddressByAddressId(userId uint64, addressId uint64) error
- func (addr *Address) QueryAddressByAddressId(userId uint64, addressId uint64) (*Address, error)
- func (addr *Address) QueryAddresses(userId uint64) ([]Address, error)
- func (addr *Address) SetDefaultAddress(userId uint64, addressId uint64) error
- func (addr *Address) UpdateAddress(dto *AddressDTO) error
- type AddressDTO
- type Advert
- type BaseModel
- type Category
- type Classify
- type ClassifyVO
- type IAddress
- type IAdvert
- type IClassify
- type IOrders
- type IProduct
- type ITeamOperation
- type IUserOperation
- type Inventory
- type OrderForm
- func (of *OrderForm) OrderCancel(userId uint64, orderId uint64) error
- func (of *OrderForm) OrderCompleted(userId uint64, orderId uint64) error
- func (of *OrderForm) PlaceOrder(dto *PlaceOrderDTO) error
- func (of *OrderForm) QueryOrderDetails(userId uint64, orderId uint64) (*OrderForm, error)
- func (of *OrderForm) QueryOrders(userId uint64, orderType string, pageIndex int) (*[]OrderForm, error)
- func (of *OrderForm) TableName() string
- type Outbound
- type OutboundDTO
- type Picture
- type PlaceOrderDTO
- type Product
- func (prod *Product) InsertMultipleProducts(dtos *[]ProductDTO) error
- func (prod *Product) InsertProduct(dto *ProductDTO) error
- func (prod *Product) QueryInventoryDetails(inventoryId uint64) (interface{}, error)
- func (prod *Product) QueryProductDetails(productId uint64) (interface{}, error)
- func (prod *Product) QueryProductsByProductType(productType string, pageIndex int) (*[]Product, error)
- type ProductDTO
- type SMS
- type Team
- type TeamVO
- type User
- func (user *User) BeforeCreate(scope *gorm.Scope) error
- func (user *User) CheckIsUserExistByTelephone(telephone string) (bool, error)
- func (user *User) CheckIsUserExistByUserId(userId uint64) (bool, error)
- func (user *User) LoginByTelephone(telephone string, password string) error
- func (user *User) LoginByWechat(jsCode string, wechatUserProfile string, invitationCode string) (*UserWechatVO, error)
- func (user *User) QueryByUserId(userId string) *User
- func (user *User) Register(dto UserRegisterDTO) error
- type UserProfile
- type UserRegisterDTO
- type UserWechatVO
- type WechatMP
- type Wuid
- type WxSession
Constants ¶
Variables ¶
View Source
var ( WechatAppId string WechatSecret string WechatGrantType string )
View Source
var AESSecretKey = beego.AppConfig.String("AESSecretKey")
Get global config
Functions ¶
Types ¶
type Address ¶
type Address struct { AddressId uint64 `json:"addressId" gorm:"column:addressId; primary_key; not null;"` Contact string `json:"contact" gorm:"column:contact; type:varchar(32); not null;"` Telephone string `json:"telephone" gorm:"column:telephone; type:varchar(15); not null;"` IsDefault bool `json:"isDefault" gorm:"column:isDefault; default:false; not null;"` Country string `json:"country" gorm:"column:country; not null;"` ProvinceCity string `json:"city" gorm:"column:city; not null;"` Details string `json:"details" gorm:"column:details; not null;"` Status string `json:"status" gorm:"column:status; type:varchar(10); default:'active'; not null;"` UserId uint64 `json:"userId" gorm:"column:userId; not null;"` BaseModel }
func (*Address) CreateAddress ¶
func (addr *Address) CreateAddress(dto *AddressDTO) error
func (*Address) DeleteAddressByAddressId ¶
func (*Address) QueryAddressByAddressId ¶
func (*Address) QueryAddresses ¶
func (*Address) SetDefaultAddress ¶
func (*Address) UpdateAddress ¶
func (addr *Address) UpdateAddress(dto *AddressDTO) error
type AddressDTO ¶
type AddressDTO struct { AddressId uint64 `json:"addressId"` Contact string `json:"contact"` Telephone string `json:"telephone"` IsDefault bool `json:"isDefault"` Country string `json:"country"` ProvinceCity string `json:"provinceCity"` Details string `json:"details"` UserId uint64 `json:"userId"` }
type Advert ¶
type Advert struct { AdvertId uint64 `json:"advertId" gorm:"column:advertId; primary_key; not null;"` AdvertUrl string `json:"advertUrl" gorm:"column:advertUrl; not null;"` RelativeId uint64 `json:"relativeId" gorm:"column:relativeId; not null;"` Remark string `json:"remark" gorm:"column:remark; not null;"` BaseModel }
func (*Advert) InsertAdvert ¶
func (*Advert) QueryAdvertList ¶
func (*Advert) UpdateAdvertByAdvertId ¶
type Category ¶
type Category struct { CategoryId uint64 `json:"categoryId" gorm:"column:categoryId; primary_key; not null;"` CategoryName string `json:"categoryName" gorm:"column:categoryName; not null; type:varchar(10);"` CategoryIcon string `json:"categoryIcon" gorm:"column:categoryIcon; not null;"` CategoryPriority uint8 `json:"categoryPriority" gorm:"column:categoryPriority; not null; default:0;"` Status string `json:"status" gorm:"column:status; not null; default:'active';"` ClassifyId uint64 `json:"classifyId" gorm:"column:classifyId; not null;"` BaseModel }
type Classify ¶
type Classify struct { ClassifyId uint64 `json:"classifyId" gorm:"column:classifyId; not null; primary_key;"` ClassifyName string `json:"classifyName" gorm:"column:classifyName; type: varchar(10); not null;"` ClassifyIcon string `json:"classifyIcon" gorm:"column:classifyIcon; not null;"` ClassifyPriority uint8 `json:"classifyPriority" gorm:"column:classifyPriority; default:0; not null;"` Status string `json:"status" gorm:"column:status; not null; default:'active';"` BaseModel }
func (*Classify) CreateCategory ¶
func (*Classify) CreateClassify ¶
func (*Classify) QueryClassifies ¶
func (cls *Classify) QueryClassifies() ([]ClassifyVO, error)
type ClassifyVO ¶
type ClassifyVO struct { ClassifyId uint64 `json:"classifyId" gorm:"column:classifyId; not null; primary_key;"` ClassifyName string `json:"classifyName" gorm:"column:classifyName; type: varchar(10); not null;"` ClassifyIcon string `json:"classifyIcon" gorm:"column:classifyIcon; not null;"` ClassifyPriority uint8 `json:"classifyPriority" gorm:"column:classifyPriority; default:0; not null;"` CategoryId uint64 `json:"categoryId" gorm:"column:categoryId; primary_key; not null;"` CategoryName string `json:"categoryName" gorm:"column:categoryName; not null; type:varchar(10);"` CategoryIcon string `json:"categoryIcon" gorm:"column:categoryIcon; not null;"` CategoryPriority uint8 `json:"categoryPriority" gorm:"column:categoryPriority; not null; default:0;"` }
type IAddress ¶
type IAddress interface { QueryAddresses(userId uint64) (*[]Address, error) CreateAddress(dto *AddressDTO) error QueryAddressByAddressId(userId uint64, addressId uint64) (*Address, error) UpdateAddress(dto *AddressDTO) error DeleteAddressByAddressId(userId uint64, addressId uint64) error SetDefaultAddress(userId uint64, addressId uint64) error }
type IOrders ¶
type IOrders interface { QueryOrders(userId uint64, orderType string, pageIndex int) (*[]OrderForm, error) PlaceOrder(dto *PlaceOrderDTO) error OrderCompleted(userId uint64, orderId uint64) error OrderCancel(userId uint64, orderId uint64) error QueryOrderDetails(userId uint64, orderId uint64) error }
type IProduct ¶
type IProduct interface { InsertProduct(dtos *ProductDTO) error InsertMultipleProducts(dtos *[]ProductDTO) error QueryProductsByProductType(productType string, pageIndex int) (*[]Product, error) QueryProductDetails(productId uint64) (interface{}, error) QueryInventoryDetails(inventoryId uint64) (interface{}, error) }
type ITeamOperation ¶
type IUserOperation ¶
type IUserOperation interface { Register(dto UserRegisterDTO) error CheckIsUserExistByUserId(userId uint64) (bool, error) CheckIsUserExistByTelephone(telephone string) (bool, error) QueryByUserId(userId string) *User LoginByTelephone(telephone string, password string) error LoginByWechat(jsCode string, wechatUserProfile string, invitationCode string) (*UserWechatVO, error) }
type Inventory ¶
type Inventory struct { InventoryId uint64 `json:"inventoryId" gorm:"column:inventoryId; primary_key; not null;"` Quantity uint `json:"quantity" gorm:"column:quantity; default: 1000; not null;"` OriginPrice float64 `json:"originPrice" gorm:"column:originPrice; type: decimal(10, 2); default: 1.00; not null;"` SalesNum uint `json:"salesNum" gorm:"column:salesNum; default: 0; not null;"` Commission string `json:"commission" gorm:"column:commission; default: '0%'; not null;"` // description(Product commission, income=originPrice * commission) Specification string `json:"specification" gorm:"column:specification; default: '默认'; not null;"` // description(Product specification...) ProductId uint64 `json:"productId" gorm:"column:productId; not null;"` Status string `json:"status" gorm:"column:status; default: 'active'; type: varchar(10); not null;"` BaseModel }
库存清单信息
type OrderForm ¶
type OrderForm struct { OrderId uint64 `json:"orderId" gorm:"column:orderId; primary_key; not null;"` OrderNumber int64 `json:"orderNumber" gorm:"column:orderNumber; not null;"` TotalAmount float64 `json:"totalAmount" gorm:"column:totalAmount; type: decimal(10, 2); default: 1.00; not null;"` TotalDiscount float64 `json:"totalDiscount" gorm:"column:totalDiscount; type: decimal(10, 2); default: 0.00; not null;"` Remark string `json:"remark" gorm:"column:remark; not null;"` Invoice string `json:"invoice" gorm:"column:invoice; type: ENUM('PAPER', 'ELECTRONIC', 'NONE'); default:'ELECTRONIC'; not null;"` Status string `` /* 141-byte string literal not displayed */ OutTradeNo uint64 `json:"outTradeNo" gorm:"column:outTradeNo; not null;"` AddressId uint64 `json:"addressId" gorm:"column:addressId; not null;"` UserId uint64 `json:"userId" gorm:"column:userId; not null;"` Outbounds []Outbound `json:"outbounds" gorm:"column:outbounds;ForeignKey:orderId;"` BaseModel }
订货单
func (*OrderForm) OrderCancel ¶
func (*OrderForm) OrderCompleted ¶
func (*OrderForm) PlaceOrder ¶
func (of *OrderForm) PlaceOrder(dto *PlaceOrderDTO) error
func (*OrderForm) QueryOrderDetails ¶
func (*OrderForm) QueryOrders ¶
type Outbound ¶
type Outbound struct { OutboundId uint64 `json:"outboundId" gorm:"column:outboundId; primary_key; not null;"` OrderId uint64 `json:"orderId" gorm:"column:orderId; not null;"` ProductId uint64 `json:"productId" gorm:"column:productId; not null;"` ProductName string `json:"productName" gorm:"column:productName; not null;"` ProductPic string `json:"productPic" gorm:"column:productPic; not null;"` ProductThum string `json:"productThum" gorm:"column:productThum; not null;"` ProductUnitPrice float64 `json:"productUnitPrice" gorm:"column:productUnitPrice; type: decimal(10, 2); not null;"` Discount float64 `json:"discount" gorm:"column:discount; type: decimal(10, 2); not null;"` Count uint8 `json:"count" gorm:"default:1; not null;"` Amount float64 `json:"amount" gorm:"type: decimal(10, 2); default: 0.00; not null;"` Status string `json:"status" gorm:"column:status; default: 'active'; not null;"` BaseModel }
type OutboundDTO ¶
type OutboundDTO struct { ProductId uint64 `json:"productId" gorm:"column:productId;"` ProductName string `json:"productName" gorm:"column:productName;"` ProductPic string `json:"productPic" gorm:"column:productPic;"` ProductThum string `json:"productThum" gorm:"column:productThum;"` ProductUnitPrice float64 `json:"productUnitPrice" gorm:"column:productUnitPrice; type: decimal(10, 2);"` Discount float64 `json:"discount" gorm:"column:discount; type: decimal(10, 2);"` Count uint8 `json:"count" gorm:"default:1;"` Amount float64 `json:"amount" gorm:"type: decimal(10, 2); default: 0.00;"` }
type Picture ¶
type Picture struct { PictureId uint64 `json:"pictureId" gorm:"column:pictureId; primary_key; not null;"` PictureName string `json:"pictureName" gorm:"column:pictureName; not null;"` Priority uint8 `json:"priority" gorm:"column:priority; default: 0; not null;"` Status string `json:"status" gorm:"column:status; default: 'active'; type: varchar(10); not null;"` BaseModel }
type PlaceOrderDTO ¶
type PlaceOrderDTO struct { UserId uint64 `json:"userId" gorm:"column:userId"` AddressId uint64 `json:"addressId" gorm:"column:addressId"` TotalDiscount float64 `json:"totalDiscount" gorm:"totalDiscount; type: decimal(10, 2);"` TotalAmount float64 `json:"totalAmount" gorm:"totalAmount; type: decimal(10, 2);"` Invoice string `json:"invoice" gorm:"column:invoice;"` Remark string `json:"remark" gorm:"column:remark"` Outbounds []OutboundDTO `json:"products" gorm:"column:products"` }
type Product ¶
type Product struct { ProductId uint64 `json:"productId" gorm:"column:productId; primary_key; not null;"` ProductName string `json:"productName" gorm:"column:productName; not null;"` ProductSubName string `json:"productSubName" gorm:"column:productSubName; not null;"` ProductPic string `json:"productPic" gorm:"column:productPic; not null;"` ProductThum string `json:"productThum" gorm:"column:productThum; not null;"` ProductDesc string `json:"productDesc" gorm:"column:productDesc; not null;"` Priority uint8 `json:"priority" gorm:"default:0; not null;"` ProductType string `json:"productType" gorm:"column:productType; default: 'normal'; type: enum('recommend', 'normal', 'specific'); not null;"` // description(Here will have 3 types, include 'recommend', 'normal', 'specific') Status string `json:"status" gorm:"column:status; default: 'active'; type: varchar(10); not null;"` Inventories []Inventory `json:"inventories" gorm:"column: inventories;"` BaseModel }
func (*Product) InsertMultipleProducts ¶
func (prod *Product) InsertMultipleProducts(dtos *[]ProductDTO) error
func (*Product) InsertProduct ¶
func (prod *Product) InsertProduct(dto *ProductDTO) error
func (*Product) QueryInventoryDetails ¶
func (*Product) QueryProductDetails ¶
type ProductDTO ¶
type ProductDTO struct { Quantity uint `json:"quantity"` OriginPrice float64 `json:"originPrice"` Commission string `json:"commission"` Specification string `json:"specification"` ProductName string `json:"productName"` ProductSubName string `json:"productSubName"` ProductPic string `json:"productPic"` ProductThum string `json:"productThum"` ProductDesc string `json:"productDesc"` Priority uint8 `json:"priority"` ProductType string `json:"productType"` }
type SMS ¶
type SMS struct { UserId uint64 `json:"userId" gorm:"column:userId; not null;"` OperationMode string `json:"operationMode" gorm:"column:operationMode; not null; type:varchar(10);"` SecurityCode string `json:"securityCode" gorm:"column:securityCode; type:varchar(6); not null;"` Telephone string `json:"telephone"` ExpiresAt time.Time `json:"expiresAt" gorm:"column:expiresAt; type:dateTime; not null;"` CreatedAt time.Time `json:"createdAt" gorm:"column:createdAt;type:dateTime"` }
func (*SMS) ObtainSecurityCode ¶
type Team ¶
type Team struct { TeamId uint64 `json:"teamId" gorm:"column:teamId; primary_key; not null;"` TopLevelAgent uint64 `json:"topLevelAgent" gorm:"column:topLevelAgent; not null;"` SuperiorAgent uint64 `json:"superiorAgent" gorm:"column:superiorAgent; not null;"` Status string `json:"status" gorm:"column:status; default:'active'; not null;"` Channel string `json:"channel" gorm:"column:channel; default:'Wechat'; not null;"` InvitationCode string `json:"invitationCode" gorm:"column:invitationCode; unique; type:varchar(6); not null;"` UserId uint64 `json:"userId" gorm:"column:userId;not null;"` BaseModel }
func (*Team) QueryTeamByInvitationCode ¶
type User ¶
type User struct { UserId uint64 `json:"userId" gorm:"column:userId;primary_key;not null"` UserProfile Role uint16 `json:"role" gorm:"column:role; default:10; not null;"` Status string `json:"status" gorm:"column:status; type:varchar(10); default:'active'; not null;"` Channel string `json:"channel" gorm:"column:channel; type:varchar(12); not null;"` Addresses []Address `json:"addresses" gorm:"column:addresses;"` BaseModel }
func (*User) BeforeCreate ¶
callbacks hock -- before create, encrypt password
func (*User) CheckIsUserExistByTelephone ¶
func (*User) CheckIsUserExistByUserId ¶
func (*User) LoginByTelephone ¶
func (*User) LoginByWechat ¶
func (*User) QueryByUserId ¶
func (*User) Register ¶
func (user *User) Register(dto UserRegisterDTO) error
type UserProfile ¶
type UserProfile struct { Telephone string `json:"telephone" gorm:"column:telephone; type:varchar(11);not null"` Username string `json:"username" gorm:"column:username; type:varchar(18);not null"` Password string `json:"-" gorm:"column:password; type:varchar(24);null"` Nickname string `json:"nickname" gorm:"column:nickname; type:varchar(16);not null;"` Male bool `json:"male" gorm:"column:male; not null; default:false;"` Signature string `json:"signature" gorm:"not null; default:'This guy is lazy...'"` }
type UserRegisterDTO ¶
type UserWechatVO ¶
type WxSession ¶
type WxSession struct { SessionId uint64 `json:"sessionId" gorm:"column:sessionId; not null; primary_key;"` Skey string `json:"skey" gorm:"column:skey; not null;"` SessionKey string `json:"sessionKey" gorm:"column:sessionKey; not null;" ` WechatUserProfile string `json:"wechatUserProfile" gorm:"column:wechatUserProfile; not null;"` OpenId string `json:"openId" gorm:"column:openId; index; not null;"` UserId uint64 `json:"userId" gorm:"column:userId; not null;"` BaseModel }
Click to show internal directories.
Click to hide internal directories.