|
- package db
-
- import (
- "xorm.io/xorm"
-
- "applet/app/db/model"
- "applet/app/utils/logx"
- )
-
- func DbsPlanRewardByPvd(eg *xorm.Engine, pvd string) (*model.PlanReward, error) {
- m := &model.PlanReward{}
- if isGet, err := eg.Where("pvd = ?", pvd).Get(m); err != nil || !isGet {
- return nil, logx.Warn(err)
- }
-
- return m, nil
- }
-
- func DbsPlanRewardByPvds(eg *xorm.Engine, pvds ...string) ([]*model.PlanReward, error) {
- var m []*model.PlanReward
- var err error
- if len(pvds) > 0 {
- err = eg.In("pvd", pvds).Find(&m)
- } else {
- err = eg.Find(&m)
- }
- if err != nil {
- return nil, err
- }
- return m, nil
- }
-
- // 查询使用自动结算的平台
- func DbsPlanRewardIsAutoSettle(eg *xorm.Engine) ([]*model.PlanReward, error) {
- var m []*model.PlanReward
- var err error
- 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 {
- return nil, logx.Warn(err)
- }
- return m, nil
- }
-
- // 查出开启的渠道
- func DbsPlanRewardIsOpen(eg *xorm.Engine) ([]*model.PlanReward, error) {
- var m []*model.PlanReward
- var err error
- if err = eg.Where(" state=?", 1).Find(&m); err != nil {
- return nil, logx.Warn(err)
- }
- return m, nil
- }
|