package db import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_coupon.git/db/model" "code.fnuoos.com/go_rely_warehouse/zyos_go_coupon.git/utils" "fmt" "xorm.io/xorm" ) func GetCouponUserTotalByLeaveSumWithType(Db *xorm.Engine, uid int, pvdType, cols string) (float64, error) { var m model.CommCouponUserTotal total, err := Db.Where("uid = "+utils.IntToStr(uid)+" and (pvd_type LIKE '%"+pvdType+"%' or pvd_type='ordinary' )").Sum(m, cols) if err != nil { fmt.Println(err) return 0, err } return total, err } //查询记录 func CommCouponBaseList(Db *xorm.Engine) (*model.CommCoupon, error) { var CommCouponBaseList model.CommCoupon if has, err := Db.Get(&CommCouponBaseList); err != nil || !has { fmt.Println(err) return nil, err } return &CommCouponBaseList, nil }