controllers

package
v0.0.0-...-3c303ff Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FILETYPES = utils.FILETYPES

Functions

func CopyFile

func CopyFile(fr FileReader, dstName string) error

func ExtractGZipInnerFile

func ExtractGZipInnerFile(gzFile string, innerFile string, dst *os.File) error

GZIP解压单个文件

func ExtractTarInnerFile

func ExtractTarInnerFile(tarFile string, innerFile string, dst *os.File) error

TAR解压单个文件

func ExtractZipInnerFile

func ExtractZipInnerFile(zipFile string, innerFile string, dst *os.File) error

ZIP解压单个文件

func GetFileNameUtf8

func GetFileNameUtf8(file *zip.File) string

=========================================华丽丽分界线====================================================== 解决文件名乱码问题,如果标示位是0,则是默认的本地编码,默认为gbk

func GetHost

func GetHost(ctx *context.Context) string

func GetInnerFilePath

func GetInnerFilePath(pageFile string, innerFile string) (string, string)

================================================单文件提取=============================================== tar.gz格式内部有些文件夹可能带有./前缀

func If

func If(condition bool, trueVal, falseVal interface{}) interface{}

func IsGZ

func IsGZ(name string) bool

判断单纯.gz后缀文件

func RequestFile

func RequestFile(self *PageController, pageFile string, info DocInfo)

文件请求通用过程

Types

type AttachmentController

type AttachmentController struct {
	BaseController
}

func (*AttachmentController) Delete

func (this *AttachmentController) Delete()

func (*AttachmentController) Download

func (this *AttachmentController) Download()

func (*AttachmentController) Image

func (this *AttachmentController) Image()

func (*AttachmentController) Page

func (this *AttachmentController) Page()

func (*AttachmentController) Upload

func (this *AttachmentController) Upload()

type AuthorController

type AuthorController struct {
	BaseController
}

func (*AuthorController) AuthLogin

func (this *AuthorController) AuthLogin()

auth login

func (*AuthorController) Index

func (this *AuthorController) Index()

login index

func (*AuthorController) Login

func (this *AuthorController) Login()

login

func (*AuthorController) Logout

func (this *AuthorController) Logout()

logout

type BaseController

type BaseController struct {
	TemplateController
}

func (*BaseController) CloneCloud

func (this *BaseController) CloneCloud()

将已下载好的云资源,迁移到相应位置并入库

type CollectionController

type CollectionController struct {
	BaseController
}

func (*CollectionController) Add

func (this *CollectionController) Add()

func (*CollectionController) Cancel

func (this *CollectionController) Cancel()

type ComFileReader

type ComFileReader struct {
	// contains filtered or unexported fields
}

func (*ComFileReader) Copy

func (c *ComFileReader) Copy(fw *os.File) (int64, error)

func (*ComFileReader) IsDir

func (c *ComFileReader) IsDir() bool

func (*ComFileReader) Reader

func (c *ComFileReader) Reader() *tar.Reader

type Compressor

type Compressor struct {
	// contains filtered or unexported fields
}

func ComCompress

func ComCompress(self beego.Controller, extract bool) (*Compressor, error)

DataController PageController 的共同祖先类 beego.Controller

func CreateCompressor

func CreateCompressor(pageFile string) *Compressor

func (*Compressor) CopyGZ

func (c *Compressor) CopyGZ(fr *gzip.Reader) error

func (*Compressor) ExtractFile

func (c *Compressor) ExtractFile(fr FileReader, name string) error

func (*Compressor) ExtractInnerFile

func (c *Compressor) ExtractInnerFile(absPath string, innerFile string, dst *os.File) error

func (*Compressor) GetFileList

func (c *Compressor) GetFileList(extract bool) (FileList, error)

==========================================解压相关=========================================================

func (*Compressor) GetGZipFileList

func (c *Compressor) GetGZipFileList(gzFile string, extract bool) (FileList, error)

tar.gz,仅获取文件列表

func (*Compressor) GetName

func (c *Compressor) GetName(pageFile string, ext string, filename string) string

func (*Compressor) GetTarFileList

