本文整理汇总了Golang中GoOnlineJudge/model.ContestModel.List方法的典型用法代码示例。如果您正苦于以下问题:Golang ContestModel.List方法的具体用法?Golang ContestModel.List怎么用?Golang ContestModel.List使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GoOnlineJudge/model.ContestModel
的用法示例。
在下文中一共展示了ContestModel.List方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: List
//列出所有的比赛 url:/admin/contest/list/type/<contest,exercise>
func (this *ContestController) List(w http.ResponseWriter, r *http.Request) {
class.Logger.Debug("Contest List")
this.Init(w, r)
args := this.ParseURL(r.URL.String())
Type := args["type"]
qry := make(map[string]string)
qry["type"] = Type
contestModel := model.ContestModel{}
contestList, err := contestModel.List(args)
if err != nil {
http.Error(w, err.Error(), 400)
}
this.Data["Contest"] = contestList
this.Data["Title"] = "Admin - " + strings.Title(Type) + " List"
this.Data["Is"+strings.Title(Type)] = true
this.Data["IsList"] = true
err = this.Execute(w, "view/admin/layout.tpl", "view/admin/contest_list.tpl")
if err != nil {
http.Error(w, "tpl error", 500)
return
}
}
示例2: List
func (this *ContestController) List(w http.ResponseWriter, r *http.Request) {
class.Logger.Debug("Contest List")
this.Init(w, r)
args := this.ParseURL(r.URL.String())
Type := args["type"]
CModel := model.ContestModel{}
conetestList, err := CModel.List(args)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
this.Data["Contest"] = conetestList
this.Data["Time"] = this.GetTime()
this.Data["Type"] = Type
this.Data["Title"] = strings.Title(Type) + " List"
this.Data["Is"+strings.Title(Type)] = true
this.Data["Privilege"] = this.Privilege
err = this.Execute(w, "view/layout.tpl", "view/contest_list.tpl")
if err != nil {
class.Logger.Debug(err)
http.Error(w, "tpl error", 500)
return
}
}
示例3: List
//列出所有的比赛
//@URL: /admin/contests/ @method:GET
func (cc *AdminContest) List() {
restweb.Logger.Debug("Contest List")
qry := make(map[string]string)
contestModel := model.ContestModel{}
contestList, err := contestModel.List(qry)
if err != nil {
cc.Error(err.Error(), 400)
}
cc.Output["Contest"] = contestList
cc.Output["Title"] = "Admin - Contest List"
cc.Output["IsContest"] = true
cc.Output["IsList"] = true
cc.RenderTemplate("view/admin/layout.tpl", "view/admin/contest_list.tpl")
}
示例4: Index
//@URL: /contests @method: GET
func (c *ContestController) Index() {
restweb.Logger.Debug("Contest List")
CModel := model.ContestModel{}
conetestList, err := CModel.List(nil)
if err != nil {
c.Error(err.Error(), 500)
return
}
c.Output["Contest"] = conetestList
c.Output["Time"] = restweb.GetTime()
c.Output["Title"] = "Contest List"
c.Output["IsContest"] = true
c.Output["Privilege"] = c.Privilege
c.RenderTemplate("view/layout.tpl", "view/contest_list.tpl")
}