优惠券额度包
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.

27 lines
689 B

  1. package db
  2. import (
  3. "coupon/db/model"
  4. "coupon/utils"
  5. "coupon/utils/logx"
  6. "xorm.io/xorm"
  7. )
  8. func GetCouponUserTotalByLeaveSumWithType(Db *xorm.Engine, uid int, pvdType, cols string) (float64, error) {
  9. var m model.CommCouponUserTotal
  10. total, err := Db.Where("uid = "+utils.IntToStr(uid)+" and (pvd_type LIKE '%"+pvdType+"%' or pvd_type='ordinary' )").Sum(m, cols)
  11. if err != nil {
  12. return 0, err
  13. }
  14. return total, err
  15. }
  16. //查询记录
  17. func CommCouponBaseList(Db *xorm.Engine) (*model.CommCoupon, error) {
  18. var CommCouponBaseList model.CommCoupon
  19. if has, err := Db.Get(&CommCouponBaseList); err != nil || !has {
  20. return nil, logx.Error(err)
  21. }
  22. return &CommCouponBaseList, nil
  23. }