func (c *Compressor) GetTarFileList(tarFile string, extract bool) (FileList, error)

tar,仅获取文件列表

func (*Compressor) GetZipFileList

func (c *Compressor) GetZipFileList(zipFile string, extract bool) (FileList, error)

zip文件,仅获取文件列表

func (*Compressor) InitCompress

func (c *Compressor) InitCompress(spaceId string, extract bool) error

用于线上解压

type DataController

type DataController struct {
	beego.Controller
}

func (*DataController) Decompress

func (this *DataController) Decompress()

在线解压

func (*DataController) DelCompress

func (this *DataController) DelCompress()

在线解压清除

func (*DataController) GetServeUrl

func (this *DataController) GetServeUrl()

为解决文本复制问题,在请求压缩包时提前请求一次服务地址,以pre区分 获取在线解压后的服务地址

func (*DataController) ViewPkg

func (this *DataController) ViewPkg()

提供压缩包文件预览功能 DataController PageController

func (*DataController) ViewPkgFile

func (this *DataController) ViewPkgFile()

提供压缩包内部文件内容预览功能 默认解压到同目录下_temp文件夹下,若该压缩包已被解压,则请求解压后的文件

type DocInfo

type DocInfo struct {
	// contains filtered or unexported fields
}

func GetDirInfo

func GetDirInfo(this *BaseController) (DocInfo, error)

func GetDocInfo

func GetDocInfo(self BaseController) (DocInfo, error)

通用过程

type DocumentController

type DocumentController struct {
	BaseController
}

func (*DocumentController) Add

func (this *DocumentController) Add()

add document

func (*DocumentController) Delete

func (this *DocumentController) Delete()

delete document

func (*DocumentController) History

func (this *DocumentController) History()

document history

func (*DocumentController) Index

func (this *DocumentController) Index()

document index

func (*DocumentController) Move

func (this *DocumentController) Move()

move document

func (*DocumentController) Save

func (this *DocumentController) Save()

save document

func (*DocumentController) UpdateFile

func (this *DocumentController) UpdateFile()

func (*DocumentController) Upload

func (this *DocumentController) Upload()

================================================================================= 注·九成以上代码来自于Save()方法 upload file

type FileList

type FileList struct {
	Names []string `json: names`
	Types []int    `json: types`
}

func GetLocalFileList

func GetLocalFileList(folder string) (FileList, error)

type FileReader

type FileReader interface {
	Reader() *tar.Reader
	IsDir() bool
	Copy(fw *os.File) (int64, error)
}

实现多态

type FollowController

type FollowController struct {
	BaseController
}

func (*FollowController) Add

func (this *FollowController) Add()

func (*FollowController) Cancel

func (this *FollowController) Cancel()

type GzFileReader

type GzFileReader struct {
	// contains filtered or unexported fields
}

func (*GzFileReader) Copy

func (g *GzFileReader) Copy(fw *os.File) (int64, error)

func (*GzFileReader) IsDir

func (g *GzFileReader) IsDir() bool

func (*GzFileReader) Reader

func (g *GzFileReader) Reader() *tar.Reader

type ImageController

type ImageController struct {
	BaseController
}

func (*ImageController) Upload

func (this *ImageController) Upload()

type JsonResponse

type JsonResponse struct {
	Code     int                    `json:"code"`
	Message  interface{}            `json:"message"`
	Data     interface{}            `json:"data"`
	Redirect map[string]interface{} `json:"redirect"`
}

type MainController

type MainController struct {
	BaseController
}

func (*MainController) About

func (this *MainController) About()

func (*MainController) Default

func (this *MainController) Default()

func (*MainController) Index

func (this *MainController) Index()

func (*MainController) Search

func (this *MainController) Search()

搜索,支持根据标题和内容搜索

type PageController

type PageController struct {
	BaseController
}

func (*PageController) Display

func (this *PageController) Display()

document share display

func (*PageController) Edit

func (this *PageController) Edit()

page edit

func (*PageController) Export

func (this *PageController) Export()

export file

func (*PageController) Modify

func (this *PageController) Modify()

page modify

func (*PageController) View

func (this *PageController) View()

