Documentation
¶
Overview ¶
Copyright © 2024 chouette2100@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2025 chouette2100@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
! Copyright © 2023 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
! Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
! Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
! Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Copyright © 2024 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
! Copyright © 2023 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
! Copyright © 2022 chouette.21.00@gmail.com Released under the MIT license https://opensource.org/licenses/mit-license.php
Index ¶
- Constants
- Variables
- func ConverGenre2Abbr(genre string) (abbr string)
- func ExtractStructColumns(model interface{}) string
- func GetEventsRankingByApi(client *http.Client, eid string, mode int) (pranking *srapi.Eventranking, err error)
- func GetFeaturedEvents(mode string, hours int, num int, lmct int) (eventmap map[string]int, err error)
- func GetStructColumns(model interface{}) []string
- func GetStructName(model interface{}) string
- func InserIntoGiftScore(client *http.Client, dbmap *gorp.DbMap, giftid int, cgr *srapi.GrRanking, ...) (err error)
- func InserIntoGiftScoreCntrb(client *http.Client, dbmap *gorp.DbMap, giftid int, userno int, ...) (err error)
- func InserIntoViewerGiftScore(client *http.Client, dbmap *gorp.DbMap, giftid int, cugr *srapi.UgrRanking, ...) (err error)
- func InsertEutable[T EventuserR](xeu T) (err error)
- func InsertEventinflistToEvent(tevent string, eventinflist *[]exsrapi.Event_Inf, bcheck bool) (err error)
- func InsertIntoOrUpdateUser(tnow time.Time, eventid string, roominf RoomInfo) (status int)
- func InsertNewOnes(client *http.Client, order int, eventinf exsrapi.Event_Inf, room srapi.Room) (err error)
- func InsertUserhistory[T UserhistoryT](xuserhistory T, user *User) (err error)
- func InsertUsertable[T UserT](client *http.Client, tnow time.Time, xuser T) (rxuser *T, err error)
- func MakeSortKeyOfRank(rank string, nextscore int) (irank int)
- func SelectCurEventList() (eventlist []exsrapi.Event_Inf, err error)
- func SelectEudata[T EventuserR](xeu *T, eventid string, userno int) (result *T, err error)
- func SelectEventNoAndName(tevent, eventid string) (eventname string, period string, status int)
- func SelectEventRoomInfList(tevent string, eventid string, roominfolist *RoomInfoList) (eventname string, status int)
- func SelectEventinflistFromEvent(cond int, keyword string, offset int, limit int) (eventinflist []exsrapi.Event_Inf, err error)
- func SelectFromEvent(tevent string, eventid string) (peventinf *exsrapi.Event_Inf, err error)
- func SelectPointList(userno int, eventid string) (norow int, tp *[]time.Time, pp *[]int)
- func SelectUserdata[T UserT](xu T, userno int) (result *T, err error)
- func UpdateEutable[T EventuserR](xeu T) (err error)
- func UpdatePointsSetQstatus(eventid string, userno int, tstart string, tend string, point string) (status int)
- func UpdateUsertable[T UserT](client *http.Client, tnow time.Time, xuser T) (rxuser *T, err error)
- func UpinsEventuser(client *http.Client, order int, point int, eventid string, starttime time.Time, ...) (err error)
- func UpinsEventuserG[T EventuserR](xeu T, tnow time.Time) (err error)
- func UpinsUser[T UserT](client *http.Client, tnow time.Time, xuser T) (rxuser *T, err error)
- func UpinsViewerSetProperty(client *http.Client, tnow time.Time, viewer *Viewer) (err error)
- type Accesslog
- type Campaign
- type Color
- type ColorInf
- type ColorInfList
- type DBConfig
- type Environment
- type Event
- type EventC
- type EventR
- type Eventrank
- type Eventuser
- type EventuserBR
- type EventuserR
- type GiftRanking
- type GiftScore
- type GiftScoreCntrb
- type PerSlot
- type PerSlotInf
- type Points
- type RoomInfo
- type RoomInfoList
- type Timetable
- type User
- type UserT
- type Userhistory
- type UserhistoryT
- type Viewer
- type ViewerGiftScore
- type ViewerHistory
- type Wevent
- type Weventuser
- type Wuser
- type Wuserhistory
Constants ¶
const Version = "200402"
Variables ¶
var AllColumns map[string]string
var Clmlist map[string]string = map[string]string{}
var Colorlist0 []Color = []Color{
{"#00FFFF", "#00FFFF"},
{"#FF00FF", "#FF00FF"},
{"#FFFF00", "#FFFF00"},
{"#7F7FFF", "#7F7FFF"},
{"#FF7F7F", "#FF7F7F"},
{"#7FFF7F", "#7FFF7F"},
{"#7FBFFF", "#7FBFFF"},
{"#FF7FBF", "#FF7FBF"},
{"#BFFF7F", "#BFFF7F"},
{"#7FFFFF", "#7FFFFF"},
{"#FF7FFF", "#FF7FFF"},
{"#FFFF7F", "#FFFF7F"},
{"#7FFFBF", "#7FFFBF"},
{"#BF7FFF", "#BF7FFF"},
{"#FFBF7F", "#FFBF7F"},
{"#ADADFF", "#ADADFF"},
{"#FFADAD", "#FFADAD"},
{"#ADFFAD", "#7FFFAD"},
{"#ADD6FF", "#ADD6FF"},
{"#FFADD6", "#FFADD6"},
{"#D6FFAD", "#D6FFAD"},
{"#ADFFFF", "#ADFFFF"},
{"#FFADFF", "#FFADFF"},
{"#FFFFAD", "#FFFFAD"},
{"#ADFFD6", "#ADFFD6"},
{"#D6ADFF", "#D6ADFF"},
{"#FFD6AD", "#FFD6AD"},
}
var Colorlist1 []Color = []Color{
{"cyan", "cyan"},
{"magenta", "magenta"},
{"yellow", "yellow"},
{"royalblue", "royalblue"},
{"coral", "coral"},
{"khaki", "khaki"},
{"deepskyblue", "deepskyblue"},
{"crimson", "crimson"},
{"orange", "orange"},
{"lightsteelblue", "lightsteelblue"},
{"pink", "pink"},
{"sienna", "sienna"},
{"springgreen", "springgreen"},
{"blueviolet", "blueviolet"},
{"salmon", "salmon"},
{"lime", "lime"},
{"red", "red"},
{"darkorange", "darkorange"},
{"skyblue", "skyblue"},
{"lightpink", "lightpink"},
}
var Colorlist2 []Color = []Color{
{"red", "#FF2800"},
{"yellow", "#FAF500"},
{"green", "#35A16B"},
{"blue", "#0041FF"},
{"skyblue", "#66CCFF"},
{"lightpink", "#FFD1D1"},
{"orange", "#FF9900"},
{"purple", "#9A0079"},
{"brown", "#663300"},
{"lightgreen", "#87D7B0"},
{"white", "#FFFFFF"},
{"gray", "#77878F"},
}
https://www.fukushihoken.metro.tokyo.lg.jp/kiban/machizukuri/kanren/color.files/colorudguideline.pdf
var Db *sql.DB // プログラム中では一貫してこの変数を使うこと
var Dbmap *gorp.DbMap
var Dberr error
var Dialer sshql.Dialer
var Event_inf exsrapi.Event_Inf
var SortByFollowers bool
Functions ¶
func ExtractStructColumns ¶ added in v2.2.0
func ExtractStructColumns(model interface{}) string
ExtractStructColumns returns a comma-separated string of struct fields. gorpを使う場合はこの関数は必要ない、gorpに完全に移行するまでの暫定措置
func GetEventsRankingByApi ¶
func GetFeaturedEvents ¶
func GetFeaturedEvents( mode string, hours int, num int, lmct int, ) ( eventmap map[string]int, err error, )
参照回数の多いイベントを抽出する
func GetStructColumns ¶ added in v2.2.0
func GetStructColumns(model interface{}) []string
GetStructColumns returns a slice of struct fields.
func GetStructName ¶ added in v2.4.2
func GetStructName(model interface{}) string
GetStructName extracts the name of the struct from an interface value. If the value is a pointer to a struct, it returns the name of the struct it points to. If the value is not a struct or a pointer to a struct, it returns an empty string.
func InserIntoGiftScore ¶
func InserIntoGiftScore( client *http.Client, dbmap *gorp.DbMap, giftid int, cgr *srapi.GrRanking, tnow time.Time, ) ( err error, )
ギフトランキングデータを格納する 必要に応じて配信者(user)の情報を新たに作る、あるいは更新する。
func InserIntoGiftScoreCntrb ¶
func InserIntoGiftScoreCntrb( client *http.Client, dbmap *gorp.DbMap, giftid int, userno int, grc *srapi.GrcRanking, tnow time.Time, ) ( err error, )
ギフトランキング・リスナー貢献ランキングデータを格納する 必要に応じてリスナー(viewer)の情報を新たに作る、あるいは更新する。
func InserIntoViewerGiftScore ¶
func InserIntoViewerGiftScore( client *http.Client, dbmap *gorp.DbMap, giftid int, cugr *srapi.UgrRanking, tnow time.Time, ) ( err error, )
リスナーギフトランキングデータを格納する 必要に応じてリスナー(viewer)の情報を新たに作る、あるいは更新する。
func InsertEutable ¶
func InsertEutable[T EventuserR](xeu T) (err error)
func InsertEventinflistToEvent ¶
func InsertEventinflistToEvent( tevent string, eventinflist *[]exsrapi.Event_Inf, bcheck bool, ) ( err error, )
イベント情報リストをイベントテーブルに格納する。 格納できたときは (*eventinflist)[i].Valid = false とする。 格納できないときは (*eventinflist)[i].Valid = true とする。 (*eventinflist)[i].Valid はイベント情報とは無関係で 処理の状況を示すために使われる。
func InsertIntoOrUpdateUser ¶
func InsertNewOnes ¶
func InsertUserhistory ¶
func InsertUserhistory[T UserhistoryT]( xuserhistory T, user *User, ) ( err error, )
userデータをuserhistory, wuserhistoryにinsertする。
func InsertUsertable ¶
func InsertUsertable[T UserT]( client *http.Client, tnow time.Time, xuser T, ) ( rxuser *T, err error, )
APIで UserT.Userno の ユーザ情報を取得し、ユーザテーブルに新しいデータを挿入する。
func MakeSortKeyOfRank ¶
Rank情報からランクのソートキーを作る
func SelectCurEventList ¶
func SelectCurEventList() ( eventlist []exsrapi.Event_Inf, err error, )
DBから現在開催中のイベントを抜き出す
func SelectEudata ¶
func SelectEudata[T EventuserR](xeu *T, eventid string, userno int) ( result *T, err error, )
func SelectEventNoAndName ¶
func SelectEventRoomInfList ¶
func SelectEventRoomInfList( tevent string, eventid string, roominfolist *RoomInfoList, ) ( eventname string, status int, )
func SelectEventinflistFromEvent ¶
func SelectEventinflistFromEvent( cond int, keyword string, offset int, limit int, ) ( eventinflist []exsrapi.Event_Inf, err error, )
指定した条件に該当するイベントのリストを作る。
func SelectFromEvent ¶
func SelectPointList ¶
func SelectUserdata ¶
テーブル user からデータを取得する。
func UpdateEutable ¶
func UpdateEutable[T EventuserR](xeu T) (err error)
func UpdatePointsSetQstatus ¶
func UpdateUsertable ¶
func UpdateUsertable[T UserT](client *http.Client, tnow time.Time, xuser T) ( rxuser *T, err error, )
SHOWROOMのAPI api/roomprofile を使って得られる情報でユーザテーブルを更新する。
func UpinsEventuser ¶
func UpinsEventuser( client *http.Client, order int, point int, eventid string, starttime time.Time, cmap int, userno int, tnow time.Time, ) ( err error, )
イベントに新しいユーザを追加する
InserNewOnes()をコピーし引数を変更したもの TODO: こちらに統一すること eventuser 新規作成または更新 user 新規作成または更新 points イベント開始時のデータを新規作成
func UpinsEventuserG ¶
func UpinsEventuserG[T EventuserR](xeu T, tnow time.Time) (err error)
イベント最終結果(確定結果)をeventuserテーブルに格納する(既存の場合は更新する)
Types ¶
type Accesslog ¶
type Accesslog struct { Handler string Remoteaddress string Useragent string Formvalues string Eventid string Roomid int Ts time.Time }
アクセスログ accesslog 2024-11-27 〜
type ColorInfList ¶
type ColorInfList []ColorInf
type DBConfig ¶
type DBConfig struct { UseSSH bool `yaml:"UseSSH"` DBhost string `yaml:"DBhost"` DBport string `yaml:"DBport"` DBname string `yaml:"DBname"` DBuser string `yaml:"DBuser"` DBpswd string `yaml:"DBpswd"` SRacct string `yaml:"SRacct"` SRpswd string `yaml:"SRpswd"` SSHhost string `yaml:"SSHhost"` SSHport int `yaml:"SSHport"` SSHuser string `yaml:"SSHuser"` SSHpswd string `yaml:"SSHpswd"` SSHprvkey string `yaml:"SSHprvkey"` }
type Environment ¶
type Environment struct { // Intervalhour int `yaml:"Intervalhour"` Lmin int `yaml:"Lmin"` Waitmsec int `yaml:"Waitmsec"` }
var Env Environment = Environment{
Lmin: 14400,
Waitmsec: 100,
}
type Event ¶
type Event struct { Eventid string `yaml:"eventid"` // イベントID (event_url_key) Ieventid int `yamal:"ieventid"` // イベントID (整数) Event_name string `yaml:"event_name"` Period string `yaml:"period"` Starttime time.Time `yaml:"starttime"` // イベント開始時刻 Endtime time.Time `yaml:"endtime"` // イベント終了時刻 Noentry int `yaml:"noentry"` Intervalmin int `yaml:"intervalmin"` Modmin int `yaml:"modmin"` Modsec int `yaml:"modsec"` Fromorder int `yaml:"fromorder"` Toorder int `yaml:"toorder"` Resethh int `yaml:"resethh"` Resetmm int `yaml:"resetmm"` Nobasis int `yaml:"nobasis"` Maxdsp int `yaml:"maxdsp"` Cmap int `yaml:"cmap"` Target int `yaml:"target"` Rstatus string `yaml:"rstatus"` Maxpoint int `yaml:"maxpoint"` Thinit int `yaml:"thinit"` // 獲得ポイントがThinit + Thdelta * int(time.Since(Starttime).Hours())を超えるルームのみデータ取得対象とする。 Thdelta int `yaml:"thdelta"` Achk int `yaml:"achk"` Aclr int `yaml:"aclr"` Cmode int `yaml:"cmode"` // Cmode & x01 == 1 : 無条件で貢献ポイントを取得する Emphasis int `yaml:"emphasis" db:"-"` // Emphasis & x01 != x01 イベント一覧でアクセス数が多いイベントを強調表示する }
イベント構造体 PRIMARY KEY (eventid)
type Eventuser ¶
type Eventuser struct { EventuserBR // 他のフィールド Status int // 1: ユーザーによって指定された=無条件にデータ取得対象とする }
type EventuserBR ¶
type EventuserBR struct { Eventid string // PRIMARY KEY(1) Userno int // PRIMARY KEY(2) Istarget string Iscntrbpoints string Graph string Color string Point int Vld int }
イベントに参加しているユーザの構造体(ベース)
type GiftRanking ¶
type GiftScoreCntrb ¶
type GiftScoreCntrb struct { Giftid int Userno int Viewerid int Orderno int Score int Ts time.Time }
ギフト貢献ランキング
type PerSlotInf ¶
type PerSlotInf struct { Eventname string Eventid string Period string Roomname string Roomid int Perslotlist []PerSlot }
func MakePointPerSlot ¶
func MakePointPerSlot(tevent, eventid string) (perslotinflist []PerSlotInf, status int)
type RoomInfo ¶
type RoomInfo struct { Name string // ルーム名のリスト Longname string Shortname string Account string // アカウントのリスト、アカウントは配信のURLの最後の部分の英数字です。 ID string // IDのリスト、IDはプロフィールのURLの最後の部分で5~6桁の数字です。 Userno int // APIで取得できるデータ(1) Genre string Rank string Irank int Nrank string Prank string Followers int Sfollowers string Fans int Fans_lst int Level int Slevel string // APIで取得できるデータ(2) Order int Point int // イベント終了後12時間〜36時間はイベントページから取得できることもある Spoint string Istarget string Graph string Iscntrbpoint string Color string Colorvalue string Colorinflist ColorInfList Formid string Eventid string Status string Statuscolor string }
type RoomInfoList ¶
type RoomInfoList []RoomInfo
func (RoomInfoList) Choose ¶
func (r RoomInfoList) Choose(from, to int) (s RoomInfoList)
func (RoomInfoList) Swap ¶
func (r RoomInfoList) Swap(i, j int)
type Timetable ¶
type Timetable struct { Eventid string // イベントID、=event_url_keyを設定する Userid int // ルームIDを設定する Sampletm1 time.Time // 貢献ポイント取得予定(希望)時刻(貢献ポイントが落ち着く頃を指定する) Sampletm2 time.Time // 貢献ポイント取得時刻、実際にデータを取得した時刻が格納される Stime time.Time // 配信枠の開始時刻 Etime time.Time // 配信枠の終了推定時刻 Target int // -1を設定する。配信枠での無料ギフトの最大獲得ポイントを格納される(最近はあんまり意味ないし、一概にいくらと決めにくい) Totalpoint int // 貢献ポイントの合計値が格納される Earnedpoint int // 獲得ポイントの増分を設定する Status int // 0を設定する、貢献ポイントの増分が格納されたら1が格納される }
配信枠の構造体(配信枠別リスナー別貢献ポイント用)
PRIMARY KEY (eventid,userid,sampletm1)
type User ¶
type User struct { Userno int Userid string User_name string Longname string Shortname string Genre string GenreID int Rank string Nrank string Prank string Irank int Inrank int Iprank int Itrank int Level int Followers int Fans int FanPower int Fans_lst int FanPower_lst int Ts time.Time Getp string Graph string Color string Currentevent string }
func GetLastUserdata ¶
userとtwuserのデータをデータベースから取得し、新しいデータを返す
func GetUserOrWuserData ¶
func getUserdataWithOtheruserdata(user1 UserT, user2 UserT) (vdata *User, verr error, tdata *User, terr error) {
type Userhistory ¶
type Userhistory struct { Userno int User_name string Genre string Rank string Nrank string Prank string Level int Followers int Fans int Fans_lst int Ts time.Time }
userの履歴を保存する構造体 PRIMARY KEY (`userno`,`ts`)
func (*Userhistory) Get ¶
func (uh *Userhistory) Get() ( result *User, err error, )
Getter and Setter for Userhistory
func (*Userhistory) Set ¶
func (uh *Userhistory) Set(nuh *User) (err error)
type UserhistoryT ¶
UserhistoryT is an interface for Userhistory
type ViewerGiftScore ¶
type ViewerGiftScore struct { Giftid int Viewerid int Orderno int Score int Status string Ts time.Time }
ユーザーギフトランキング(userは配信者の意味で使用しているのでviewerとしてある)
type ViewerHistory ¶
type Weventuser ¶
type Weventuser struct { EventuserBR // 他のフィールド Status int // 1: ユーザーによって指定された=無条件にデータ取得対象とする }
func (*Weventuser) Get ¶
func (e *Weventuser) Get() ( result *Eventuser, err error, )
func (*Weventuser) Set ¶
func (e *Weventuser) Set(ne *Eventuser) (err error)
type Wuser ¶
type Wuser struct { Userno int Userid string User_name string Longname string Shortname string Genre string // GenreID int Rank string Nrank string Prank string // Irank int // Inrank int // Iprank int // Itrank int Level int Followers int Fans int FanPower int Fans_lst int FanPower_lst int Ts time.Time Getp string Graph string Color string Currentevent string }
type Wuserhistory ¶
type Wuserhistory Userhistory
func (*Wuserhistory) Get ¶
func (wh *Wuserhistory) Get() ( result *User, err error, )
Getter and Setter for Wuserhistory
func (*Wuserhistory) Set ¶
func (wh *Wuserhistory) Set(nwh *User) (err error)
Source Files
¶
- Accesslog.go
- Event.go
- Eventrank.go
- Eventuser.go
- ExtractStructColumns.go
- GetEventsRankingByApi.go
- Giftscore.go
- InsertEventinflistToEvent.go
- InsertIntoOrUpdateUser.go
- InsertNewOnes.go
- OpenDB.go
- Points.go
- SelectCurEventList.go
- SelectEventinflistFromEvent.go
- SelectFromEvent.go
- Timetable.go
- UpinsEventuser.go
- UpinsUserG.go
- User.go
- Userhistory.go
- Viewer.go
- campaign.go
- init.go
- srdblib.go
- srmsclib.go