修改了优惠卷数据
This commit is contained in:
parent
d305df4a23
commit
3dce6ebfc8
@ -11,6 +11,7 @@ import (
|
||||
"hepa-calc-admin-api/global"
|
||||
"hepa-calc-admin-api/utils"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -84,6 +85,9 @@ func (b *Coupon) GetCoupon(c *gin.Context) {
|
||||
// 处理返回值
|
||||
g := dto.GetCouponDto(coupon)
|
||||
|
||||
// 加载会员id
|
||||
g.LoadSystemMemberIds(coupon.SystemMemberIds)
|
||||
|
||||
responses.OkWithData(g, c)
|
||||
}
|
||||
|
||||
@ -174,29 +178,32 @@ func (r *Coupon) AddSystemCoupon(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 适用范围(1:全场通用 2:单项 3:会员)
|
||||
if req.ApplicationScope == 1 {
|
||||
// 全场通用
|
||||
if req.QuestionId == nil && req.SystemMemberId == nil {
|
||||
responses.FailWithMessage("请填入关联选项", c)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if req.ApplicationScope == 2 {
|
||||
// 单项
|
||||
if req.QuestionId == nil {
|
||||
responses.FailWithMessage("请填入关联算一算", c)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 适用范围(1:全场通用 2:单项 3:会员)
|
||||
systemMemberIds := make([]string, len(req.SystemMemberIds))
|
||||
if req.ApplicationScope == 3 {
|
||||
// 会员
|
||||
if req.SystemMemberId == nil {
|
||||
if req.SystemMemberIds == nil {
|
||||
responses.FailWithMessage("请填入关联会员", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 关联会员id
|
||||
systemMemberDao := dao.SystemMemberDao{}
|
||||
|
||||
for i, id := range req.SystemMemberIds {
|
||||
systemMemberId, err := strconv.ParseInt(*id, 10, 64)
|
||||
if err != nil {
|
||||
responses.FailWithMessage("新增失败", c)
|
||||
return
|
||||
}
|
||||
|
||||
systemMember, err := systemMemberDao.GetSystemMemberById(systemMemberId)
|
||||
if err != nil || systemMember == nil {
|
||||
responses.FailWithMessage("新增失败", c)
|
||||
return
|
||||
}
|
||||
|
||||
systemMemberIds[i] = *id
|
||||
}
|
||||
}
|
||||
|
||||
// 有效类型-绝对时效
|
||||
@ -244,8 +251,7 @@ func (r *Coupon) AddSystemCoupon(c *gin.Context) {
|
||||
ValidStartTime: nil,
|
||||
ValidEndTime: nil,
|
||||
CouponDesc: req.CouponDesc,
|
||||
QuestionId: nil,
|
||||
SystemMemberId: nil,
|
||||
SystemMemberIds: strings.Join(systemMemberIds, ","),
|
||||
}
|
||||
|
||||
// 符合满减标准金额
|
||||
@ -310,30 +316,6 @@ func (r *Coupon) AddSystemCoupon(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// 关联单项id
|
||||
if req.QuestionId != nil {
|
||||
questionId, err := strconv.ParseInt(*req.QuestionId, 10, 64)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
responses.FailWithMessage("新增失败", c)
|
||||
return
|
||||
}
|
||||
|
||||
coupon.QuestionId = &questionId
|
||||
}
|
||||
|
||||
// 关联会员id
|
||||
if req.SystemMemberId != nil {
|
||||
systemMemberId, err := strconv.ParseInt(*req.SystemMemberId, 10, 64)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
responses.FailWithMessage("新增失败", c)
|
||||
return
|
||||
}
|
||||
|
||||
coupon.QuestionId = &systemMemberId
|
||||
}
|
||||
|
||||
couponDao := dao.CouponDao{}
|
||||
coupon, err := couponDao.AddCoupon(tx, coupon)
|
||||
if err != nil || coupon == nil {
|
||||
|
||||
@ -3,6 +3,7 @@ package dto
|
||||
import (
|
||||
"fmt"
|
||||
"hepa-calc-admin-api/api/model"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CouponDto struct {
|
||||
@ -21,6 +22,7 @@ type CouponDto struct {
|
||||
ValidDays int `json:"valid_days"` // 自领取之日起有效天数
|
||||
ValidStartTime *model.LocalTime `json:"valid_start_time"` // 开始使用时间
|
||||
ValidEndTime *model.LocalTime `json:"valid_end_time"` // 结束使用时间
|
||||
SystemMemberIds []*string `json:"system_member_ids"` // 会员id(适用范围为会员时生效,如果此项为null,则表示所有会员通用)
|
||||
CouponDesc string `json:"coupon_desc"` // 优惠券描述
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
@ -60,6 +62,11 @@ func GetCouponListDto(m []*model.Coupon) []*CouponDto {
|
||||
response.ValidDays = *v.ValidDays
|
||||
}
|
||||
|
||||
// 加载会员id
|
||||
if v.SystemMemberIds != "" {
|
||||
response = response.LoadSystemMemberIds(v.SystemMemberIds)
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
@ -99,3 +106,21 @@ func GetCouponDto(m *model.Coupon) *CouponDto {
|
||||
|
||||
return response
|
||||
}
|
||||
|
||||
// LoadSystemMemberIds 加载会员id
|
||||
func (r *CouponDto) LoadSystemMemberIds(systemMemberIds string) *CouponDto {
|
||||
if systemMemberIds != "" {
|
||||
s := strings.Split(systemMemberIds, ",")
|
||||
|
||||
response := make([]*string, len(s))
|
||||
|
||||
for i, v := range s {
|
||||
h := fmt.Sprintf("%v", v)
|
||||
response[i] = &h
|
||||
}
|
||||
|
||||
r.SystemMemberIds = response
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
@ -24,9 +24,6 @@ type QuestionDto struct {
|
||||
QuestionExplain string `json:"question_explain"` // 问题解释/科普
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
IsCollection bool `json:"is_collection"` // 用户是否收藏
|
||||
FirstTimePrice *float64 `json:"first_time_price"` // 首次购买价格
|
||||
BuyCount int `json:"buy_count"` // 被购买数量
|
||||
BaseClass []*BaseClassDto `json:"base_class"` // 关联分类
|
||||
}
|
||||
|
||||
@ -112,76 +109,3 @@ func GetHotQuestionListDto(m []*model.Question) []*QuestionDto {
|
||||
|
||||
return responses
|
||||
}
|
||||
|
||||
// GetRecommendQuestionListDto 列表-为你推荐
|
||||
func GetRecommendQuestionListDto(m []*model.Question) []*QuestionDto {
|
||||
// 处理返回值
|
||||
responses := make([]*QuestionDto, len(m))
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &QuestionDto{
|
||||
QuestionId: fmt.Sprintf("%d", v.QuestionId),
|
||||
QuestionTitle: v.QuestionTitle,
|
||||
QuestionSubtitle: v.QuestionSubtitle,
|
||||
QuestionIden: v.QuestionIden,
|
||||
ClickCount: v.ClickCount,
|
||||
SubmitCount: v.SubmitCount,
|
||||
PayCount: v.PayCount,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return responses
|
||||
}
|
||||
|
||||
// GetGuessUserLikeListDto 列表-猜你喜欢
|
||||
func GetGuessUserLikeListDto(m []*model.Question) []*QuestionDto {
|
||||
// 处理返回值
|
||||
responses := make([]*QuestionDto, len(m))
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &QuestionDto{
|
||||
QuestionId: fmt.Sprintf("%d", v.QuestionId),
|
||||
QuestionTitle: v.QuestionTitle,
|
||||
QuestionSubtitle: v.QuestionSubtitle,
|
||||
QuestionIden: v.QuestionIden,
|
||||
ClickCount: v.ClickCount,
|
||||
SubmitCount: v.SubmitCount,
|
||||
PayCount: v.PayCount,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return responses
|
||||
}
|
||||
|
||||
// LoadIsCollection 加载数据-是否收藏
|
||||
func (r *QuestionDto) LoadIsCollection(isCollection bool) *QuestionDto {
|
||||
r.IsCollection = isCollection
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadFirstTimePrice 加载数据-首次购买价格
|
||||
func (r *QuestionDto) LoadFirstTimePrice(firstTimePrice *float64) *QuestionDto {
|
||||
if firstTimePrice != nil {
|
||||
r.FirstTimePrice = firstTimePrice
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadBuyCount 加载数据-问题被购买数量
|
||||
func (r *QuestionDto) LoadBuyCount(buyCount int) *QuestionDto {
|
||||
r.BuyCount = buyCount
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
@ -9,23 +9,26 @@ import (
|
||||
|
||||
// UserDto 用户表
|
||||
type UserDto struct {
|
||||
UserId string `json:"user_id"` // 用户id
|
||||
UserName string `json:"user_name"` // 用户名称
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
UserStatus int `json:"user_status"` // 状态(1:正常 2:禁用)
|
||||
RegisterSource int `json:"register_source"` // 注册来源(1:app注册 2:公众号注册)
|
||||
OpenId string `json:"open_id"` // 用户微信标识
|
||||
UnionId string `json:"union_id"` // 微信开放平台标识
|
||||
Age *uint `json:"age"` // 年龄
|
||||
Sex uint `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
IsMember int `json:"is_member"` // 是否会员(0:否 1:是)
|
||||
MemberExpireDate *time.Time `json:"member_expire_date"` // 会员到期时间(非会员时为null)
|
||||
LoginAt model.LocalTime `json:"login_at"` // 登陆时间
|
||||
LoginIp string `json:"login_ip"` // 登陆ip
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
IsInfoComplete int `json:"is_info_complete"` // 信息完善状态 0:否 1:是
|
||||
UserId string `json:"user_id"` // 用户id
|
||||
UserName string `json:"user_name"` // 用户名称
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
UserStatus int `json:"user_status"` // 状态(1:正常 2:禁用)
|
||||
RegisterSource int `json:"register_source"` // 注册来源(1:app注册 2:公众号注册)
|
||||
OpenId string `json:"open_id"` // 用户微信标识
|
||||
UnionId string `json:"union_id"` // 微信开放平台标识
|
||||
Age *uint `json:"age"` // 年龄
|
||||
Sex uint `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
IsMember int `json:"is_member"` // 是否会员(0:否 1:是)
|
||||
MemberExpireDate *time.Time `json:"member_expire_date"` // 会员到期时间(非会员时为null)
|
||||
SingleSubmitCount int `json:"single_submit_count"` // 单项提交次数(提交个人信息进行了算算的人次)
|
||||
SinglePayCount int `json:"single_pay_count"` // 单项支付次数(查看报告的人次)
|
||||
MemberBuyCount int `json:"member_buy_count"` // 会员购买次数
|
||||
LoginAt model.LocalTime `json:"login_at"` // 登陆时间
|
||||
LoginIp string `json:"login_ip"` // 登陆ip
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
IsInfoComplete int `json:"is_info_complete"` // 信息完善状态 0:否 1:是
|
||||
}
|
||||
|
||||
// GetUserListDto 列表
|
||||
@ -36,20 +39,23 @@ func GetUserListDto(m []*model.User) []*UserDto {
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &UserDto{
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
UserName: v.UserName,
|
||||
Mobile: v.Mobile,
|
||||
UserStatus: v.UserStatus,
|
||||
RegisterSource: v.RegisterSource,
|
||||
Age: v.Age,
|
||||
Sex: uint(v.Sex),
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
IsMember: v.IsMember,
|
||||
MemberExpireDate: v.MemberExpireDate,
|
||||
LoginAt: v.LoginAt,
|
||||
LoginIp: v.LoginIp,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
UserId: fmt.Sprintf("%d", v.UserId),
|
||||
UserName: v.UserName,
|
||||
Mobile: v.Mobile,
|
||||
UserStatus: v.UserStatus,
|
||||
RegisterSource: v.RegisterSource,
|
||||
Age: v.Age,
|
||||
Sex: uint(v.Sex),
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
IsMember: v.IsMember,
|
||||
MemberExpireDate: v.MemberExpireDate,
|
||||
SingleSubmitCount: v.SingleSubmitCount,
|
||||
SinglePayCount: v.SinglePayCount,
|
||||
MemberBuyCount: v.MemberBuyCount,
|
||||
LoginAt: v.LoginAt,
|
||||
LoginIp: v.LoginIp,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 加载信息完善状态
|
||||
@ -68,20 +74,23 @@ func GetUserListDto(m []*model.User) []*UserDto {
|
||||
// GetUserDto 详情-问题
|
||||
func GetUserDto(m *model.User) *UserDto {
|
||||
return &UserDto{
|
||||
UserId: fmt.Sprintf("%d", m.UserId),
|
||||
UserName: m.UserName,
|
||||
Mobile: m.Mobile,
|
||||
UserStatus: m.UserStatus,
|
||||
RegisterSource: m.RegisterSource,
|
||||
Age: m.Age,
|
||||
Sex: uint(m.Sex),
|
||||
Avatar: utils.AddOssDomain(m.Avatar),
|
||||
IsMember: m.IsMember,
|
||||
MemberExpireDate: m.MemberExpireDate,
|
||||
LoginAt: m.LoginAt,
|
||||
LoginIp: m.LoginIp,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
UserId: fmt.Sprintf("%d", m.UserId),
|
||||
UserName: m.UserName,
|
||||
Mobile: m.Mobile,
|
||||
UserStatus: m.UserStatus,
|
||||
RegisterSource: m.RegisterSource,
|
||||
Age: m.Age,
|
||||
Sex: uint(m.Sex),
|
||||
Avatar: utils.AddOssDomain(m.Avatar),
|
||||
IsMember: m.IsMember,
|
||||
MemberExpireDate: m.MemberExpireDate,
|
||||
SingleSubmitCount: m.SingleSubmitCount,
|
||||
SinglePayCount: m.SinglePayCount,
|
||||
MemberBuyCount: m.MemberBuyCount,
|
||||
LoginAt: m.LoginAt,
|
||||
LoginIp: m.LoginIp,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -73,6 +73,9 @@ func (r *UserCouponDto) LoadCoupon(m *model.Coupon) *UserCouponDto {
|
||||
if m != nil {
|
||||
d := GetCouponDto(m)
|
||||
|
||||
// 加载会员id
|
||||
d.LoadSystemMemberIds(m.SystemMemberIds)
|
||||
|
||||
r.Coupon = d
|
||||
}
|
||||
return r
|
||||
|
||||
@ -22,8 +22,7 @@ type Coupon struct {
|
||||
ValidDays *int `gorm:"column:valid_days;type:int(3);comment:自领取之日起有效天数" json:"valid_days"`
|
||||
ValidStartTime *LocalTime `gorm:"column:valid_start_time;type:datetime;comment:开始使用时间" json:"valid_start_time"`
|
||||
ValidEndTime *LocalTime `gorm:"column:valid_end_time;type:datetime;comment:结束使用时间" json:"valid_end_time"`
|
||||
QuestionId *int64 `gorm:"column:question_id;type:bigint(19);comment:问题id(适用范围为单项时生效,如果此项为null,则表示所有单项通用)" json:"question_id"`
|
||||
SystemMemberId *int64 `gorm:"column:system_member_id;type:bigint(19);comment:会员id(适用范围为会员时生效,如果此项为null,则表示所有会员通用)" json:"system_member_id"`
|
||||
SystemMemberIds string `gorm:"column:system_member_ids;type:bigint(19);comment:会员id(适用范围为会员时生效,如果此项为null,则表示所有会员通用)" json:"system_member_ids"`
|
||||
CouponDesc string `gorm:"column:coupon_desc;type:varchar(200);comment:优惠卷描述" json:"coupon_desc"`
|
||||
Model
|
||||
}
|
||||
|
||||
@ -26,18 +26,17 @@ type PutCouponStatus struct {
|
||||
|
||||
// AddSystemCoupon 新增系统优惠卷
|
||||
type AddSystemCoupon struct {
|
||||
CouponName string `json:"coupon_name" form:"coupon_name" label:"优惠券名称" validate:"required"`
|
||||
CouponType int `json:"coupon_type" form:"coupon_type" label:"优惠券类型" validate:"required,oneof=1 2"` // (1:无门槛 2:满减)
|
||||
ApplicationScope int `json:"application_scope" form:"application_scope" label:"适用范围" validate:"required,oneof=1 2 3"` // 适用范围(1:全场通用 2:单项 3:会员)
|
||||
IsMutex int `json:"is_mutex" form:"is_mutex" label:"是否互斥" validate:"required,oneof=0 1"` // (0:否 1:是)
|
||||
CouponCount int `json:"coupon_count" form:"coupon_count" label:"发放数量" validate:"required,number,min=1"`
|
||||
CouponPrice float64 `json:"coupon_price" form:"coupon_price" label:"优惠券金额" validate:"required,numeric,gt=0"`
|
||||
WithAmount *float64 `json:"with_amount" form:"with_amount" label:"满减条件金额" validate:"omitempty,gt=1"`
|
||||
ValidType int `json:"valid_type" form:"valid_type" label:"有效类型" validate:"required,oneof=1 2"` // (1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||
ValidDays *int `json:"valid_days" form:"valid_days" label:"有效天数" validate:"omitempty,numeric,min=1"`
|
||||
ValidStartTime *string `json:"valid_start_time" form:"valid_start_time" label:"开始使用时间"` // 假设转换为字符串格式
|
||||
ValidEndTime *string `json:"valid_end_time" form:"valid_end_time" label:"结束使用时间"` // 假设转换为字符串格式
|
||||
QuestionId *string `json:"question_id" form:"question_id" label:"问题id"` // 从int64转换为string
|
||||
SystemMemberId *string `json:"system_member_id" form:"system_member_id" label:"会员id"` // 从int64转换为string
|
||||
CouponDesc string `json:"coupon_desc" form:"coupon_desc" label:"优惠券描述"`
|
||||
CouponName string `json:"coupon_name" form:"coupon_name" label:"优惠券名称" validate:"required"`
|
||||
CouponType int `json:"coupon_type" form:"coupon_type" label:"优惠券类型" validate:"required,oneof=1 2"` // (1:无门槛 2:满减)
|
||||
ApplicationScope int `json:"application_scope" form:"application_scope" label:"适用范围" validate:"required,oneof=1 2 3"` // 适用范围(1:全场通用 2:单项 3:会员)
|
||||
IsMutex int `json:"is_mutex" form:"is_mutex" label:"是否互斥" validate:"required,oneof=0 1"` // (0:否 1:是)
|
||||
CouponCount int `json:"coupon_count" form:"coupon_count" label:"发放数量" validate:"required,number,min=1"`
|
||||
CouponPrice float64 `json:"coupon_price" form:"coupon_price" label:"优惠券金额" validate:"required,numeric,gt=0"`
|
||||
WithAmount *float64 `json:"with_amount" form:"with_amount" label:"满减条件金额" validate:"omitempty,gt=1"`
|
||||
ValidType int `json:"valid_type" form:"valid_type" label:"有效类型" validate:"required,oneof=1 2"` // (1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||
ValidDays *int `json:"valid_days" form:"valid_days" label:"有效天数" validate:"omitempty,numeric,min=1"`
|
||||
ValidStartTime *string `json:"valid_start_time" form:"valid_start_time" label:"开始使用时间"` // 假设转换为字符串格式
|
||||
ValidEndTime *string `json:"valid_end_time" form:"valid_end_time" label:"结束使用时间"` // 假设转换为字符串格式
|
||||
SystemMemberIds []*string `json:"system_member_ids" form:"system_member_ids" label:"会员id"` // 会员id(逗号分割)
|
||||
CouponDesc string `json:"coupon_desc" form:"coupon_desc" label:"优惠券描述"`
|
||||
}
|
||||
|
||||
@ -38,8 +38,6 @@ type GetQuestionPageOrder struct {
|
||||
|
||||
// GetQuestionList 获取问题列表
|
||||
type GetQuestionList struct {
|
||||
Page int `json:"page" form:"page" label:"页码"`
|
||||
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||
QuestionId string `json:"question_id" form:"question_id" label:"主键id"`
|
||||
QuestionTitle string `json:"question_title" form:"question_title" label:"标题"`
|
||||
QuestionSubtitle string `json:"question_subtitle" form:"question_subtitle" label:"副标题"`
|
||||
|
||||
@ -2,10 +2,12 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"gorm.io/gorm"
|
||||
"hepa-calc-admin-api/api/dao"
|
||||
"hepa-calc-admin-api/api/dto"
|
||||
"hepa-calc-admin-api/api/model"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -58,10 +60,6 @@ func (r *UserCouponService) CheckUserCoupon(m *model.UserCoupon, id int64, order
|
||||
if m.Coupon.ApplicationScope != 1 && m.Coupon.ApplicationScope != 2 {
|
||||
return false, errors.New("优惠卷无法使用")
|
||||
}
|
||||
|
||||
if id != *m.Coupon.QuestionId {
|
||||
return false, errors.New("优惠卷无法使用")
|
||||
}
|
||||
}
|
||||
|
||||
// 会员
|
||||
@ -70,7 +68,9 @@ func (r *UserCouponService) CheckUserCoupon(m *model.UserCoupon, id int64, order
|
||||
return false, errors.New("优惠卷无法使用")
|
||||
}
|
||||
|
||||
if id != *m.Coupon.SystemMemberId {
|
||||
systemMemberIds := fmt.Sprintf("%d", id)
|
||||
res := strings.Contains(m.Coupon.SystemMemberIds, systemMemberIds)
|
||||
if res == false {
|
||||
return false, errors.New("优惠卷无法使用")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user