From 0eb7d69a16975216bc66a9ae2d5a673abead2bcd Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 7 Sep 2018 16:33:37 +0800 Subject: [PATCH] update schema model --- model/commands.go | 12 ++++++++++++ model/donate_setting.go | 17 +++++++++++++++++ model/facebook_page.go | 11 +++++++++++ model/key_commands.go | 12 ++++++++++++ model/line_group.go | 13 +++++++++++++ model/opay_donate_list.go | 13 +++++++++++++ model/rt_table.go | 20 ++++++++++++++++++++ model/twitch_channel.go | 14 ++++++++++++++ router/api/api.go | 9 +++++++++ 9 files changed, 121 insertions(+) create mode 100644 model/commands.go create mode 100644 model/donate_setting.go create mode 100644 model/facebook_page.go create mode 100644 model/key_commands.go create mode 100644 model/line_group.go create mode 100644 model/opay_donate_list.go create mode 100644 model/rt_table.go create mode 100644 model/twitch_channel.go diff --git a/model/commands.go b/model/commands.go new file mode 100644 index 0000000..525ccfe --- /dev/null +++ b/model/commands.go @@ -0,0 +1,12 @@ +package model + +import "time" + +// Commands - struct +type Commands struct { + Cmd string `db:"cmd" cc:"cmd"` + Message string `db:"message" cc:"message"` + Group string `db:"group" cc:"group"` + Ctime time.Time `db:"ctime" cc:"ctime"` + Mtime time.Time `db:"mtime" cc:"ctime"` +} diff --git a/model/donate_setting.go b/model/donate_setting.go new file mode 100644 index 0000000..74a317e --- /dev/null +++ b/model/donate_setting.go @@ -0,0 +1,17 @@ +package model + +import ( + "time" +) + +// DonateSetting - struct +type DonateSetting struct { + Twitch string `db:"twitch" cc:"twitch"` + StartDate time.Time `db:"start_date" cc:"start_date"` + EndDate time.Time `db:"end_date" cc:"end_date"` + TargetAmount int `db:"target_amount" cc:"target_amount"` + Title string `db:"title" cc:"title"` + Type string `db:"type" cc:"type"` + Ctime time.Time `db:"ctime" cc:"ctime"` + Mtime time.Time `db:"mtime" cc:"ctime"` +} diff --git a/model/facebook_page.go b/model/facebook_page.go new file mode 100644 index 0000000..4db670b --- /dev/null +++ b/model/facebook_page.go @@ -0,0 +1,11 @@ +package model + +import "time" + +// FacebookPage - struct +type FacebookPage struct { + ID string `db:"id" cc:"id"` + LastPost string `db:"lastpost" cc:"lastpost"` + Ctime time.Time `db:"ctime" cc:"ctime"` + Mtime time.Time `db:"mtime" cc:"ctime"` +} diff --git a/model/key_commands.go b/model/key_commands.go new file mode 100644 index 0000000..cc8b536 --- /dev/null +++ b/model/key_commands.go @@ -0,0 +1,12 @@ +package model + +import "time" + +// KeyCommands - struct +type KeyCommands struct { + Key string `db:"key" cc:"key"` + Group string `db:"group" cc:"group"` + Message string `db:"message" cc:"message"` + Ctime time.Time `db:"ctime" cc:"ctime"` + Mtime time.Time `db:"mtime" cc:"ctime"` +} diff --git a/model/line_group.go b/model/line_group.go new file mode 100644 index 0000000..2ff0a89 --- /dev/null +++ b/model/line_group.go @@ -0,0 +1,13 @@ +package model + +import "time" + +// LineGroup - struct +type LineGroup struct { + ID string `db:"id" cc:"id"` + Name string `db:"name" cc:"name"` + Notify bool `db:"notify" cc:"notify"` + Owner string `db:"owner" cc:"owner"` + Ctime time.Time `db:"ctime" cc:"ctime"` + Mtime time.Time `db:"mtime" cc:"ctime"` +} diff --git a/model/opay_donate_list.go b/model/opay_donate_list.go new file mode 100644 index 0000000..bf181b1 --- /dev/null +++ b/model/opay_donate_list.go @@ -0,0 +1,13 @@ +package model + +import "time" + +// OpayDonateList - struct +type OpayDonateList struct { + OpayID string `db:"opayid" cc:"opayid"` + DonateID string `db:"donate_id" cc:"donate_id"` + Price int `db:"price" cc:"price"` + Text string `db:"text" cc:"text"` + Ctime time.Time `db:"ctime" cc:"ctime"` + Mtime time.Time `db:"mtime" cc:"ctime"` +} diff --git a/model/rt_table.go b/model/rt_table.go new file mode 100644 index 0000000..b1f1b22 --- /dev/null +++ b/model/rt_table.go @@ -0,0 +1,20 @@ +package model + +type LineTwitchRT struct { + Line string `db:"line" cc:"line"` + Twitch string `db:"twitch" cc:"twitch"` + Tmpl string `db:"tmpl" cc:"tmpl"` + Type string `db:"type" cc:"type"` +} + +type LineFacebookRT struct { + Line string `db:"line" cc:"line"` + Facebook string `db:"facebook" cc:"facebook"` + Tmpl string `db:"tmpl" cc:"tmpl"` +} + +type LineYoutubeRT struct { + Line string `db:"line" cc:"line"` + Youtube string `db:"youtube" cc:"youtube"` + Tmpl string `db:"tmpl" cc:"tmpl"` +} diff --git a/model/twitch_channel.go b/model/twitch_channel.go new file mode 100644 index 0000000..050bf2b --- /dev/null +++ b/model/twitch_channel.go @@ -0,0 +1,14 @@ +package model + +import "time" + +// TwitchChannel - struct +type TwitchChannel struct { + ID string `db:"id" cc:"id"` + Name string `db:"name" cc:"name"` + LastStream string `db:"laststream" cc:"laststream"` + Join bool `db:"join" cc:"join"` + OpayID string `db:"opayid" cc:"opayid"` + Ctime time.Time `db:"ctime" cc:"ctime"` + Mtime time.Time `db:"mtime" cc:"ctime"` +} diff --git a/router/api/api.go b/router/api/api.go index 74535c1..12110c5 100644 --- a/router/api/api.go +++ b/router/api/api.go @@ -42,3 +42,12 @@ func UserLogin(c *context.Context) { c.Success(nil) } + +// UserLogout - +func UserLogout(c *context.Context) { + session := sessions.Default(c.Context) + session.Clear() + session.Save() + + c.Success(nil) +}