Browse Source

Merge remote-tracking branch 'origin/master'

master
huangjiajun 13 hours ago
parent
commit
e57bae58f5
2 changed files with 15 additions and 0 deletions
  1. +1
    -0
      src/dao/new_user_red_package_with_user_records_dao.go
  2. +14
    -0
      src/implement/new_user_red_package_with_user_records_implement.go

+ 1
- 0
src/dao/new_user_red_package_with_user_records_dao.go View File

@@ -5,4 +5,5 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
type NewUserRedPackageWithUserRecordsDao interface { type NewUserRedPackageWithUserRecordsDao interface {
//TODO:: You can add specific method definitions here //TODO:: You can add specific method definitions here
NewUserRedPackageWithUserRecordsFind(page, limit int, uid int64, startAt, endAt string) (*[]model.NewUserRedPackageWithUserRecords, int64, error) NewUserRedPackageWithUserRecordsFind(page, limit int, uid int64, startAt, endAt string) (*[]model.NewUserRedPackageWithUserRecords, int64, error)
NewUserRedPackageWithUserRecordsGetLastPendingByParams(params map[string]interface{}) (*model.NewUserRedPackageWithUserRecords, error)
} }

+ 14
- 0
src/implement/new_user_red_package_with_user_records_implement.go View File

@@ -4,6 +4,7 @@ import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"fmt"
"xorm.io/xorm" "xorm.io/xorm"
) )


@@ -33,3 +34,16 @@ func (n NewUserRedPackageWithUserRecordsDb) NewUserRedPackageWithUserRecordsFind
} }
return &m, total, nil return &m, total, nil
} }

func (n NewUserRedPackageWithUserRecordsDb) NewUserRedPackageWithUserRecordsGetLastPendingByParams(params map[string]interface{}) (*model.NewUserRedPackageWithUserRecords, error) {
var m model.NewUserRedPackageWithUserRecords
query := fmt.Sprintf("%s = ?", params["key"])
has, err := n.Db.Where(query, params["value"]).And("state = ? OR state = ?", 0, 1).Desc("create_at").Get(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if !has {
return nil, nil
}
return &m, nil
}

Loading…
Cancel
Save