model

package
v0.0.0-...-e027c79 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Goods

type Goods struct {
	Model `xorm:"extends"`
	//4位商品随机码
	RandCode string `json:"rand_code" xorm:"varchar(4) notnull comment('商品随机码')"`
	//商品的名字,可以重复,用ID区分不同商品
	Name string `json:"name" xorm:"varchar(20) notnull"`
	//是否可用
	Enable bool `json:"enable" xorm:"notnull comment('商品是否可用')"`
	//商品的额定售价
	Price float64 `json:"price" xorm:"DECIMAL(19,5) notnull comment('商品的额定售价')"`
	//商品返佣占总售价的比例,n%
	//0=>不参与返佣,不能为负
	Rate1 int `json:"rate_1" xorm:"notnull comment('商品返佣占总售价的百分比(n%)')"`
	//返佣分配的方式
	//1.逐层平分(含购买者本人),关系链中的每一个人,将商品的返佣额进行均分
	//2.阶梯均分,距离购买者最近的返佣金额最多
	RMode RebateMode `json:"r_mode" xorm:"notnull comment('返佣分配的方式')"`
	//限制参与返佣的购买次数
	//用户购买n次之内,关系链内的成员均参与返佣
	//超过时,则不对关系链内的成员返佣
	//0表示不限制次数
	//单人购买返佣次数
	Limit1 int `json:"limit_1" xorm:"notnull comment('单人购买返佣次数')"`
}

Goods ...商品表

func (*Goods) CompoundIndexes

func (g *Goods) CompoundIndexes() []*gxdb.CompoundIndex

CompoundIndexes implement InterfaceCompoundIndexes

func (*Goods) UseCache

func (g *Goods) UseCache() bool

UseCache implement InterfaceCompoundIndexes 使用缓存返回true

type Model

type Model = gxdb.MyBase

Model ...alias

type RebateMode

type RebateMode int

RebateMode 返佣模式

const (
	//均分
	RModeEach RebateMode = iota + 1
	//阶梯	比如2层,共分100,第一人分1x,第二人分2x
	RModeLadder
)

declare rebate mode

type SysUser

type SysUser struct {
	Model `xorm:"extends"`
	//手机号码注册
	Username string `json:"username" xorm:"varchar(20) notnull unique"`
	Password string `json:"password,omitempty" xorm:"varchar(50) notnull"`
	//用户是否已被冻结,登录时,如果被冻结,提示
	//不设置索引,需要查询出数据再进行单独判断
	Enable bool `json:"enable" xorm:"notnull"`
	//用户身份,不会更改; 1->Master 2->Vip
	Role UserRole `json:"role" xorm:"notnull index comment('用户身份级别')"`
}

SysUser 用户表 表名 sys_user

func (*SysUser) BeforeInsert

func (s *SysUser) BeforeInsert()

BeforeInsert 触发器

func (*SysUser) BeforeUpdate

func (s *SysUser) BeforeUpdate()

BeforeUpdate ...

func (*SysUser) ChangePassword

func (s *SysUser) ChangePassword() ghttp.HandlerFunc

ChangePassword ...修改密码 Deprecated ...use ChangePassword2

func (*SysUser) ChangePassword2

func (s *SysUser) ChangePassword2() ghttp.HandlerFunc

ChangePassword2 ...

func (*SysUser) CompoundIndexes

func (s *SysUser) CompoundIndexes() []*gxdb.CompoundIndex

CompoundIndexes 实现联合索引接口

func (*SysUser) GetByName

func (s *SysUser) GetByName(name string) (bean *SysUser, err error)

GetByName ...获取用户对象

func (*SysUser) InitData

func (s *SysUser) InitData() error

InitData ...初始化管理员数据

func (*SysUser) PlaintextPassword

func (s *SysUser) PlaintextPassword() (plaintext string, err error)

PlaintextPassword ...获取密码明文

func (*SysUser) UseCache

func (s *SysUser) UseCache() bool

UseCache ...是否使用内置缓存

type SysUserBalance

type SysUserBalance struct {
	Model  `xorm:"extends"`
	UID    int64   `json:"uid" xorm:"notnull unique"`
	Amount float64 `json:"amount" xorm:"DECIMAL(19,5) notnull comment('余额')"`
}

SysUserBalance 用户账户余额

func (*SysUserBalance) CompoundIndexes

func (s *SysUserBalance) CompoundIndexes() []*gxdb.CompoundIndex

CompoundIndexes implement InterfaceCompoundIndexes

func (*SysUserBalance) UseCache

func (s *SysUserBalance) UseCache() bool

UseCache implement InterfaceCompoundIndexes

type SysUserInfo

type SysUserInfo struct {
	Model `xorm:"extends"`
	UID   int64  `json:"uid" xorm:"notnull unique"`
	Nick  string `json:"nick" xorm:"varchar(50) notnull"`
	Wx    string `json:"wx,omitempty" xorm:"varchar(20) notnull"`
	//Phone   string   `json:"phone,omitempty" xorm:"varchar(15) notnull"`
	RegIP   string `json:"reg_ip,omitempty" xorm:"varchar(20) notnull"`
	Comment string `json:"comment,omitempty" xorm:"varchar(100) notnull comment('用户备注')"`
}

SysUserInfo 用户信息表

func (*SysUserInfo) CompoundIndexes

func (s *SysUserInfo) CompoundIndexes() []*gxdb.CompoundIndex

CompoundIndexes implement InterfaceCompoundIndexes

func (*SysUserInfo) UseCache

func (s *SysUserInfo) UseCache() bool

UseCache implement InterfaceCompoundIndexes

type UserRole

type UserRole int

UserRole 用户身份级别

const (
	Master UserRole
	Vip
)

用户身份权限设定

Jump to

Keyboard shortcuts

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