db

package
v0.0.0-...-8dbf7a7 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB() *gorm.DB

DB 返回 *gorm.DB

Types

type Activity

type Activity struct {
	ID        uint   `gorm:"primary_key"`
	Title     string `gorm:"type:varchar(255)"`       // 资源名称	名称搜索
	WxTo      string `gorm:"type:varchar(255)"`       // 目标地址 	小程序往哪里走
	Resource  string `gorm:"type:varchar(255);index"` // 目标地址
	Total     int64  // 次数统计
	Level     int32
	CreatedAt time.Time
	UpdatedAt time.Time
}

Activity 号召阅读

func (*Activity) GetActivities

func (activity *Activity) GetActivities() (activities []Activity)

GetActivities 获取最近100条号召令

func (*Activity) GetActivityByID

func (activity *Activity) GetActivityByID(id int)

GetActivityByID 获取一个资源

func (*Activity) GetActivityByResource

func (activity *Activity) GetActivityByResource(resource string)

GetActivityByResource 资源地址

func (*Activity) GetActivityByWxto

func (activity *Activity) GetActivityByWxto(wxto string)

GetActivityByWxto 想去哪里 创建一个记录

func (*Activity) Save

func (activity *Activity) Save()

Save Feedback

type Catalog

type Catalog struct {
	ID        uint   `gorm:"primary_key"`
	OpenID    string `gorm:"type:varchar(255);index"` // 微信文章地址
	Title     string `gorm:"type:varchar(255);"`      //订阅formID,一次订阅只能推送一次通知
	URL       string `gorm:"type:varchar(2048);"`     //订阅formID,一次订阅只能推送一次通知
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

Catalog 目录

func (*Catalog) Save

func (feedback *Catalog) Save()

Save Feedback

type Fail

type Fail struct {
	ID        uint `gorm:"primary_key"`
	FansID    uint `gorm:"index:user_id"` // 谁在收集助力
	CreatedAt time.Time
}

Fail 签到记录

type Fans

type Fans struct {
	ID              uint   `gorm:"primary_key"`
	OpenID          string `gorm:"type:varchar(255);unique_index"`
	NickName        string
	Gender          int
	Provider        string //平台
	City            string
	Province        string
	Country         string
	AvatarURL       string
	Language        string
	Timestamp       int64
	Level           int32 // 用户等级
	Score           int64 // 积分
	Total           int64 // 总分
	LoginTotal      int64 // 授权访问次数
	InvitationTotal int64 // 邀请用户次数
	AppID           string
	SessionKey      string // 粉丝上次的session key 如果有变化,同步一次粉丝数据
	CreatedAt       time.Time
	UpdatedAt       time.Time
	DeletedAt       *time.Time `sql:"index"`
}

Fans 粉丝数据信息

func (*Fans) GetFansAllFollows

func (fans *Fans) GetFansAllFollows(offser, limit int) (follows []Follow)

GetFansAllFollows 获取用户关注的源

func (*Fans) GetFansAllSources

func (fans *Fans) GetFansAllSources(offser, limit int) (sources []Source)

GetFansAllSources 获取粉丝添加的源

func (*Fans) GetFansByID

func (fans *Fans) GetFansByID(id uint)

GetFansByID 通过ID获取粉丝信息

func (*Fans) GetFansByOpenID

func (fans *Fans) GetFansByOpenID(openID string)

GetFansByOpenID 通过openID获取粉丝信息如果没有的话进行初始化

func (*Fans) GetLastUser

func (fans *Fans) GetLastUser()

GetFansByID 通过ID获取粉丝信息

func (*Fans) RelationLog

func (fans *Fans) RelationLog(relationID int)

RelationLog 记录 openID 吸引粉丝访问

func (*Fans) Save

func (fans *Fans) Save()

Save 保存粉丝信息

type Feedback

type Feedback struct {
	ID        uint   `gorm:"primary_key"`
	OpenID    string `gorm:"type:varchar(255);index"` // 微信文章地址
	FormID    string `gorm:"type:varchar(255);"`      //订阅formID,一次订阅只能推送一次通知
	Problem   string `gorm:"type:text;"`              // 问题
	Answer    string `gorm:"type:text;"`              // 答复
	Show      bool   //是否显示
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

Feedback 粉丝

func (*Feedback) Save

func (feedback *Feedback) Save()

Save Feedback

type Follow

type Follow struct {
	ID        uint   `gorm:"primary_key"`
	OpenID    string `gorm:"type:varchar(255);index"`
	Title     string
	URL       string
	Drive     string
	Page      string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

Follow 关注列表

type Log

type Log struct {
	ID        uint   `gorm:"primary_key"`
	OpenID    string `gorm:"type:varchar(255);index"`
	Title     string
	URL       string
	Drive     string
	Page      string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

Log 粉丝浏览记录

type Post

type Post struct {
	ID        uint   `gorm:"primary_key"`
	Cate      int32  // 类型  1文章  2小说
	Name      string `gorm:"type:varchar(255);index"` // 资源名称	名称搜索
	WxTo      string `gorm:"type:varchar(255);index"` // 目标地址 	小程序往哪里走
	From      string // 数据来源
	Total     int64  // 次数统计
	Level     int32  // 级别限制(不加入搜索条件限制)
	CreatedAt time.Time
	UpdatedAt time.Time
}

Post 小程序二维码

func (*Post) GetPostByID

func (post *Post) GetPostByID(id int)

GetPostByID 获取一个资源

func (*Post) GetPostByWxto

func (post *Post) GetPostByWxto(wxto string)

GetPostByWxto 想去哪里 创建一个记录

func (*Post) GetPostsByName

func (post *Post) GetPostsByName(name string) (posts []Post)

GetPostsByName 通过名字获得查询记录

func (*Post) GetPostsByNameLimitLevel

func (post *Post) GetPostsByNameLimitLevel(name string, level int) (posts []Post)

GetPostsByNameLimitLevel 通过名字获得查询记录 限制资源等级

func (*Post) Save

func (post *Post) Save()

Save Feedback

type Qrcode

type Qrcode struct {
	ID        uint   `gorm:"primary_key"`
	WxTo      string `gorm:"type:varchar(255);index"` // 目标地址
	Total     int64  //次数统计
	CreatedAt time.Time
	UpdatedAt time.Time
}

Qrcode 小程序二维码

func (*Qrcode) GetQrcodeByID

func (qrcode *Qrcode) GetQrcodeByID(id int)

GetQrcodeByID 获取一个二维码

func (*Qrcode) GetQrcodeID

func (qrcode *Qrcode) GetQrcodeID(wxto string)

GetQrcodeID 生成一个二维码ID

func (*Qrcode) Save

func (qrcode *Qrcode) Save()

Save Feedback

type Relation

type Relation struct {
	ID         uint `gorm:"primary_key"`
	FansID     uint `gorm:"index:id"` //粉丝ID
	RelationID uint `gorm:"index:id"` //被吸来ID
	CreatedAt  time.Time
}

Relation 关联关系(粉丝分享小程序吸引别人来)

type Share

type Share struct {
	ID        uint `gorm:"primary_key"`
	FansID    uint `gorm:"index:index"`
	CreatedAt time.Time
}

Share 分享记录

func (*Share) Log

func (share *Share) Log(openID string)

Log 记录 openID 分享 Task 记录

func (*Share) Save

func (share *Share) Save()

Save Share

type Sign

type Sign struct {
	ID        uint `gorm:"primary_key"`
	FansID    uint `gorm:"index:user_id"` // 谁在收集助力
	CreatedAt time.Time
}

Sign 签到记录

type Source

type Source struct {
	ID        uint   `gorm:"primary_key"`
	OpenID    string `gorm:"type:varchar(255);index"`
	Title     string
	URL       string
	Drive     string
	Page      string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

Source 用户自定义的数据源

Jump to

Keyboard shortcuts

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