xalbum

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: BSD-3-Clause-Clear Imports: 7 Imported by: 0

Documentation

Overview

用户相册组件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Childs added in v0.2.52

func Childs(id uint) []uint

获取相册的子ID列表

id	待获取的相册ID

func Create

func Create(c *Albumn) error

创建相册

c	修改后的相册内容

func PictureCreate

func PictureCreate(c *AlbumnPicture) error

创建相册内的照片

c	待创建的信息

func PictureRemove

func PictureRemove(id, fid uint) error

从相册中移除照片

id	相册ID
fid	照片文件ID

func Regedit

func Regedit(c *Config)

相册模块注册

c	配置项信息

Types

type Albumn

type Albumn struct {
	Id        uint   `gorm:"column:id;type:int unsigned;primaryKey;autoIncrement;not null" form:"id" json:"id"`
	Uid       uint   `gorm:"column:uid;type:int unsigned;comment:用户ID" form:"uid" json:"uid"`                          // 用户ID
	Name      string `gorm:"column:name;type:varchar(100);comment:相册名称" form:"name" json:"name"`                       // 相册名称
	Fid       uint   `gorm:"column:fid;type:int unsigned;comment:上级ID" form:"fid" json:"fid"`                          // 上级ID
	Thumb     uint   `gorm:"column:thumb;type:int unsigned;comment:封面图ID" form:"thumb" json:"thumb"`                   // 封面图ID
	IsVideo   uint8  `gorm:"column:is_video;type:tinyint unsigned;comment:是否为视频相册" form:"is_video" json:"is_video"`    // 是否为视频相册
	IsPeople  uint8  `gorm:"column:is_people;type:tinyint unsigned;comment:是否为人物相册" form:"is_people" json:"is_people"` // 是否为人物相册
	IsStory   uint8  `gorm:"column:is_story;type:tinyint unsigned;comment:是否为故事集" form:"is_story" json:"is_story"`     // 是否为故事集
	IsMore    uint8  `gorm:"column:is_more;type:tinyint unsigned;comment:是否为更多相册" form:"is_more" json:"is_more"`       // 是否为更多相册
	IsDeleted uint8  `gorm:"column:is_deleted;type:tinyint unsigned;comment:是否删除" form:"is_deleted" json:"is_deleted"` // 是否删除
	CreatedAt string `gorm:"column:created_at;type:datetime;comment:添加时间" form:"created_at" json:"created_at"`         // 添加时间
	UpdatedAt string `gorm:"column:updated_at;type:datetime;comment:修改时间" form:"-" json:"-"`                           // 修改时间
}

相册表

func Info

func Info(id uint) (*Albumn, error)

获取相册详情信息

id	相册ID

func List

func List(uid, fid uint) ([]Albumn, error)

获取相册列表 因个人相册列表数量不会太多,所以此处直接使用List进行获取全部

uid	用户ID
fid	上级相册ID

func (*Albumn) TableName

func (c *Albumn) TableName() string

返回所属表名信息

type AlbumnPicture

type AlbumnPicture struct {
	Id        uint   `gorm:"column:id;type:int unsigned;primaryKey;autoIncrement;not null" form:"id" json:"id"`
	Uid       uint   `gorm:"column:uid;type:int unsigned;comment:上传人" form:"uid" json:"uid"`                           //上传人
	Fid       uint   `gorm:"column:fid;type:int unsigned;comment:文件ID" form:"fid" json:"fid"`                          //文件ID
	Aid       uint   `gorm:"column:aid;type:int unsigned;comment:所属相册ID" form:"aid" json:"aid"`                        //所属相册ID
	Type      uint   `gorm:"column:type;type:int unsigned;comment:图片类型" form:"type" json:"type"`                       //图片类型 0-未标记 1-标记为图片 2-标记为视频 3-标记为音频 4-标记为电话录音 5-标记为文档文件
	CreatedAt string `gorm:"column:created_at;type:datetime;comment:添加时间" form:"created_at" json:"created_at"`         //添加时间
	IsDeleted uint8  `gorm:"column:is_deleted;type:tinyint unsigned;comment:是否删除" form:"is_deleted" json:"is_deleted"` //是否删除
}

相册图片表

func Picture

func Picture(id uint, offset, limit int) (int64, []AlbumnPicture, error)

获取相册内的图片列表

id		相册ID
offset	跳过条数
limit	查询条数

func PictureSpecial added in v0.2.52

func PictureSpecial(id, offset, limit int) (int64, []AlbumnPicture, error)

获取特殊相册中的文件列表

id		特殊相册类型
	0	最近上传【最近一周上传的文件列表】
	-1	所有图片【标记类型】
	-2	所有视频【标记类型】
	-3	所有音频【标记类型】
	-4	电话录音【标记类型】
	-5	文档附件【标记类型】
offset	跳过条数
limit	查询条数

func (*AlbumnPicture) TableName

func (c *AlbumnPicture) TableName() string

返回所属表名信息

type Config

type Config struct {
	DB                *gorm.DB
	AlbumnName        string // 相册表名称
	AlbumnPictureName string // 相册内照片表名称
	sync.Map                 // 缓存标识
	// contains filtered or unexported fields
}

配置项详情

type TreeAlbumn added in v0.2.61

type TreeAlbumn struct {
	Id    uint         `json:"id" form:"id" xml:"id"`                   // 相册ID
	Label string       `json:"label" form:"label" xml:"label"`          // 相册名称
	Child []TreeAlbumn `json:"children" form:"children" xml:"children"` // 子相册列表
}

相册树

func Tree added in v0.2.61

func Tree(uid uint, fid uint) ([]TreeAlbumn, error)

获取相册目录树

Jump to

Keyboard shortcuts

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