model

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//GfFacialIdentifyDisable -
	GfFacialIdentifyDisable = "0"
	//GfFacialIdentifyEnable -
	GfFacialIdentifyEnable = "1"
	//TemperatureNone -
	TemperatureNone = "NONE"
	//TemperatureCelsius -
	TemperatureCelsius = "C"
	//TemperatureFahrenheit -
	TemperatureFahrenheit = "F"
)
View Source
const (
	DutyTypeHoliDay = iota
	DutyTypeWorkDay
	DutyTypeManPower
	DutyTypeWorkDayAndManPower
)

DutyType define

View Source
const (
	//FaceLogStatusFail -
	FaceLogStatusFail = -1
	//FaceLogStatusInit -
	FaceLogStatusInit = 0
	//FaceLogStatusOK -
	FaceLogStatusOK = 1
)
View Source
const (
	FormStatusReject = iota - 1
	FormStatusNone
	FormStatusDone
	CategoryCheckIn      = "checkin"
	CategoryCheckOut     = "checkout"
	FormColorNone        = "0"
	FormColorGray        = "1"
	FormCreatorRoleStaff = "staff"
	FormCreatorRoleAdmin = "admin"
)

const -

View Source
const (
	//MemberRoleStaff -
	MemberRoleStaff = "staff"
	//MemberRoleAdmin -
	MemberRoleAdmin = "admin"
	//MemberRoleCustomer -
	MemberRoleCustomer = "customer"
)
View Source
const (
	//ReportStatusRed ...
	ReportStatusRed = "-1"
	//ReportStatusNone ...
	ReportStatusNone = "0"
	//ReportStatusGreen ...
	ReportStatusGreen = "1"
)
View Source
const (
	EODFalse = 0
	EODTrue  = 1

	CheckInNext  = "checkin_next"
	CheckOutNext = "checkout_next"
)

EOD FLAG Define -

View Source
const (
	RosterDayNotOpen              = "-1"
	RosterDayNone                 = "0"
	RosterDayWork                 = "1"
	RosterDayWorkAccept           = "2"
	RosterDayWorkAcceptNotRelease = "3"
	RosterDayoff                  = "4"
)

RosterDay define

View Source
const (
	ManPowerNone = "0"
	ManPowerGray = "1"
	ManPowerBlue = "2"
	ManPowerRed  = "3"
)

ManPower Color Define -

View Source
const (
	ShiftTypePast = iota
	ShiftTypeCurrent
	ShiftTypeNext
)

Shift Type Define -

View Source
const (
	//SNSTypeGoogle -
	SNSTypeGoogle = "google"
	//SNSTypeApple -
	SNSTypeApple = "apple"
	//SNSTypeCustom -
	SNSTypeCustom = "custom"
)

Variables

View Source
var (
	//DB DB Client
	DB *gorm.DB

	//RedisPool Redis Pool
	RedisPool *redis.Pool
)

Functions

func CheckCustomerAccountExists

func CheckCustomerAccountExists(account string) (e bool)

CheckCustomerAccountExists -

func CheckCustomerEmailExists

func CheckCustomerEmailExists(email string) (e bool)

CheckCustomerEmailExists -

func CheckEmployeeID

func CheckEmployeeID(cid, employeeID string) (r bool, err error)

CheckEmployeeID -

func CheckMemberSNSLinkExists

func CheckMemberSNSLinkExists(cid, mid string) (b bool, err error)

CheckMemberSNSLinkExists -

func CheckSNSLinkExists

func CheckSNSLinkExists(cid, userID string) (b bool, err error)

CheckSNSLinkExists -

func CheckUserExists

func CheckUserExists(userID string) (exists bool)

CheckUserExists -

func CreateAccessToken

func CreateAccessToken(u *User) (token string, err error)

CreateAccessToken -

func CreateMemberReportMonthly

func CreateMemberReportMonthly(cid, day string) (err error)

CreateMemberReportMonthly -

func DeleteAccessToken

func DeleteAccessToken(token string) (res int, err error)

DeleteAccessToken -

func DeleteCustomLink(cid, mid string) (err error)

DeleteCustomLink - 若 sns = custom, 則移除 table::user 與 table::user_member_link 資料

func DeleteSNSLink(cid, mid string) (err error)

DeleteSNSLink -

func ExtendAccessToken

func ExtendAccessToken(u *User, token string) (err error)

ExtendAccessToken -

func FetchCustomerMembersMap

func FetchCustomerMembersMap(cid string) (membersMap map[string]Member, err error)

FetchCustomerMembersMap -

func FetchMemberCount

func FetchMemberCount(cid string) (count int)

