|
- package db
-
- import (
- "coupon/db/model"
- "coupon/utils"
- "coupon/utils/logx"
- "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 {
- 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 {
- return nil, logx.Error(err)
- }
- return &CommCouponBaseList, nil
- }
|