Example #1
0
func (this *MerchantController) Index() {
	page, _ := this.GetInt64("page")
	page_size, _ := this.GetInt64("rows")
	sort := this.GetString("sort")
	order := this.GetString("order")
	if len(order) > 0 {
		if order == "desc" {
			sort = "-" + sort
		}
	} else {
		sort = "Id"
	}
	merchants, count := m.GetMerchantlist(page, page_size, sort)
	if this.IsAjax() {
		this.Data["json"] = &map[string]interface{}{"total": count, "rows": &merchants}
		this.ServeJson()
		return
	} else {
		//this.Data["merchants"] = &merchants
		if this.GetTemplatetype() != "easyui" {
			this.Layout = this.GetTemplatetype() + "/public/layout.tpl"
		}
		this.TplNames = this.GetTemplatetype() + "/rbac/merchant.tpl"
	}

}
Example #2
0
//API使用
func (this *MerchantController) GetList() {
	page, _ := this.GetInt64("page")
	page_size, _ := this.GetInt64("rows")
	sort := this.GetString("sort")
	order := this.GetString("order")
	if len(order) > 0 {
		if order == "desc" {
			sort = "-" + sort
		}
	} else {
		sort = "Id"
	}
	merchants, count := m.GetMerchantlist(page, page_size, sort)
	this.Data["json"] = &map[string]interface{}{"total": count, "rows": &merchants}
	this.Data["content"] = "value"
	//this.ServeJson()
	this.TplNames = "html/test.tpl"

}