FetchMemberCount -

func GetAccessToken

func GetAccessToken(token string) (res map[string]string, err error)

GetAccessToken -

func GetCustomerGroupMemberMap

func GetCustomerGroupMemberMap(cid string) (groupsMap map[string]*GroupResult, err error)

GetCustomerGroupMemberMap - 取得 cid 下 member_group 中的資訊

func GetCustomerTodayPunchMemberIDs

func GetCustomerTodayPunchMemberIDs(customerID, timezone string) (memberIDs []string, err error)

GetCustomerTodayPunchMemberIDs -

func GetFormStatusNoneCount

func GetFormStatusNoneCount(cid string, memberIDs []string) (count int, err error)

GetFormStatusNoneCount -

func GetGroupMemberMap

func GetGroupMemberMap(cid string, gIDs []string) (memberIDs []string, groupsMap map[string]string, err error)

GetGroupMemberMap -

func GetGroupsMemberIDs

func GetGroupsMemberIDs(cid, mid string) (memberIDs []string, err error)

GetGroupsMemberIDs -

func GetPairCode

func GetPairCode(code string) (userID string, err error)

GetPairCode -

func ReplaceRosterData

func ReplaceRosterData(cid, sid, mid, startDay, endDay string, days []string) (err error)

ReplaceRosterData -

func SetL10n

func SetL10n()

func SetPairCode

func SetPairCode(code, userID string, pairTokenExpire int) (err error)

SetPairCode -

func Start

func Start()

Start Init

Types

type Category

type Category string

Category -

const (
	//CategoryCheckin -
	CategoryCheckin Category = "checkin"
	//CategoryCheckout -
	CategoryCheckout Category = "checkout"
)

type Contract

