add image route , has bug

This commit is contained in:
Jay
2018-09-18 23:54:36 +08:00
parent ce62048c18
commit 2dc337762d
15 changed files with 2306 additions and 1 deletions
+22
View File
@@ -1,6 +1,7 @@
package model
import (
"database/sql"
"time"
"github.com/jmoiron/sqlx"
@@ -17,6 +18,27 @@ type OpayDonateList struct {
Mtime time.Time `db:"mtime" cc:"ctime"`
}
// SumChannelDonatePriceSinceTime -
func SumChannelDonatePriceSinceTime(twitch string, t time.Time) (i int, err error) {
query := `select sum(list.price) as total from "public"."opay_donate_list" list
left join "public"."twitch_channel" tw
on tw.opayid = list.opayid
where
tw.opayid != ''
and tw.id = $1
and list.ctime >= $2
group by list.opayid`
row := x.QueryRowx(query, twitch, t)
err = row.Scan(&i)
if err == sql.ErrNoRows {
return 0, nil
}
if err != nil {
return 0, err
}
return
}
// GetDonateListWithIDs -
func GetDonateListWithIDs(ids []string) (ls []*OpayDonateList, err error) {
if len(ids) == 0 {