面包店
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.

преди 9 месеца
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package db
  2. import (
  3. "xorm.io/xorm"
  4. "applet/app/db/model"
  5. "applet/app/utils/logx"
  6. )
  7. func DbsPlanRewardByPvd(eg *xorm.Engine, pvd string) (*model.PlanReward, error) {
  8. m := &model.PlanReward{}
  9. if isGet, err := eg.Where("pvd = ?", pvd).Get(m); err != nil || !isGet {
  10. return nil, logx.Warn(err)
  11. }
  12. return m, nil
  13. }
  14. func DbsPlanRewardByPvds(eg *xorm.Engine, pvds ...string) ([]*model.PlanReward, error) {
  15. var m []*model.PlanReward
  16. var err error
  17. if len(pvds) > 0 {
  18. err = eg.In("pvd", pvds).Find(&m)
  19. } else {
  20. err = eg.Find(&m)
  21. }
  22. if err != nil {
  23. return nil, err
  24. }
  25. return m, nil
  26. }
  27. // 查询使用自动结算的平台
  28. func DbsPlanRewardIsAutoSettle(eg *xorm.Engine) ([]*model.PlanReward, error) {
  29. var m []*model.PlanReward
  30. var err error
  31. if err = eg.In("pvd", "mall_goods", "mall_group_buy", "mall_goods_user_lv").Where(" settle_mode=? AND plan_settle_id<>?", 1, 0).Find(&m); err != nil {
  32. return nil, logx.Warn(err)
  33. }
  34. return m, nil
  35. }
  36. // 查出开启的渠道
  37. func DbsPlanRewardIsOpen(eg *xorm.Engine) ([]*model.PlanReward, error) {
  38. var m []*model.PlanReward
  39. var err error
  40. if err = eg.Where(" state=?", 1).Find(&m); err != nil {
  41. return nil, logx.Warn(err)
  42. }
  43. return m, nil
  44. }