|
- package db
-
- import (
- "applet/app/db/model"
- "applet/app/utils"
- "xorm.io/xorm"
- )
-
- func GetCard(eg *xorm.Engine, arg map[string]string) *[]model.CommunityTeamCard {
- var data []model.CommunityTeamCard
- sess := eg.Where("1=1")
- limit := utils.StrToInt(arg["size"])
- start := (utils.StrToInt(arg["p"]) - 1) * limit
- err := sess.OrderBy("sort desc,id desc").Limit(limit, start).Find(&data)
- if err != nil {
- return nil
- }
- return &data
- }
- func GetCardDetail(eg *xorm.Engine, arg map[string]string) *model.CommunityTeamCard {
- var data model.CommunityTeamCard
- sess := eg.Where("id=?", arg["id"])
- get, err := sess.Get(&data)
- if err != nil || get == false {
- return nil
- }
- return &data
- }
|