12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- package watermark
- import (
- "time"
- )
- const (
-
- TypeName = 1
-
- TypeUID = 2
-
- TypeNewName = 3
-
- StatClose = 0
-
- StatOpen = 1
-
- StatPreview = 2
-
- PosLeftTop = 1
-
- PosRightTop = 2
-
- PosLeftBottom = 3
-
- PosRightBottom = 4
- )
- type Watermark struct {
- ID int64 `json:"id"`
- MID int64 `json:"mid"`
- Uname string `json:"uname"`
- State int8 `json:"state"`
- Ty int8 `json:"type"`
- Pos int8 `json:"position"`
- URL string `json:"url"`
- MD5 string `json:"md5"`
- Info string `json:"info"`
- Tip string `json:"tip"`
- CTime time.Time `json:"ctime"`
- MTime time.Time `json:"mtime"`
- }
- type WatermarkParam struct {
- MID int64
- State int8
- Ty int8
- Pos int8
- Sync int8
- IP string
- }
- type Image struct {
- Width int `json:"width"`
- Height int `json:"height"`
- }
- func IsState(st int8) bool {
- return st == StatClose || st == StatOpen || st == StatPreview
- }
- func IsType(ty int8) bool {
- return ty == TypeName || ty == TypeUID || ty == TypeNewName
- }
- func IsPos(pos int8) bool {
- return pos == PosLeftTop || pos == PosRightTop || pos == PosLeftBottom || pos == PosRightBottom
- }
- type Msg struct {
- Action string `json:"action"`
- Old *UserInfo `json:"old"`
- New *UserInfo `json:"new"`
- }
- type UserInfo struct {
- MID int64 `json:"mid"`
- Uname string `json:"uname"`
- UserID string `json:"userid"`
- }
- type GenWatermark struct {
- Location string `json:"location"`
- MD5 string `json:"md5"`
- Width int `json:"width"`
- Height int `json:"height"`
- }
|