优惠券额度包
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_coupon_comm_check.go 824 B

2 years ago
1234567891011121314151617181920212223242526
  1. package db
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_coupon.git/db/model"
  4. "code.fnuoos.com/go_rely_warehouse/zyos_go_coupon.git/utils"
  5. "code.fnuoos.com/go_rely_warehouse/zyos_go_coupon.git/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. }