@@ -2,7 +2,7 @@ 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"
zhios_tool_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_tools .git/utils"
"xorm.io/xorm"
)
@@ -24,14 +24,14 @@ func GetCouponUserByUid(Db *xorm.Engine, uid string) (*[]model.CommCouponUserTot
func GetCouponUserTotalByLeaveSumWithTypeSession(session *xorm.Session, uid int, pvdType string) (*[]model.CommCouponUserTotal, error) {
var m []model.CommCouponUserTotal
if err := session.Where("uid = " + utils.IntToStr(uid) + " and leave_coupon_amount_value>=0 and (pvd_type LIKE '%" + pvdType + "%' or pvd_type='ordinary' )").Asc("leave_coupon_amount_value").Find(&m); err != nil {
if err := session.Where("uid = " + zhios_tool_ utils.IntToStr(uid) + " and leave_coupon_amount_value>=0 and (pvd_type LIKE '%" + pvdType + "%' or pvd_type='ordinary' )").Asc("leave_coupon_amount_value").Find(&m); err != nil {
return nil, err
}
return &m, nil
}
func GetCouponUserTotalByNegative(Db *xorm.Engine, uid int, pvdType, cols string) (float64, error) {
var m model.CommCouponUserTotal
total, err := Db.Where("uid = "+utils.IntToStr(uid)+" and leave_coupon_amount_value<0 and (pvd_type LIKE '%"+pvdType+"%' or pvd_type='ordinary' )").Sum(m, cols)
total, err := Db.Where("uid = "+zhios_tool_ utils.IntToStr(uid)+" and leave_coupon_amount_value<0 and (pvd_type LIKE '%"+pvdType+"%' or pvd_type='ordinary' )").Sum(m, cols)
if err != nil {
return 0, err
}