当前位置: 首页>>代码示例>>Golang>>正文


Golang Page.SubPage_link方法代码示例

本文整理汇总了Golang中github.com/blackmady/NoneCMS/utils.Page.SubPage_link方法的典型用法代码示例。如果您正苦于以下问题:Golang Page.SubPage_link方法的具体用法?Golang Page.SubPage_link怎么用?Golang Page.SubPage_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/blackmady/NoneCMS/utils.Page的用法示例。


在下文中一共展示了Page.SubPage_link方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetCommentList

//获取评论列表
func (c *Comment) GetCommentList(search string, Page int64, Perpage int64) (comment_arr []*Comment, html template.HTML, where map[string]interface{}) {

	comment_list := []*Comment{}

	//查询条件
	var WhereStr string = " 1 AND "

	if len(search) > 0 {

		//解码
		where = utils.DecodeSegment(search)

		revel.WARN.Println(where)

		if where["start_time"] != "" {
			WhereStr += " `regdate` >='" + fmt.Sprintf("%s", where["start_time"]) + " 00:00:00' AND "
		}
	}

	WhereStr += " 1 "

	//查询总数
	comment := new(Comment)
	Total, err := DB_Read.Table("comment").Where(WhereStr).Count(comment)
	if err != nil {
		revel.WARN.Printf("错误: %v", err)
	}

	//分页
	Pager := new(utils.Page)
	if len(search) > 0 {
		Pager.SubPage_link = "/Comment/" + search + "/"
	} else {
		Pager.SubPage_link = "/Comment/"
	}

	Pager.Nums = Total
	Pager.Perpage = Perpage
	Pager.Current_page = Page
	Pager.SubPage_type = 2
	pages := Pager.Show()

	DB_Read.Table("comment").Where(WhereStr).Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&comment_list)

	if len(comment_list) > 0 {
		user := new(User)
		for i, v := range comment_list {
			comment_list[i].User = user.GetById(v.Uid)
		}
	}

	return comment_list, pages, where
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:54,代码来源:comment.go

示例2: GetByAll

//获取分类列表
func (c *FocusCate) GetByAll(Page int64, Perpage int64) ([]*FocusCate, template.HTML) {
	focuscate_list := []*FocusCate{}

	//查询总数
	focuscate := new(FocusCate)
	Total, err := DB_Read.Count(focuscate)
	if err != nil {
		revel.WARN.Printf("错误: %v", err)
	}

	//分页
	Pager := new(utils.Page)
	Pager.SubPage_link = "/FocusCate/"
	Pager.Nums = Total
	Pager.Perpage = Perpage
	Pager.Current_page = Page
	Pager.SubPage_type = 2
	pages := Pager.Show()

	//查询数据
	DB_Read.Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&focuscate_list)
	return focuscate_list, pages
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:24,代码来源:focuscate.go

示例3: GetByAll

//获取来源列表
func (c *Copyfrom) GetByAll(Page int64, Perpage int64) ([]*Copyfrom, template.HTML) {
	copyfrom_list := []*Copyfrom{}

	//查询总数
	copyfrom := new(Copyfrom)
	Total, err := DB_Read.Count(copyfrom)
	if err != nil {
		revel.WARN.Printf("错误: %v", err)
	}

	//分页
	Pager := new(utils.Page)
	Pager.SubPage_link = "/Copyfrom/"
	Pager.Nums = Total
	Pager.Perpage = Perpage
	Pager.Current_page = Page
	Pager.SubPage_type = 2
	pages := Pager.Show()

	//查询数据
	DB_Read.Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&copyfrom_list)
	return copyfrom_list, pages
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:24,代码来源:copyfrom.go

示例4: GetByAll

