附近小店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db_user_store_activity.go 853 B

2 months ago
1234567891011121314151617181920212223242526272829303132333435
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "xorm.io/xorm"
  5. )
  6. func GetUserStoreActivity(eg *xorm.Engine, types string, uid int) *[]model.UserStoreActivity {
  7. var data []model.UserStoreActivity
  8. sess := eg.Where("type=?", types)
  9. if uid > 0 {
  10. sess.And("uid=?", uid)
  11. }
  12. err := sess.OrderBy("sort desc,id asc").Find(&data)
  13. if err != nil {
  14. return nil
  15. }
  16. return &data
  17. }
  18. func GetUserStoreActivityByType(eg *xorm.Engine, types string) *[]model.UserStoreActivity {
  19. var data []model.UserStoreActivity
  20. err := eg.Where("type=?", types).OrderBy("sort desc,id asc").Find(&data)
  21. if err != nil {
  22. return nil
  23. }
  24. return &data
  25. }
  26. func GetUserStoreActivityById(eg *xorm.Engine, id string) *model.UserStoreActivity {
  27. var data model.UserStoreActivity
  28. get, err := eg.Where("id=?", id).Get(&data)
  29. if get == false || err != nil {
  30. return nil
  31. }
  32. return &data
  33. }