type Contract struct {
	ID         uint64
	CustomerID string
	PackageID  string `gorm:"column:pkg_id"`
	StartDate  time.Time
	EndDate    time.Time
	OriginFee  int
	Fee        int
	Applied    int
	InvoiceNo  string
	Memo       string
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

Contract -

func (*Contract) Create

func (c *Contract) Create() error

Create -

func (Contract) TableName

func (Contract) TableName() string

TableName -

type Customer

type Customer struct {
	ID               uint64
	CustomerID       string
	Account          string
	Passwd           string
	Email            string
	Language         string
	Timezone         string
	Name             string
	Category         int `gorm:"column:category"`
	MemberLimit      int `gorm:"column:member_limit"`
	DailyPunchLimit  int `gorm:"daily_punch_limit"`
	GfFacialIdentify int
	CustomLogin      int
	EmailNotify      int    `gorm:"email_notify"` // 0: 不寄送, 1: 寄送
	CollectionID     string `gorm:"column:collection_id"`
	RingCount        int
	RosterConfigJSON json.RawMessage `gorm:"column:roster_config"`
	RosterConfig     RosterConfig    `gorm:"-"`
	HourOffset       int             `gorm:"column:hour_offset"`
	WageEnable       int
	TemperatureUnit  string `gorm:"column:temperature_unit"`
	Tel              string
	MemberFaceLimit  int
	ContractStartAt  time.Time `gorm:"column:contract_start_at"`
	ContractEndAt    time.Time `gorm:"column:contract_end_at"`
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

Customer -

func (*Customer) Create

func (c *Customer) Create() error

Create -

func (*Customer) CreateCustomerFlow

func (c *Customer) CreateCustomerFlow(userID string, member *Member, group *Group) (t time.Time, err error)

CreateCustomerFlow -

func (*Customer) Delete

func (c *Customer) Delete() error

Delete -

func (*Customer) GetByConditionWithRoster

func (c *Customer) GetByConditionWithRoster() (err error)

GetByConditionWithRoster -

func (*Customer) GetBySt

func (c *Customer) GetBySt() error

GetBySt -

func (Customer) TableName

func (Customer) TableName() string

TableName -

func (*Customer) Update

func (c *Customer) Update(val interface{}) int64

Update -

type Customers

type Customers []Customer

Customers -

func (*Customers) GetByInterface

func (cs *Customers) GetByInterface(val interface{}) error

GetByInterface -

type DEVICE

type DEVICE struct {
	ID            uint64    `gorm:"column:id"`
	CustomerID    string    `gorm:"column:customer_id"`
	DeviceID      string    `gorm:"column:device_id"`
	DeviceType    string    `gorm:"column:device_type"`
	Model         string    `gorm:"column:model"`
	Name          string    `gorm:"column:name"`
	Timezone      string    `gorm:"column:timezone"`
	FaceDevice    int       `gorm:"column:face_device"`
	FaceThreshold int       `gorm:"column:face_threshold"`
	CreatedAt     time.Time `gorm:"column:created_at"`
	UpdatedAt     time.Time `gorm:"column:updated_at"`
}

func (*DEVICE) Create

func (device *DEVICE) Create() error

Create -

func (*DEVICE) GetDeviceByDeviceID

func (device *DEVICE) GetDeviceByDeviceID(cid, did string) error

Get Device By Device ID

func (DEVICE) TableName

func (DEVICE) TableName() string

TableName -

type DEVICES

type DEVICES []DEVICE

func (*DEVICES) GetAllByCustomIDWithPageAndSize

func (devices *DEVICES) GetAllByCustomIDWithPageAndSize(cid string, status, page, size int) error

GetByCustomID -

func (*DEVICES) GetAllByCustomerID

func (devices *DEVICES) GetAllByCustomerID(cid string) error

type Dayoff

type Dayoff struct {
	ID         uint64
	CustomerID string
	OffDay     time.Time
	OffName    string
	OnDutyJSON json.RawMessage   `gorm:"column:on_duty"`
	OnDuty     map[string]string `gorm:"-"`
	DutyType   int
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

Dayoff -

func (*Dayoff) DecodeOnDuty

func (df *Dayoff) DecodeOnDuty() (err error)

DecodeOnDuty -

func (*Dayoff) GetByCondition

func (df *Dayoff) GetByCondition() error

GetByCondition -

func (Dayoff) TableName

func (Dayoff) TableName() string

TableName -

type Dayoffs

type Dayoffs []Dayoff

Dayoffs -

func (*Dayoffs) GetByCondition

func (dfs *Dayoffs) GetByCondition(df Dayoff) error

GetByCondition -

func (*Dayoffs) GetManPowerList

func (dfs *Dayoffs) GetManPowerList(cid, startDay, endDay string) (err error)

GetManPowerList -

func (*Dayoffs) GetOffDayList

func (dfs *Dayoffs) GetOffDayList(cid, startDay, endDay string) (err error)

GetOffDayList -

type DeviceFaceLog

type DeviceFaceLog struct {
	ID         uint64
	IdentifyID string
	CustomerID string
	DeviceID   string
	MemberID   string
	ImageURL   string
	Status     int
	Action     string
	LocalAt    *time.Time
	Confidence float64
	RemoteIP   string
	ExpiredAt  int64
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

DeviceFaceLog -

func (*DeviceFaceLog) Create

func (dfl *DeviceFaceLog) Create() error

Create -

func (*DeviceFaceLog) GetBySt

func (dfl *DeviceFaceLog) GetBySt() error

GetBySt -

func (DeviceFaceLog) TableName

func (DeviceFaceLog) TableName() string

TableName -

func (*DeviceFaceLog) Update

func (dfl *DeviceFaceLog) Update(val interface{}) int64

Update -

type Form

type Form struct {
	ID             uint64
	FormID         string
	CustomerID     string
	MemberID       string
	ReportID       string
	DeviceName     string `gorm:"column:device_name"`
	Category       string
	LocalApplyDay  time.Time
	LocalApplyHour string
	Remark         string
	AttachmentURL  string
	GPS            json.RawMessage
	AdminMemberID  string
	Message        string
	ReviewTime     time.Time
	CreatorRole    string `sql:"not null;type:ENUM('staff', 'admin')"`
	Status         int
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

Form -

func (*Form) Create

func (s *Form) Create() error

Create -

func (*Form) Delete

func (s *Form) Delete() error

Delete -

func (*Form) GetAttachmentURL

func (s *Form) GetAttachmentURL() (signURL string)

GetAttachmentURL -

func (*Form) GetBySt

func (s *Form) GetBySt() error

GetBySt -

func (*Form) GetCheckStatus

func (s *Form) GetCheckStatus() string

GetCheckStatus -

func (*Form) GetGPSData

func (s *Form) GetGPSData() (g GPSInfo)

GetGPSData -

func (*Form) GetLocalApplyTime

func (s *Form) GetLocalApplyTime() string

GetLocalApplyTime -

func (*Form) GetRawLocalApplyTime

func (s *Form) GetRawLocalApplyTime() string

GetRawLocalApplyTime -

func (*Form) GetReportedForm

func (s *Form) GetReportedForm(withinDate time.Time) error

GetReportedForm -

func (Form) TableName

func (Form) TableName() string

TableName -

func (*Form) Update

func (s *Form) Update(val interface{}) error

Update -

type Forms

type Forms []Form

Forms -

func (*Forms) GetByCustomID

func (fs *Forms) GetByCustomID(cid string, memberIDs []string, status, page, size int, afterTime time.Time) (count int, err error)

GetByCustomID - - afterTime: 指定日期, 取得該日期後的資料

func (*Forms) GetByInterface

func (fs *Forms) GetByInterface(val interface{}) error

GetByInterface -

func (*Forms) GetByInterfaceOrderID

func (fs *Forms) GetByInterfaceOrderID(val interface{}) error

GetByInterfaceOrderID -

type GPSInfo

type GPSInfo struct {
	Latitude  string `json:"latitude"`
	Longitude string `json:"longitude"`
}

GPSInfo -

type Geometry

type Geometry struct {
	X, Y float64
}

Geometry - 此為 mysql 欄位類行為 Geometry - 因為 gorm 不支援此類型 - 故自定義此類型

func (Geometry) GormDataType

func (loc Geometry) GormDataType() string

func (Geometry) GormValue

func (loc Geometry) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (*Geometry) Scan

func (loc *Geometry) Scan(v interface{}) error

Scan implements the sql.Scanner interface

type Group

type Group struct {
	ID            uint64
	CustomerID    string
	GroupID       string
	Name          string
	ParentGroupID string
	BufferEnable  int
	Buffer        int
	Boundary      int      `gorm:"default:0"` // 0=disable, 1=limited, 2=same as root
	Distance      int      `gorm:"default:0"`
	Coordinate    Geometry `gorm:"default:'GeomFromText('POINT(0 0)')'"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

Group -

func (*Group) CreateGruop

func (g *Group) CreateGruop() error

建立 customer 底下的 group

func (*Group) GetDistance

func (g *Group) GetDistance(clientLon, clientLat float64) (distant float64, err error)

計算距離

func (*Group) GetGroupInfo

func (g *Group) GetGroupInfo(cid, gid string) (err error)

func (Group) TableName

func (Group) TableName() string

TableName -

type GroupResult

type GroupResult struct {
	AdminMemberIDs []string
	StaffMemberIDs []string
}

GroupResult -

type Groups

type Groups []Group

Groups -

func (*Groups) GetList

func (gs *Groups) GetList(cid string) (err error)

GetList -

func (*Groups) GetListOrderByIDDESC

func (gs *Groups) GetListOrderByIDDESC(cid string) (err error)

GetListOrderByIDDESC -

type MRHGPS

type MRHGPS struct {
	Latitude        string `json:"latitude"`
	Longitude       string `json:"longitude"`
	DefineDistance  string `json:"define_distance"`
	CenterLatitude  string `json:"center_latitude"`
	CenterLongitude string `json:"center_longitude"`
}

func NewMRHGPS

func NewMRHGPS() *MRHGPS

func (*MRHGPS) Format

func (obj *MRHGPS) Format(gps json.RawMessage) (formated MRHGPS)

因資料庫資料凌亂, 雇用此方法統一格式輸出

type Member

type Member struct {
	ID         uint64
	CustomerID string
	MemberID   string
	Name       string
	EmployeeID string
	AvatarURL  string
	Role       RoleEnum `sql:"type:ENUM('admin', 'staff')"`
	Category   int
	Tel        string
	Leave      int
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

Member -

func (*Member) Create

func (s *Member) Create() error

Create -

func (*Member) Delete

func (s *Member) Delete() error

Delete -

func (*Member) GetAvatarURL

func (s *Member) GetAvatarURL() string

GetAvatarURL -

func (*Member) GetBySt

func (s *Member) GetBySt() error

GetBySt -

func (*Member) GetJoinedAt

func (s *Member) GetJoinedAt(timezone string) (at string)

GetJoinedAt -

func (*Member) IsAdmin

func (s *Member) IsAdmin() bool

IsAdmin -

func (Member) TableName

func (Member) TableName() string

TableName -

func (*Member) Update

func (s *Member) Update(val interface{}) int64

Update -

type MemberAndMemberGroup

type MemberAndMemberGroup struct {
	MemberID string
	Name     string
	GroupID  string
	Role     RoleEnum `sql:"type:ENUM('admin', 'staff')"`
}

Member 與 MemberGroup 的物件集合

type MemberFace

type MemberFace struct {
	ID         uint64
	CustomerID string
	MemberID   string
	MFID       string `gorm:"column:mf_id"`
	FaceID     string
	AvatarURL  string
	IsDefault  bool
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

Member Face -

func (*MemberFace) Create

func (mf *MemberFace) Create() error

Create -

func (*MemberFace) Delete

func (mf *MemberFace) Delete() error

Delete -

func (*MemberFace) GetAllMemberFaces

func (mf *MemberFace) GetAllMemberFaces(cid, mid string) ([]MemberFace, error)

func (*MemberFace) GetBySt

func (mf *MemberFace) GetBySt() error

GetBySt -

func (*MemberFace) GetFaceCount

func (mf *MemberFace) GetFaceCount(cid, mid string) (count int)

func (MemberFace) TableName

func (MemberFace) TableName() string

TableName -

func (*MemberFace) Update

func (mf *MemberFace) Update(val interface{}) int64

Update -

type MemberFaces

type MemberFaces []MemberFace

type MemberGroup

type MemberGroup struct {
	ID         uint64
	MemberID   string
	CustomerID string
	GroupID    string
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

MemberGroup -

func (*MemberGroup) Create

func (mg *MemberGroup) Create() error

Create -

func (*MemberGroup) GetBySt

func (mg *MemberGroup) GetBySt() error

func (MemberGroup) TableName

func (MemberGroup) TableName() string

TableName -

type MemberGroupResult

type MemberGroupResult struct {
	GroupID       string
	Name          string
	ParentGroupID string
}

MemberGroupResult -

func GetMemberGroups

func GetMemberGroups(cid, mid string) (results []MemberGroupResult, err error)

GetMemberGroups -

type MemberGroups

type MemberGroups []MemberGroup

MemberGroups -

func (*MemberGroups) GetAllByCID

func (mgs *MemberGroups) GetAllByCID(cid string) error

GetAllByGID - 透過 CID 取得所有資料

func (*MemberGroups) GetAllByGID

func (mgs *MemberGroups) GetAllByGID(cid, gid string) error

GetAllByGID - 透過 GID 取得所有資料

func (*MemberGroups) GetAllMemberAndGroupInfo

func (mgs *MemberGroups) GetAllMemberAndGroupInfo(cid string) []MemberAndMemberGroup

取得 cid 下, 所有 member 與 group 的資訊

func (*MemberGroups) GetMemberGroups

func (mgs *MemberGroups) GetMemberGroups(cid, mid string) error

GetMemberGroups - 取得該 member 的所有 member_group 資訊

func (*MemberGroups) GetMemberIDsInGroupIDsAndGroupByMID

func (mgs *MemberGroups) GetMemberIDsInGroupIDsAndGroupByMID(cid string, gids []string) ([]string, error)

GetMemberIDsInGroupIDsAndGroupByMID - 取得 member IDs IN group_ids, 且 group by MemberID

type MemberReportHistory

type MemberReportHistory struct {
	ID              uint64
	CustomerID      string
	ReportID        string
	MemberID        string
	Role            string `sql:"not null;type:ENUM('staff', 'admin', 'customer')"`
	LocalCheckinAt  string `sql:"default:null"`
	LocalCheckoutAt string `sql:"default:null"`
	Discard         int
	FormID          string
	Title           string
	GPS             json.RawMessage
	Temperature     *float64 `gorm:"column:temperature"`
	RawDataID       uint64   `gorm:"column:rawdata_id"`
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

MemberReportHistory -

func (*MemberReportHistory) Create

func (s *MemberReportHistory) Create() error

Create -

func (*MemberReportHistory) Delete

func (s *MemberReportHistory) Delete() error

Delete -

func (*MemberReportHistory) GetBySt

func (s *MemberReportHistory) GetBySt() error

GetBySt -

func (*MemberReportHistory) GetCategory

func (s *MemberReportHistory) GetCategory() string

GetCategory -

func (*MemberReportHistory) GetCheckTime

func (s *MemberReportHistory) GetCheckTime() string

GetCheckTime -

func (*MemberReportHistory) GetLocalCheckinAt

func (s *MemberReportHistory) GetLocalCheckinAt() string

GetLocalCheckinAt -

func (*MemberReportHistory) GetLocalCheckoutAt

func (s *MemberReportHistory) GetLocalCheckoutAt() string

GetLocalCheckoutAt -

func (MemberReportHistory) TableName

func (MemberReportHistory) TableName() string

TableName -

func (*MemberReportHistory) Update

func (s *MemberReportHistory) Update(val interface{}) int64

Update -

type MemberReportHistorys

type MemberReportHistorys []MemberReportHistory

MemberReportHistorys -

func (*MemberReportHistorys) GetByInterface

func (s *MemberReportHistorys) GetByInterface(val interface{}) error

GetByInterface -

func (MemberReportHistorys) Len

func (s MemberReportHistorys) Len() int

Len -

func (MemberReportHistorys) Less

func (s MemberReportHistorys) Less(i, j int) bool

Less -

func (*MemberReportHistorys) OrderByTime

func (s *MemberReportHistorys) OrderByTime()

OrderByTime -

func (MemberReportHistorys) Swap

func (s MemberReportHistorys) Swap(i, j int)

Swap -

type MemberReportMonthly

type MemberReportMonthly struct {
	ID              uint64
	CustomerID      string
	ReportID        string
	MemberID        string
	LocalReportDay  time.Time
	LocalCheckinAt  string `sql:"default:null"`
	LocalCheckoutAt string `sql:"default:null"`
	WorkingHour     string
	RealWorkingHour float64 `gorm:"-"`
	PaidHour        string
	PaidDetail      json.RawMessage
	EarnWage        string
	ModifyFlag      int
	Name            string `gorm:"-"`
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

MemberReportMonthly -

func (*MemberReportMonthly) Create

func (s *MemberReportMonthly) Create() error

Create ...

func (*MemberReportMonthly) Delete

func (s *MemberReportMonthly) Delete() error

Delete ...

func (*MemberReportMonthly) GetBySt

func (s *MemberReportMonthly) GetBySt() error

GetBySt ...

func (*MemberReportMonthly) GetCountInMonth

func (s *MemberReportMonthly) GetCountInMonth(mid string, mon time.Time) (count int)

GetCountInMonth -

func (*MemberReportMonthly) GetLocalCheckinAt

func (s *MemberReportMonthly) GetLocalCheckinAt() string

GetLocalCheckinAt -

func (*MemberReportMonthly) GetLocalCheckoutAt

func (s *MemberReportMonthly) GetLocalCheckoutAt() string

GetLocalCheckoutAt -

func (*MemberReportMonthly) Status

func (s *MemberReportMonthly) Status() string

- Status - 判斷 member report monthly 中, 是否上下班都『已』打卡 - 上下班都沒打卡 = ReportStatusNone - 上下班都打卡 = ReportStatusGreen - 上下班其一打卡 = ReportStatusRed

func (MemberReportMonthly) TableName

func (MemberReportMonthly) TableName() string

TableName ...

func (*MemberReportMonthly) Update

func (s *MemberReportMonthly) Update(val interface{}) int64

Update ...

func (*MemberReportMonthly) Weekday

func (s *MemberReportMonthly) Weekday() string

Weekday ...

func (*MemberReportMonthly) WorkingHours

func (s *MemberReportMonthly) WorkingHours() string

WorkingHours ...

type MemberReportMonthlys

type MemberReportMonthlys []MemberReportMonthly

MemberReportMonthlys -

func (*MemberReportMonthlys) GetByInMonth

func (s *MemberReportMonthlys) GetByInMonth(mid string, mon time.Time) error

GetByInMonth -

func (*MemberReportMonthlys) GetByInterface

func (s *MemberReportMonthlys) GetByInterface(val interface{}) error

GetByInterface -

func (*MemberReportMonthlys) GetByInterfaceJoinMember

func (s *MemberReportMonthlys) GetByInterfaceJoinMember(val interface{}, memberIDs []string) error

GetByInterfaceJoinMember -

type MemberReportRawData

type MemberReportRawData struct {
	ID                 uint64
	MemberID           string
	HistoryMemberID    string    `gorm:"column:history_member_id"`
	Role               string    `sql:"not null;type:ENUM('staff', 'admin', 'customer')"`
	Action             string    `sql:"not null;type:ENUM('checkin', 'checkout')"`
	LocalAt            time.Time `gorm:"column:local_at"`
	EOD                int       `gorm:"column:eod"`
	Discard            int
	FormID             string
	Memo               string
	Title              string
	GPS                json.RawMessage
	Temperature        *float64 `gorm:"column:temperature"`
	CreatedAt          time.Time
	UpdatedAt          time.Time
	CustomerHourOffset int `gorm:"-"`
}

MemberReportRawData -

func (*MemberReportRawData) Create

func (r *MemberReportRawData) Create() error

Create -

func (*MemberReportRawData) GetBySt

func (r *MemberReportRawData) GetBySt() error

GetBySt ...

func (MemberReportRawData) TableName

func (MemberReportRawData) TableName() string

TableName -

func (*MemberReportRawData) Update

func (r *MemberReportRawData) Update(val interface{}) int64

Update ...

type Members

type Members []Member

Members -

func (*Members) GetAllMembers

func (s *Members) GetAllMembers(cid string) error

func (*Members) GetByCustomerID

func (s *Members) GetByCustomerID(members []string, customer string) error

GetByCustomerID -

func (*Members) GetByInterface

func (s *Members) GetByInterface(val interface{}) error

GetByInterface -

func (*Members) GetNotLeaveMembers

func (s *Members) GetNotLeaveMembers(cid string) error

GetNotLeaveMembers -

type MobileDeviceToken

type MobileDeviceToken struct {
	ID                    uint64
	User_id               string
	Token                 string
	Sns_platform_endpoint string
	Language              string
	UpdatedAt             time.Time
	CreatedAt             time.Time
}

MobileDeviceToken -

func (*MobileDeviceToken) Create

func (m *MobileDeviceToken) Create() error

Create -

func (*MobileDeviceToken) Delete

func (m *MobileDeviceToken) Delete() error

Delete -

func (*MobileDeviceToken) Get

func (m *MobileDeviceToken) Get(userID, token string) error

Get -

func (*MobileDeviceToken) GetUserEndpoints

func (m *MobileDeviceToken) GetUserEndpoints(userID string) ([]MobileDeviceToken, error)

GetUserEndpoints -

func (*MobileDeviceToken) GetUserEndpointsByMemberID

func (m *MobileDeviceToken) GetUserEndpointsByMemberID(customerID, memberID string) ([]MobileDeviceToken, error)

GetUserEndpointsByMemberID -

func (MobileDeviceToken) TableName

func (MobileDeviceToken) TableName() string

TableName -

func (*MobileDeviceToken) Update

func (m *MobileDeviceToken) Update(val interface{}) int64

Update -

type Notification

type Notification struct {
	ID         uint64
	CustomerID string
	MemberID   string
	Class      string
	Source     string
	Field      json.RawMessage
	ExpiredAT  int64
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

Notification -

func (*Notification) Create

func (s *Notification) Create() error

Create -

func (*Notification) CreateNotify

func (s *Notification) CreateNotify(notify interface{}, cid, mid, class, source string) (err error)

CreateNotify -

func (*Notification) Delete

func (s *Notification) Delete() error

Delete -

func (*Notification) GetBySt

func (s *Notification) GetBySt() error

GetBySt -

func (Notification) TableName

func (Notification) TableName() string

TableName -

func (*Notification) Update

func (s *Notification) Update(val interface{}) int64

Update -

type Notifications

type Notifications []Notification

Notifications -

func (*Notifications) GetByInterfaceCount

func (ns *Notifications) GetByInterfaceCount(n interface{}, page, pagesize int, rosterEnable string, afterTime time.Time, role RoleEnum) (count int, err error)

GetByInterfaceCount - - afterTime: 指定日期, 取得該日期後的資料

type Package

type Package struct {
	ID              uint64
	PkgID           string `gorm:"column:pkg_id"`
	Name            string
	DailyPunchLimit int `gorm:"daily_punch_limit"`
	Member          int
	MemberFaceLimit int
	Period          int
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

Package -

func (*Package) GetByCondition

func (p *Package) GetByCondition() error

GetByCondition -

func (Package) TableName

func (Package) TableName() string

TableName -

type RoleEnum

type RoleEnum string

RoleEnum -

const (
	//RoleAdmin -
	RoleAdmin RoleEnum = "admin"
	//RoleStaff -
	RoleStaff RoleEnum = "staff"
)

type Roster

type Roster struct {
	ID            uint64
	CustomerID    string
	LocalDutyDate time.Time
	ShiftID       string
	MemberID      string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

Roster -

func (*Roster) Create

func (rt *Roster) Create() error

Create -

func (*Roster) GetByCondition

func (rt *Roster) GetByCondition() error

GetByCondition -

func (Roster) TableName

func (Roster) TableName() string

TableName -

type RosterConfig

type RosterConfig struct {
	EndDay        string `json:"end_day"`
	WorkDay       []int  `json:"work_day"`
	RosterEnable  string `json:"roster_enable"`
	SendNotifyDay string `json:"send_notify_day"`
	RosterStarDay string `json:"roster_start_day"`
}

RosterConfig -

type Rosters

type Rosters []Roster

Rosters -

func (*Rosters) Delete

func (rts *Rosters) Delete(cid, sid, mid, startDay, endDay string) error

Delete -

func (*Rosters) GetByCondition

func (rts *Rosters) GetByCondition(r Roster) error

GetByCondition -

func (*Rosters) GetByInterface

func (rts *Rosters) GetByInterface(val interface{}) error

GetByInterface -

func (*Rosters) GetDateList

func (rts *Rosters) GetDateList(cid, startDay, endDay string) (err error)

GetDateList -

type SendEmailData

type SendEmailData struct {
	UserName   string
	UserEmail  string
	MemberName string
}

type SendEmailDatas

type SendEmailDatas []SendEmailData

func (*SendEmailDatas) GetSendEmailDatasByMIDs

func (seds *SendEmailDatas) GetSendEmailDatasByMIDs(cid string, mids []string) (err error)

type Shift

type Shift struct {
	ID         uint64
	ShiftID    string
	CustomerID string
	ShiftType  int
	Name       string
	StartTime  string
	EndTime    string
	Manpower   int
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

Shift -

func (*Shift) GetByCondition

func (s *Shift) GetByCondition() error

GetByCondition -

func (Shift) TableName

func (Shift) TableName() string

TableName -

type Shifts

type Shifts []Shift

Shifts -

func (*Shifts) FetchCustomerCurrentShifts

func (sfs *Shifts) FetchCustomerCurrentShifts(cid string) (err error)

FetchCustomerCurrentShifts -

func (*Shifts) FetchCustomerMonthShifts

func (sfs *Shifts) FetchCustomerMonthShifts(cid, dutyMonth string) (err error)

FetchCustomerMonthShifts -

func (*Shifts) GetByCondition

func (sfs *Shifts) GetByCondition(s Shift) error

GetByCondition -

type USERS

type USERS []User

func (*USERS) GetAllByUIDs

func (users *USERS) GetAllByUIDs(uids []string) error

GetAllByUIDs - 透過 uids 取得所有資料

type UpdateRosterMembers

type UpdateRosterMembers struct {
	Cid        string
	Sid        string
	Day        time.Time
	AddMembers []string
	DelMembers []string
	Rosters    Rosters
	Members    Members
}

UpdateRosterMembers -

func (*UpdateRosterMembers) UpdateRosterShiftMembers

func (urm *UpdateRosterMembers) UpdateRosterShiftMembers() error

UpdateRosterShiftMembers -

type User

type User struct {
	ID           uint64
	Sns          string
	SnsUID       string
	UserID       string
	Name         string
	Email        string
	Picture      string
	EternalToken int
	Password     string `gorm:"column:passwd"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

User -

func (*User) CheckPassWord

func (s *User) CheckPassWord(passwd string) (isMatch bool)

CheckPassWord -

func (*User) Create

func (s *User) Create() error

Create -

func (*User) Delete

func (s *User) Delete() error

Delete -

func (*User) FetchCustomUserByMemberID

func (s *User) FetchCustomUserByMemberID(cid, memberID string) (err error)

FetchCustomUserByMemberID -

func (*User) FetchSigninCustomUser

func (s *User) FetchSigninCustomUser(cid, employeeID string) (err error)

FetchSigninCustomUser -

func (*User) GetBySt

func (s *User) GetBySt() error

GetBySt -

func (*User) IsRegisterCustomerByEmail

func (s *User) IsRegisterCustomerByEmail() (e string)

IsRegisterCustomerByEmail -

func (User) TableName

func (User) TableName() string

TableName -

func (*User) Update

func (s *User) Update(val interface{}) int64

Update -

func (*User) UseEternalToken

func (s *User) UseEternalToken() (r bool)

UseEternalToken -

type UserMemberLink struct {
	ID          uint64
	UserID      string
	CustomerID  string
	MemberID    string
	NotifyCount int
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

UserMemberLink -

func (*UserMemberLink) Create

func (s *UserMemberLink) Create() error

Create -

func (*UserMemberLink) Delete

func (s *UserMemberLink) Delete() error

Delete -

func (*UserMemberLink) GetBySt

func (s *UserMemberLink) GetBySt() error

GetBySt -

func (*UserMemberLink) IncrNotifyCnt

func (s *UserMemberLink) IncrNotifyCnt() error

IncrNotifyCnt - 如 member 有更新資料, 則增加 count ex: - UpdateForm - CreateReportRecord - MemberUpdate - UpdateRosterShiftMembers - UpdateRosterShiftMembers - UpdateRosterShiftMembers

func (UserMemberLink) TableName

func (UserMemberLink) TableName() string

TableName -

func (*UserMemberLink) Update

func (s *UserMemberLink) Update(val interface{}) int64

Update -

type UserMemberLinks []UserMemberLink

UserMemberLinks -

func (*UserMemberLinks) GetAllByMIDs

func (umls *UserMemberLinks) GetAllByMIDs(cid string, mids []string) error

GetAllByMIDs - 透過 mids 取得所有資料

func (*UserMemberLinks) GetAllByUIDs

func (umls *UserMemberLinks) GetAllByUIDs(cid string, uids []string) error

GetAllByMIDs - 透過 mids 取得所有資料

func (*UserMemberLinks) GetByInterface

func (s *UserMemberLinks) GetByInterface(val interface{}) error

GetByInterface -

Jump to

Keyboard shortcuts

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