|
- package db
-
- import (
- "applet/app/db/model"
- "xorm.io/xorm"
- )
-
- func GetUserStoreActivity(eg *xorm.Engine, types string, uid int) *[]model.UserStoreActivity {
- var data []model.UserStoreActivity
- sess := eg.Where("type=?", types)
- if uid > 0 {
- sess.And("uid=?", uid)
- }
- err := sess.OrderBy("sort desc,id asc").Find(&data)
- if err != nil {
- return nil
- }
- return &data
- }
- func GetUserStoreActivityByType(eg *xorm.Engine, types string) *[]model.UserStoreActivity {
- var data []model.UserStoreActivity
- err := eg.Where("type=?", types).OrderBy("sort desc,id asc").Find(&data)
- if err != nil {
- return nil
- }
- return &data
- }
- func GetUserStoreActivityById(eg *xorm.Engine, id string) *model.UserStoreActivity {
- var data model.UserStoreActivity
- get, err := eg.Where("id=?", id).Get(&data)
- if get == false || err != nil {
- return nil
- }
- return &data
- }
|