//获取焦点图列表
func (c *Focus) GetByAll(search string, Page int64, Perpage int64) (focus_arr []*Focus, html template.HTML, where map[string]interface{}) {
	focus_list := []*Focus{}

	//查询条件
	var WhereStr string = " 1 AND "

	if len(search) > 0 {

		//解码
		where = utils.DecodeSegment(search)

		revel.WARN.Println(where)

		if where["cid"] != "" {
			WhereStr += " `cid`='" + fmt.Sprintf("%d", where["cid"]) + "' AND "
		}

		if where["keyword"] != "" {
			//关键字
			keyword := fmt.Sprintf("%s", where["keyword"])
			WhereStr += " `title` like '%" + keyword + "%' AND "
		}
	}

	WhereStr += " 1 "

	//查询总数
	focus := new(Focus)
	Total, err := DB_Read.Where(WhereStr).Count(focus)
	if err != nil {
		revel.WARN.Printf("错误: %v", err)
	}

	//分页
	Pager := new(utils.Page)
	Pager.SubPage_link = "/Focus/"
	Pager.Nums = Total
	Pager.Perpage = Perpage
	Pager.Current_page = Page
	Pager.SubPage_type = 2
	pages := Pager.Show()

	//查询数据
	DB_Read.Where(WhereStr).Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&focus_list)

	if len(focus_list) > 0 {
		admin := new(Admin)
		focuscate := new(FocusCate)

		for i, v := range focus_list {
			focus_list[i].Admin = admin.GetById(v.Aid)

			//所属栏目
			focus_list[i].Focuscate = focuscate.GetById(v.Cid)

			if v.Img != "" {
				//判断是否是系统的分隔符
				separator := "/"
				if os.IsPathSeparator('\\') {
					separator = "\\"
				} else {
					separator = "/"
				}

				config_file := (revel.BasePath + "/conf/config.conf")
				config_file = strings.Replace(config_file, "/", separator, -1)
				config_conf, _ := config.ReadDefault(config_file)

				//前台网站地址
				sitedomain, _ := config_conf.String("website", "website.sitedomain")
				v.Img = sitedomain + v.Img
			}
		}
	}

	return focus_list, pages, where
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:78,代码来源:focus.go

示例5: GetByAll

//获取管理员列表
func (a *Admin) GetByAll(RoleId int64, where map[string]string, Page int64, Perpage int64) ([]*Admin, template.HTML) {
	admin_list := []*Admin{}

	if RoleId > 0 {

		//查询总数
		admin := new(Admin)
		Total, err := DB_Read.Where("roleid=?", RoleId).Count(admin)
		if err != nil {
			revel.WARN.Printf("错误: %v", err)
		}

		//分页
		Pager := new(utils.Page)
		Pager.SubPage_link = "/Admin/"
		Pager.Nums = Total
		Pager.Perpage = Perpage
		Pager.Current_page = Page
		Pager.SubPage_type = 2
		pages := Pager.Show()

		DB_Read.Where("roleid=?", RoleId).Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&admin_list)

		if len(admin_list) > 0 {
			role := new(Role)

			for i, v := range admin_list {
				admin_list[i].Role = role.GetById(v.Roleid)
			}
		}

		return admin_list, pages
	} else {

		//查询总数
		admin := new(Admin)
		Total, err := DB_Read.Count(admin)
		if err != nil {
			revel.WARN.Printf("错误: %v", err)
		}

		//分页
		Pager := new(utils.Page)
		Pager.SubPage_link = "/Admin/"
		Pager.Nums = Total
		Pager.Perpage = Perpage
		Pager.Current_page = Page
		Pager.SubPage_type = 2
		pages := Pager.Show()

		DB_Read.Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Find(&admin_list)

		if len(admin_list) > 0 {
			role := new(Role)

			for i, v := range admin_list {
				admin_list[i].Role = role.GetById(v.Roleid)
			}
		}

		return admin_list, pages
	}
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:64,代码来源:admin.go

示例6: GetByAll

//获取日志列表
func (L *Logs) GetByAll(search string, Page int64, Perpage int64) (logs_arr []*Logs, html template.HTML, where map[string]interface{}) {

	logs_list := []*Logs{}

	//查询条件
	var WhereStr string = " 1 AND "

	if len(search) > 0 {
		//解码
		where = utils.DecodeSegment(search)

		revel.WARN.Println(where)

		if where["module"] != "" {
			WhereStr += " `module`='" + fmt.Sprintf("%s", where["module"]) + "' AND "
		}

		if where["username"] != "" {
			admin := new(Admin)
			AdminInfo := admin.GetByName(fmt.Sprintf("%s", where["username"]))
			WhereStr += " `uid`=" + strconv.Itoa(int(AdminInfo.Id)) + " AND "
		}

		if where["realname"] != "" {
			admin := new(Admin)
			AdminInfo := admin.GetByRealName(fmt.Sprintf("%s", where["realname"]))
			WhereStr += " `uid`='" + strconv.Itoa(int(AdminInfo.Id)) + "' AND "
		}

		if where["start_time"] != "" {
			WhereStr += " `createtime` >='" + fmt.Sprintf("%s", where["start_time"]) + " 00:00:00' AND "
		}

		if where["end_time"] != "" {
			WhereStr += " `createtime` <='" + fmt.Sprintf("%s", where["end_time"]) + " 23:59:59' AND "
		}
	}

	WhereStr += " 1 "

	//查询总数
	logs := new(Logs)
	Total, err := DB_Read.Where(WhereStr).Count(logs)
	if err != nil {
		revel.WARN.Printf("错误: %v", err)
	}

	//分页
	Pager := new(utils.Page)
	if len(search) > 0 {
		Pager.SubPage_link = "/Logs/" + search + "/"
	} else {
		Pager.SubPage_link = "/Logs/"
	}

	Pager.Nums = Total
	Pager.Perpage = Perpage
	Pager.Current_page = Page
	Pager.SubPage_type = 2
	pages := Pager.Show()

	//查询数据
	DB_Read.Where(WhereStr).Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&logs_list)

	if len(logs_list) > 0 {
		admin := new(Admin)

		for i, v := range logs_list {
			logs_list[i].Admin = admin.GetById(v.Uid)
			logs_list[i].IpAddress = utils.GetIpAddress(v.Ip)
		}
	}

	return logs_list, pages, where
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:76,代码来源:logs.go