==================================================== 业务代码开始 =================================================== document page view

func (*PageController) ViewCom

func (this *PageController) ViewCom()

=====================================================通用View============================================================= document page view common, 因去掉了繁琐的验证,可能被用于非法访问

func (*PageController) ViewPkgCom

func (this *PageController) ViewPkgCom()

压缩包内部文件预览,已提前解压

type SpaceController

type SpaceController struct {
	BaseController
}

func (*SpaceController) AddMember

func (this *SpaceController) AddMember()

func (*SpaceController) Collection

func (this *SpaceController) Collection()

func (*SpaceController) Document

func (this *SpaceController) Document()

func (*SpaceController) Index

func (this *SpaceController) Index()

func (*SpaceController) List

func (this *SpaceController) List()

func (*SpaceController) Member

func (this *SpaceController) Member()

func (*SpaceController) ModifyMember

func (this *SpaceController) ModifyMember()

func (*SpaceController) RemoveMember

func (this *SpaceController) RemoveMember()

func (*SpaceController) Search

func (this *SpaceController) Search()

type TemplateController

type TemplateController struct {
	beego.Controller
	UserId string
	User   map[string]string
	// contains filtered or unexported fields
}

func (*TemplateController) DebugLog

func (this *TemplateController) DebugLog(message string)

func (*TemplateController) ErrorLog

func (this *TemplateController) ErrorLog(message string)

func (*TemplateController) GetClientIp

func (this *TemplateController) GetClientIp() string

get client ip

func (*TemplateController) GetDocumentPrivilege

func (this *TemplateController) GetDocumentPrivilege(space map[string]string) (isVisit, isEditor, isManager bool)

func (*TemplateController) GetLogInfoByCtx

func (this *TemplateController) GetLogInfoByCtx() map[string]interface{}

func (*TemplateController) GetRangeInt

func (this *TemplateController) GetRangeInt(key string, def int, min int, max int) (n int, err error)

func (*TemplateController) InfoLog

func (this *TemplateController) InfoLog(message string)

func (*TemplateController) IsGet

func (this *TemplateController) IsGet() bool

is Get

func (*TemplateController) IsPost

func (this *TemplateController) IsPost() bool

is Post

func (*TemplateController) IsRoot

func (this *TemplateController) IsRoot() bool

是否是超级管理员

func (*TemplateController) JsonError

func (this *TemplateController) JsonError(message interface{}, data ...interface{})

return json error

func (*TemplateController) JsonSuccess

func (this *TemplateController) JsonSuccess(message interface{}, data ...interface{})

return json success

func (*TemplateController) Prepare

func (this *TemplateController) Prepare()

prepare

func (*TemplateController) RecordLog

func (this *TemplateController) RecordLog(message string, level int)

insert action log

func (*TemplateController) SetPaginator

func (this *TemplateController) SetPaginator(per int, nums int64) *utils.Paginator

paginator

func (*TemplateController) ViewError

func (this *TemplateController) ViewError(content string, redirect ...string)

view layout

func (*TemplateController) ViewLayout

func (this *TemplateController) ViewLayout(viewName, layout string)

view layout

func (*TemplateController) WarningLog

func (this *TemplateController) WarningLog(message string)

type UploadJsonResponse

type UploadJsonResponse struct {
	Code     int                    `json:"code"`
	Message  interface{}            `json:"message"`
	Data     interface{}            `json:"data"`
	Redirect map[string]interface{} `json:"redirect"`
	Error    interface{}            `json:"error"`
}

type UploadResponse

type UploadResponse struct {
	Success int    `json:"success"`
	Message string `json:"message"`
	Url     string `json:"url"`
}

type UserController

type UserController struct {
	BaseController
}

func (*UserController) Follow

func (this *UserController) Follow()

func (*UserController) FollowPage

func (this *UserController) FollowPage()

func (*UserController) FollowUser

func (this *UserController) FollowUser()

func (*UserController) Index

func (this *UserController) Index()

func (*UserController) Info

func (this *UserController) Info()

func (*UserController) List

func (this *UserController) List()

Jump to

Keyboard shortcuts

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