package db import ( "applet/app/db/model" "applet/app/utils" "xorm.io/xorm" ) func GetStorePayQrcode(eg *xorm.Engine, args map[string]string) (*[]model.CommunityTeamStorePayQrcode, int64) { var data []model.CommunityTeamStorePayQrcode sess := eg.Where("uid=?", args["uid"]) size := utils.StrToInt(args["size"]) start := (utils.StrToInt(args["p"]) - 1) * size total, err := sess.Limit(size, start).Desc("id").FindAndCount(&data) if err != nil { return nil, total } return &data, total } func GetStorePayQrcodeById(eg *xorm.Engine, id string) *model.CommunityTeamStorePayQrcode { var data model.CommunityTeamStorePayQrcode get, err := eg.Where("id=?", id).Get(&data) if get == false || err != nil { return nil } return &data } func GetStorePayQrcodeByUId(eg *xorm.Engine, uid int) { var data model.CommunityTeamStorePayQrcode get, _ := eg.Where("uid=? ", uid).Get(&data) if get == false { data = model.CommunityTeamStorePayQrcode{ Id: 0, Uid: uid, Type: 0, IsUse: 1, Name: "默认", } } return }