示例7: GetByList

//获取内容列表
func (a *Article) GetByList(Cid int64, Search string, Page int64, Perpage int64) (article_arr []*Article, html template.HTML, where map[string]interface{}) {
	article_list := []*Article{}

	//查询条件
	var WhereStr string = " 1 AND "

	if len(Search) > 0 {

		//解码
		where = utils.DecodeSegment(Search)

		revel.WARN.Println(where)

		if where["cid"] != "0" {
			WhereStr += " `cid`='" + fmt.Sprintf("%s", where["cid"]) + "' AND "
		}

		if where["field"] != "" && where["keyword"] != "" {

			if where["field"] == "title" {
				//标题
				WhereStr += " `title` like %'" + fmt.Sprintf("%s", where["keyword"]) + "'% AND "

			} else if where["field"] == "keywords" {
				//关键词
				WhereStr += " `keywords` like %'" + fmt.Sprintf("%s", where["keyword"]) + "'% AND "
			} else if where["field"] == "description" {
				//描述
				WhereStr += " `description` like %'" + fmt.Sprintf("%s", where["keyword"]) + "'% AND "
			} else if where["field"] == "id" {
				//ID
				WhereStr += " `id`='" + fmt.Sprintf("%s", where["keyword"]) + "' AND "
			}

		}
	}

	WhereStr += " 1 "

	//查询总数
	article := new(Article)
	Total, err := DB_Read.Where(WhereStr).Count(article)
	if err != nil {
		revel.WARN.Printf("错误: %v", err)
	}

	//分页
	Pager := new(utils.Page)
	Pager.SubPage_link = "/Content/relationlist/" + strconv.FormatInt(Cid, 10) + "/"
	Pager.Nums = Total
	Pager.Perpage = Perpage
	Pager.Current_page = Page
	Pager.SubPage_type = 2
	pages := Pager.Show()

	//查询数据
	DB_Read.Where(WhereStr).Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&article_list)

	if len(article_list) > 0 {

		admin := new(Admin)
		category := new(Category)

		for i, v := range article_list {
			article_list[i].Admin = admin.GetById(v.Aid)

			//所属栏目
			article_list[i].Category = category.GetById(v.Cid)
		}
	}

	return article_list, pages, where
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:74,代码来源:article.go

示例8: GetByAll

//获取内容列表
func (a *Article) GetByAll(search string, Cid int64, Page int64, Perpage int64) (article_arr []*Article, html template.HTML, where map[string]interface{}) {
	article_list := []*Article{}

	//查询条件
	var WhereStr string = " 1 AND `cid`=" + strconv.FormatInt(Cid, 10) + " AND "

	if len(search) > 0 {

		//解码
		where = utils.DecodeSegment(search)

		revel.WARN.Println(where)

		if where["start_time"] != "" {
			WhereStr += " `createtime`='" + fmt.Sprintf("%s", where["start_time"]) + "' AND "
		}

		if where["start_time"] != "" {
			WhereStr += " `createtime`='" + fmt.Sprintf("%s", where["end_time"]) + "' AND "
		}

		if where["istop"] != "" {
			WhereStr += " `istop`='" + fmt.Sprintf("%s", where["istop"]) + "' AND "
		}

		if where["searchtype"] != "" && where["keyword"] != "" {

			if where["searchtype"] == "1" {
				//标题
				WhereStr += " `title` like '%" + fmt.Sprintf("%s", where["keyword"]) + "%' AND "
			} else if where["searchtype"] == "2" {
				//简介
				WhereStr += " `description` like '%" + fmt.Sprintf("%s", where["keyword"]) + "%' AND "
			} else if where["searchtype"] == "3" {

				//用户名
				keyword := fmt.Sprintf("%s", where["keyword"])
				Keyword, err := strconv.Atoi(keyword)

				revel.WARN.Println(Keyword)

				if err != nil {
					admin := new(Admin)
					admin_info := admin.GetByRealName(keyword)

					if admin_info.Id > 0 {
						WhereStr += " `aid`='" + strconv.FormatInt(admin_info.Id, 10) + "' AND "
					}
				} else {
					revel.WARN.Println(keyword)
					WhereStr += " `aid`='" + keyword + "' AND "
				}

			} else {
				//ID
				WhereStr += " `id`='" + fmt.Sprintf("%s", where["keyword"]) + "' AND "
			}
		}
	}

	WhereStr += " 1 "

	//查询总数
	article := new(Article)
	Total, err := DB_Read.Where(WhereStr).Count(article)
	if err != nil {
		revel.WARN.Printf("错误: %v", err)
	}

	//分页
	Pager := new(utils.Page)
	Pager.SubPage_link = "/Content/list/" + strconv.FormatInt(Cid, 10) + "/"
	Pager.Nums = Total
	Pager.Perpage = Perpage
	Pager.Current_page = Page
	Pager.SubPage_type = 2
	pages := Pager.Show()

	//查询数据
	DB_Read.Where(WhereStr).Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&article_list)

	if len(article_list) > 0 {
		admin := new(Admin)
		category := new(Category)

		for i, v := range article_list {
			article_list[i].Admin = admin.GetById(v.Aid)

			//所属栏目
			article_list[i].Category = category.GetById(v.Cid)
		}
	}

	return article_list, pages, where
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:96,代码来源:article.go

示例9: GetUserList

//获取会员列表
func (u *User) GetUserList(search string, Page int64, Perpage int64) (user_arr []*User, html template.HTML, where map[string]interface{}) {
	//初始化菜单
	user_list := []*User{}

	//查询条件
	var WhereStr string = " 1 AND "

	if len(search) > 0 {
		//解码
		where = utils.DecodeSegment(search)

		revel.WARN.Println(where)

		if where["start_time"] != "" {
			WhereStr += " `regdate` >='" + fmt.Sprintf("%s", where["start_time"]) + " 00:00:00' AND "
		}

		if where["end_time"] != "" {
			WhereStr += " `regdate` <='" + fmt.Sprintf("%s", where["end_time"]) + " 23:59:59' AND "
		}

		if where["islock"] != "" && where["islock"] != "0" {
			WhereStr += " `islock` =" + fmt.Sprintf("%s", where["islock"])
		}

		if where["type"] != "" && where["keyword"] != "" {

			if where["type"] == "1" {
				//用户名
				WhereStr += " `username` ='" + fmt.Sprintf("%s", where["keyword"]) + "' AND "
			} else if where["type"] == "2" {
				//用户ID
				WhereStr += " `id` =" + fmt.Sprintf("%s", where["keyword"]) + " AND "
			} else if where["type"] == "3" {
				//邮箱
				WhereStr += " `email` ='" + fmt.Sprintf("%s", where["keyword"]) + "' AND "
			} else if where["type"] == "4" {
				//注册ip
				WhereStr += " `regip` ='" + fmt.Sprintf("%s", where["keyword"]) + "' AND "
			} else if where["type"] == "5" {
				//昵称
				WhereStr += " `nickname` like '%" + fmt.Sprintf("%s", where["keyword"]) + "%' AND "
			}
		}
	}

	WhereStr += " 1 "

	//查询总数
	user := new(User)
	Total, err := DB_Read.Table("user").Where(WhereStr).Count(user)
	if err != nil {
		revel.WARN.Printf("错误: %v", err)
	}

	//分页
	Pager := new(utils.Page)
	if len(search) > 0 {
		Pager.SubPage_link = "/User/" + search + "/"
	} else {
		Pager.SubPage_link = "/User/"
	}

	Pager.Nums = Total
	Pager.Perpage = Perpage
	Pager.Current_page = Page
	Pager.SubPage_type = 2
	pages := Pager.Show()

	DB_Read.Table("user").Where(WhereStr).Limit(int(Perpage), int((Page-1)*Pager.Perpage)).Desc("id").Find(&user_list)

	if len(user_list) > 0 {
		user_group := new(User_Group)
		for i, v := range user_list {
			user_list[i].UserGroup = user_group.GetById(v.Groupid)
		}
	}

	return user_list, pages, where
}
开发者ID:blackmady,项目名称:GoCMS,代码行数:81,代码来源:user.go


注:本文中的github.com/blackmady/NoneCMS/utils.Page.SubPage_link方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。