Compare commits
10 Commits
f1b66e7d14
...
64d0305e32
| Author | SHA1 | Date | |
|---|---|---|---|
| 64d0305e32 | |||
| 9c7c53f93c | |||
| ac74c0d59f | |||
| 6a0aa360f3 | |||
| 7cbe9beaba | |||
| d46244ea0c | |||
| 01aa915c30 | |||
| dcb2d6a988 | |||
| 79de15f061 | |||
| 3eaeddfd38 |
@ -238,20 +238,21 @@ func (r *Coupon) AddSystemCoupon(c *gin.Context) {
|
||||
|
||||
// 新增优惠卷表
|
||||
coupon := &model.Coupon{
|
||||
CouponName: req.CouponName,
|
||||
CouponType: req.CouponType,
|
||||
CouponStatus: 1,
|
||||
ApplicationScope: req.ApplicationScope,
|
||||
IsMutex: req.IsMutex,
|
||||
CouponCount: req.CouponCount,
|
||||
CouponTakeCount: 0,
|
||||
CouponUsedCount: 0,
|
||||
CouponPrice: req.CouponPrice,
|
||||
ValidType: req.ValidType,
|
||||
ValidStartTime: nil,
|
||||
ValidEndTime: nil,
|
||||
CouponDesc: req.CouponDesc,
|
||||
SystemMemberIds: strings.Join(systemMemberIds, ","),
|
||||
CouponName: req.CouponName,
|
||||
CouponType: req.CouponType,
|
||||
CouponStatus: 1,
|
||||
ApplicationScope: req.ApplicationScope,
|
||||
DistributionObject: req.DistributionObject,
|
||||
IsMutex: req.IsMutex,
|
||||
CouponCount: req.CouponCount,
|
||||
CouponTakeCount: 0,
|
||||
CouponUsedCount: 0,
|
||||
CouponPrice: req.CouponPrice,
|
||||
ValidType: req.ValidType,
|
||||
ValidStartTime: nil,
|
||||
ValidEndTime: nil,
|
||||
CouponDesc: req.CouponDesc,
|
||||
SystemMemberIds: strings.Join(systemMemberIds, ","),
|
||||
}
|
||||
|
||||
// 符合满减标准金额
|
||||
|
||||
@ -13,6 +13,7 @@ import (
|
||||
"hepa-calc-admin-api/extend/aliyun"
|
||||
"hepa-calc-admin-api/global"
|
||||
"hepa-calc-admin-api/utils"
|
||||
"math"
|
||||
"sort"
|
||||
"time"
|
||||
)
|
||||
@ -200,7 +201,7 @@ func (b *Public) GetIndex(c *gin.Context) {
|
||||
MemberBuyCount: memberBuyCount,
|
||||
MemberAmountTotal: memberAmountTotal,
|
||||
SingleAmountTotal: singleAmountTotal,
|
||||
AmountTotal: memberAmountTotal + singleAmountTotal,
|
||||
AmountTotal: math.Round((memberAmountTotal+singleAmountTotal)*100) / 100,
|
||||
}
|
||||
|
||||
responses.OkWithData(g, c)
|
||||
|
||||
@ -10,7 +10,9 @@ import (
|
||||
"hepa-calc-admin-api/api/service"
|
||||
"hepa-calc-admin-api/global"
|
||||
"hepa-calc-admin-api/utils"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Question struct{}
|
||||
@ -549,3 +551,54 @@ func (b *Question) PutQuestionHideStatus(c *gin.Context) {
|
||||
tx.Commit()
|
||||
responses.Ok(c)
|
||||
}
|
||||
|
||||
// GetQuestionPrice 获取问题价格
|
||||
func (b *Question) GetQuestionPrice(c *gin.Context) {
|
||||
// 获取问题数据
|
||||
questionDao := dao.QuestionDao{}
|
||||
maps := make(map[string]interface{})
|
||||
maps["question_status"] = 1
|
||||
questions, err := questionDao.GetQuestionList(maps)
|
||||
if err != nil {
|
||||
responses.FailWithMessage("分类异常", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 计算总价
|
||||
var price float64
|
||||
var discountPrice *float64
|
||||
|
||||
for _, question := range questions {
|
||||
// 总价
|
||||
price = price + math.Round(question.Price*100)
|
||||
|
||||
// 处理折扣价格
|
||||
if question.DiscountPrice != nil {
|
||||
if question.DiscountEndTime != nil {
|
||||
discountEndTime := time.Time(*question.DiscountEndTime)
|
||||
diffTime := time.Now().Sub(discountEndTime)
|
||||
if diffTime > 0 {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
d := math.Round(*question.DiscountPrice * 100)
|
||||
|
||||
if discountPrice == nil {
|
||||
discountPrice = &d
|
||||
} else {
|
||||
d = d + *discountPrice
|
||||
discountPrice = &d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var g dto.QuestionPriceDto
|
||||
g.Price = price / 100
|
||||
if discountPrice != nil {
|
||||
u := *discountPrice / 100
|
||||
g.DiscountPrice = &u
|
||||
}
|
||||
|
||||
responses.OkWithData(g, c)
|
||||
}
|
||||
|
||||
@ -239,6 +239,11 @@ func (r *AdminUser) PutAdminUser(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if loginUserId == userId && (req.Status == 1 || req.Status == 2 || req.Status == 3) {
|
||||
responses.FailWithMessage("不可修改自己用户状态", c)
|
||||
return
|
||||
}
|
||||
|
||||
if loginUserId != userId && loginAdminUser.IsAdmin != 1 {
|
||||
responses.FailWithMessage("非管理员用户只可修改自己数据", c)
|
||||
return
|
||||
@ -285,6 +290,7 @@ func (r *AdminUser) PutAdminUser(c *gin.Context) {
|
||||
|
||||
data := make(map[string]interface{})
|
||||
data["access"] = req.Access
|
||||
data["status"] = req.Status
|
||||
data["is_deleted"] = req.IsDeleted
|
||||
data["is_disabled"] = req.IsDisabled
|
||||
data["nick_name"] = req.NickName
|
||||
|
||||
@ -140,6 +140,11 @@ func (r *AdminUserDao) GetAdminUserPageSearch(req requests.GetAdminUserPage, pag
|
||||
query = query.Where("is_disabled = ?", req.IsDisabled)
|
||||
}
|
||||
|
||||
// 是否管理员
|
||||
if req.IsAdmin != nil {
|
||||
query = query.Where("is_admin = ?", req.IsAdmin)
|
||||
}
|
||||
|
||||
// 手机号
|
||||
if req.Phone != "" {
|
||||
query = query.Where("phone LIKE ?", "%"+req.Phone+"%")
|
||||
|
||||
@ -271,6 +271,14 @@ func (r *QuestionDao) GetQuestionPageSearch(req requests.GetQuestionPage, page,
|
||||
query = query.Order("discount_price " + req.Order.DiscountPrice)
|
||||
}
|
||||
|
||||
if req.Order.CreatedAt != "" {
|
||||
if req.Order.CreatedAt != "desc" && req.Order.CreatedAt != "asc" {
|
||||
return nil, 0, errors.New("排序字段错误")
|
||||
}
|
||||
|
||||
query = query.Order("created_at " + req.Order.CreatedAt)
|
||||
}
|
||||
|
||||
if req.Order.UpdatedAt != "" {
|
||||
if req.Order.UpdatedAt != "desc" && req.Order.UpdatedAt != "asc" {
|
||||
return nil, 0, errors.New("排序字段错误")
|
||||
|
||||
@ -184,15 +184,25 @@ func (r *UserDao) GetUserPageSearch(req requests.GetUserPage, page, pageSize int
|
||||
|
||||
// 信息完善状态
|
||||
if req.IsInfoComplete != nil {
|
||||
subQuery := global.Db.Model(&model.UserInfo{}).
|
||||
Where("user_info.user_id = user.user_id").
|
||||
Where("user_info.height != '' ").
|
||||
Where("user_info.weight != '' ").
|
||||
Where("user_info.is_family_history is not NULL").
|
||||
Where("user_info.province_id is not NULL").
|
||||
Select("1")
|
||||
|
||||
query = query.Where("EXISTS (?)", subQuery)
|
||||
if *req.IsInfoComplete == true {
|
||||
subQuery := global.Db.Model(&model.UserInfo{}).
|
||||
Where("user_info.user_id = user.user_id").
|
||||
Where("user_info.height != '' ").
|
||||
Where("user_info.weight != '' ").
|
||||
Where("user_info.is_family_history is not NULL").
|
||||
Where("user_info.province_id is not NULL").
|
||||
Select("1")
|
||||
query = query.Where("EXISTS (?)", subQuery)
|
||||
} else {
|
||||
subQuery := global.Db.Model(&model.UserInfo{}).
|
||||
Where("user_info.user_id = user.user_id").
|
||||
Or("user_info.height = '' ").
|
||||
Or("user_info.weight = '' ").
|
||||
Or("user_info.is_family_history is NULL").
|
||||
Or("user_info.province_id is NULL").
|
||||
Select("1")
|
||||
query = query.Where("EXISTS (?)", subQuery)
|
||||
}
|
||||
}
|
||||
|
||||
// 排序
|
||||
|
||||
@ -7,25 +7,26 @@ import (
|
||||
)
|
||||
|
||||
type CouponDto struct {
|
||||
CouponId string `json:"coupon_id"` // 主键id
|
||||
CouponName string `json:"coupon_name"` // 优惠券名称
|
||||
CouponType int `json:"coupon_type"` // 优惠券类型(1:无门槛 2:满减)
|
||||
CouponStatus int `json:"coupon_status"` // 状态(1:正常 2:强制失效 3:结束 4:删除)
|
||||
ApplicationScope int `json:"application_scope"` // 适用范围(1:全场通用)
|
||||
IsMutex int `json:"is_mutex"` // 是否互斥(0:否 1:是)
|
||||
CouponCount int `json:"coupon_count"` // 发放数量
|
||||
CouponTakeCount int `json:"coupon_take_count"` // 已领取数量
|
||||
CouponUsedCount int `json:"coupon_used_count"` // 已使用数量
|
||||
CouponPrice float64 `json:"coupon_price"` // 优惠券金额
|
||||
WithAmount float64 `json:"with_amount"` // 符合满减标准金额(优惠券类型为满减时使用)
|
||||
ValidType int `json:"valid_type"` // 有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||
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"` // 更新时间
|
||||
CouponId string `json:"coupon_id"` // 主键id
|
||||
CouponName string `json:"coupon_name"` // 优惠券名称
|
||||
CouponType int `json:"coupon_type"` // 优惠券类型(1:无门槛 2:满减)
|
||||
CouponStatus int `json:"coupon_status"` // 状态(1:正常 2:强制失效 3:结束 4:删除)
|
||||
ApplicationScope int `json:"application_scope"` // 适用范围(1:全场通用)
|
||||
DistributionObject int `json:"distribution_object"` // 发放对象(1:全部用户 2:新注册用户 3:会员 4:完善资料)
|
||||
IsMutex int `json:"is_mutex"` // 是否互斥(0:否 1:是)
|
||||
CouponCount int `json:"coupon_count"` // 发放数量
|
||||
CouponTakeCount int `json:"coupon_take_count"` // 已领取数量
|
||||
CouponUsedCount int `json:"coupon_used_count"` // 已使用数量
|
||||
CouponPrice float64 `json:"coupon_price"` // 优惠券金额
|
||||
WithAmount float64 `json:"with_amount"` // 符合满减标准金额(优惠券类型为满减时使用)
|
||||
ValidType int `json:"valid_type"` // 有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||
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"` // 更新时间
|
||||
}
|
||||
|
||||
// GetCouponListDto 列表
|
||||
@ -36,22 +37,23 @@ func GetCouponListDto(m []*model.Coupon) []*CouponDto {
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &CouponDto{
|
||||
CouponId: fmt.Sprintf("%d", v.CouponId),
|
||||
CouponName: v.CouponName,
|
||||
CouponType: v.CouponType,
|
||||
CouponStatus: v.CouponStatus,
|
||||
ApplicationScope: v.ApplicationScope,
|
||||
IsMutex: v.IsMutex,
|
||||
CouponCount: v.CouponCount,
|
||||
CouponTakeCount: v.CouponTakeCount,
|
||||
CouponUsedCount: v.CouponUsedCount,
|
||||
CouponPrice: v.CouponPrice,
|
||||
ValidType: v.ValidType,
|
||||
ValidStartTime: v.ValidStartTime,
|
||||
ValidEndTime: v.ValidEndTime,
|
||||
CouponDesc: v.CouponDesc,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
CouponId: fmt.Sprintf("%d", v.CouponId),
|
||||
CouponName: v.CouponName,
|
||||
CouponType: v.CouponType,
|
||||
CouponStatus: v.CouponStatus,
|
||||
ApplicationScope: v.ApplicationScope,
|
||||
DistributionObject: v.DistributionObject,
|
||||
IsMutex: v.IsMutex,
|
||||
CouponCount: v.CouponCount,
|
||||
CouponTakeCount: v.CouponTakeCount,
|
||||
CouponUsedCount: v.CouponUsedCount,
|
||||
CouponPrice: v.CouponPrice,
|
||||
ValidType: v.ValidType,
|
||||
ValidStartTime: v.ValidStartTime,
|
||||
ValidEndTime: v.ValidEndTime,
|
||||
CouponDesc: v.CouponDesc,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
if v.WithAmount != nil {
|
||||
@ -78,22 +80,23 @@ func GetCouponListDto(m []*model.Coupon) []*CouponDto {
|
||||
// GetCouponDto 优惠卷详情
|
||||
func GetCouponDto(m *model.Coupon) *CouponDto {
|
||||
response := &CouponDto{
|
||||
CouponId: fmt.Sprintf("%d", m.CouponId),
|
||||
CouponName: m.CouponName,
|
||||
CouponType: m.CouponType,
|
||||
CouponStatus: m.CouponStatus,
|
||||
ApplicationScope: m.ApplicationScope,
|
||||
IsMutex: m.IsMutex,
|
||||
CouponCount: m.CouponCount,
|
||||
CouponTakeCount: m.CouponTakeCount,
|
||||
CouponUsedCount: m.CouponUsedCount,
|
||||
CouponPrice: m.CouponPrice,
|
||||
ValidType: m.ValidType,
|
||||
ValidStartTime: m.ValidStartTime,
|
||||
ValidEndTime: m.ValidEndTime,
|
||||
CouponDesc: m.CouponDesc,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
CouponId: fmt.Sprintf("%d", m.CouponId),
|
||||
CouponName: m.CouponName,
|
||||
CouponType: m.CouponType,
|
||||
CouponStatus: m.CouponStatus,
|
||||
ApplicationScope: m.ApplicationScope,
|
||||
DistributionObject: m.DistributionObject,
|
||||
IsMutex: m.IsMutex,
|
||||
CouponCount: m.CouponCount,
|
||||
CouponTakeCount: m.CouponTakeCount,
|
||||
CouponUsedCount: m.CouponUsedCount,
|
||||
CouponPrice: m.CouponPrice,
|
||||
ValidType: m.ValidType,
|
||||
ValidStartTime: m.ValidStartTime,
|
||||
ValidEndTime: m.ValidEndTime,
|
||||
CouponDesc: m.CouponDesc,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
|
||||
if m.WithAmount != nil {
|
||||
|
||||
@ -27,6 +27,12 @@ type QuestionDto struct {
|
||||
BaseClass []*BaseClassDto `json:"base_class"` // 关联分类
|
||||
}
|
||||
|
||||
// QuestionPriceDto 问题价格
|
||||
type QuestionPriceDto struct {
|
||||
Price float64 `json:"price"` // 价格(原价)
|
||||
DiscountPrice *float64 `json:"discount_price"` // 优惠价格
|
||||
}
|
||||
|
||||
// GetQuestionDto 详情-问题
|
||||
func GetQuestionDto(m *model.Question) *QuestionDto {
|
||||
return &QuestionDto{
|
||||
|
||||
@ -4,6 +4,8 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"hepa-calc-admin-api/api/dao"
|
||||
"hepa-calc-admin-api/api/responses"
|
||||
"hepa-calc-admin-api/consts"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Auth Auth认证
|
||||
@ -21,31 +23,51 @@ func Auth() gin.HandlerFunc {
|
||||
adminUserDao := dao.AdminUserDao{}
|
||||
adminUser, err := adminUserDao.GetAdminUserById(adminUserId)
|
||||
if err != nil || adminUser == nil {
|
||||
responses.FailWithMessage("用户数据错误", c)
|
||||
c.JSON(http.StatusUnauthorized, gin.H{
|
||||
"message": "用户数据错误",
|
||||
"code": consts.UserStatusError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
if adminUser.Status == 2 {
|
||||
responses.FailWithMessage("用户审核中", c)
|
||||
c.JSON(http.StatusUnauthorized, gin.H{
|
||||
"message": "用户审核中",
|
||||
"code": consts.UserStatusError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
if adminUser.Status == 3 {
|
||||
responses.FailWithMessage("用户状态异常", c)
|
||||
c.JSON(http.StatusUnauthorized, gin.H{
|
||||
"message": "用户状态异常",
|
||||
"code": consts.UserStatusError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
if adminUser.IsDisabled == 1 {
|
||||
responses.FailWithMessage("用户已被禁用", c)
|
||||
c.JSON(http.StatusUnauthorized, gin.H{
|
||||
"message": "用户已被禁用",
|
||||
"code": consts.UserStatusError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
if adminUser.IsDeleted == 1 {
|
||||
responses.FailWithMessage("用户状态异常", c)
|
||||
c.JSON(http.StatusUnauthorized, gin.H{
|
||||
"message": "用户状态异常",
|
||||
"code": consts.UserStatusError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
@ -7,23 +7,24 @@ import (
|
||||
)
|
||||
|
||||
type Coupon struct {
|
||||
CouponId int64 `gorm:"column:coupon_id;type:bigint(19);primary_key;comment:主键id" json:"coupon_id"`
|
||||
CouponName string `gorm:"column:coupon_name;type:varchar(255);comment:优惠卷名称" json:"coupon_name"`
|
||||
CouponType int `gorm:"column:coupon_type;type:varchar(255);comment:优惠卷类型(1:无门槛 2:满减)" json:"coupon_type"`
|
||||
CouponStatus int `gorm:"column:coupon_status;type:tinyint(1);default:1;comment:状态(1:正常 2:强制失效 3:结束 4:删除)" json:"coupon_status"`
|
||||
ApplicationScope int `gorm:"column:application_scope;type:tinyint(1);default:1;comment:适用范围(1:全场通用 2:单项 3:会员)" json:"application_scope"`
|
||||
IsMutex int `gorm:"column:is_mutex;type:tinyint(1);default:1;comment:是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用" json:"is_mutex"`
|
||||
CouponCount int `gorm:"column:coupon_count;type:int(10);default:1;comment:发放数量;NOT NULL" json:"coupon_count"`
|
||||
CouponTakeCount int `gorm:"column:coupon_take_count;type:int(10);comment:已领取数量" json:"coupon_take_count"`
|
||||
CouponUsedCount int `gorm:"column:coupon_used_count;type:int(10);default:0;comment:已使用数量" json:"coupon_used_count"`
|
||||
CouponPrice float64 `gorm:"column:coupon_price;type:decimal(10,2) unsigned;default:0.00;comment:优惠卷金额" json:"coupon_price"`
|
||||
WithAmount *float64 `gorm:"column:with_amount;type:decimal(10,2);comment:符合满减标准金额(优惠卷类型为满减时使用)" json:"with_amount"`
|
||||
ValidType int `gorm:"column:valid_type;type:tinyint(1);comment:有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效);NOT NULL" json:"valid_type"`
|
||||
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"`
|
||||
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"`
|
||||
CouponId int64 `gorm:"column:coupon_id;type:bigint(19);primary_key;comment:主键id" json:"coupon_id"`
|
||||
CouponName string `gorm:"column:coupon_name;type:varchar(255);comment:优惠卷名称" json:"coupon_name"`
|
||||
CouponType int `gorm:"column:coupon_type;type:varchar(255);comment:优惠卷类型(1:无门槛 2:满减)" json:"coupon_type"`
|
||||
CouponStatus int `gorm:"column:coupon_status;type:tinyint(1);default:1;comment:状态(1:正常 2:强制失效 3:结束 4:删除)" json:"coupon_status"`
|
||||
ApplicationScope int `gorm:"column:application_scope;type:tinyint(1);default:1;comment:适用范围(1:全场通用 2:单项 3:会员)" json:"application_scope"`
|
||||
DistributionObject int `gorm:"column:distribution_object;type:tinyint(1);default:1;comment:发放对象(1:全部用户 2:新注册用户 3:会员 4:完善资料)" json:"distribution_object"`
|
||||
IsMutex int `gorm:"column:is_mutex;type:tinyint(1);default:1;comment:是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用" json:"is_mutex"`
|
||||
CouponCount int `gorm:"column:coupon_count;type:int(10);default:1;comment:发放数量;NOT NULL" json:"coupon_count"`
|
||||
CouponTakeCount int `gorm:"column:coupon_take_count;type:int(10);comment:已领取数量" json:"coupon_take_count"`
|
||||
CouponUsedCount int `gorm:"column:coupon_used_count;type:int(10);default:0;comment:已使用数量" json:"coupon_used_count"`
|
||||
CouponPrice float64 `gorm:"column:coupon_price;type:decimal(10,2) unsigned;default:0.00;comment:优惠卷金额" json:"coupon_price"`
|
||||
WithAmount *float64 `gorm:"column:with_amount;type:decimal(10,2);comment:符合满减标准金额(优惠卷类型为满减时使用)" json:"with_amount"`
|
||||
ValidType int `gorm:"column:valid_type;type:tinyint(1);comment:有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效);NOT NULL" json:"valid_type"`
|
||||
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"`
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ type AdminUserRequest struct {
|
||||
type GetAdminUserPage struct {
|
||||
Access string `json:"access" form:"access" label:"账号"`
|
||||
NickName string `json:"nick_name" form:"nick_name" label:"昵称"`
|
||||
IsAdmin int `json:"is_admin" form:"is_admin" label:"是否管理员"` // 是否管理员(0:否 1:是)
|
||||
IsAdmin *int `json:"is_admin" form:"is_admin" label:"是否管理员"` // 是否管理员(0:否 1:是)
|
||||
Status *int `json:"status" form:"status" label:"状态"` // 状态(1:正常 2:审核中 3:审核失败)
|
||||
IsDeleted *int `json:"is_deleted" form:"is_deleted" label:"是否被删除"` // 是否被删除(0:否 1:是)
|
||||
IsDisabled *int `json:"is_disabled" form:"is_disabled" label:"是否被禁用"` // 是否被禁用(0:否 1:是)
|
||||
@ -25,14 +25,14 @@ type GetAdminUserPage struct {
|
||||
|
||||
// AddAdminUser 新增
|
||||
type AddAdminUser struct {
|
||||
Access string `json:"access" form:"access" label:"账号"`
|
||||
Password string `json:"password" form:"password" label:"密码"`
|
||||
NickName string `json:"nick_name" form:"nick_name" label:"昵称"`
|
||||
IsAdmin int `json:"is_admin" form:"is_admin" label:"是否管理员"` // 是否管理员(0:否 1:是)
|
||||
Status *int `json:"status" form:"status" label:"状态"` // 状态(1:正常 2:审核中 3:审核失败)
|
||||
IsDeleted *int `json:"is_deleted" form:"is_deleted" label:"是否被删除"` // 是否被删除(0:否 1:是)
|
||||
IsDisabled *int `json:"is_disabled" form:"is_disabled" label:"是否被禁用"` // 是否被禁用(0:否 1:是)
|
||||
Phone string `json:"phone" form:"phone" label:"手机号"`
|
||||
Access string `json:"access" form:"access" label:"账号" validate:"required"`
|
||||
Password string `json:"password" form:"password" label:"密码" validate:"required"`
|
||||
NickName string `json:"nick_name" form:"nick_name" label:"昵称" validate:"required"`
|
||||
IsAdmin int `json:"is_admin" form:"is_admin" label:"是否管理员" validate:"omitempty,oneof=0 1"` // 是否管理员(0:否 1:是)
|
||||
Status *int `json:"status" form:"status" label:"状态" validate:"required,oneof=1 2 3"` // 状态(1:正常 2:审核中 3:审核失败)
|
||||
IsDeleted *int `json:"is_deleted" form:"is_deleted" label:"是否被删除" validate:"omitempty,oneof=0 1"` // 是否被删除(0:否 1:是)
|
||||
IsDisabled *int `json:"is_disabled" form:"is_disabled" label:"是否被禁用" validate:"omitempty,oneof=0 1"` // 是否被禁用(0:否 1:是)
|
||||
Phone string `json:"phone" form:"phone" label:"手机号" validate:"required"`
|
||||
Avatar string `json:"avatar" form:"avatar" label:"头像"`
|
||||
Sex int `json:"sex" form:"sex" label:"性别"`
|
||||
Email string `json:"email" form:"email" label:"邮箱"`
|
||||
@ -41,13 +41,14 @@ type AddAdminUser struct {
|
||||
// PutAdminUser 修改
|
||||
type PutAdminUser struct {
|
||||
Access string `json:"access" form:"access" validate:"required" label:"账号"`
|
||||
IsDeleted int `json:"is_deleted" form:"is_deleted" validate:"oneof=0 1" label:"删除状态"` // 是否被删除(0:否 1:是)
|
||||
IsDisabled int `json:"is_disabled" form:"is_disabled" validate:"oneof=0 1" label:"禁用状态"` // 是否被禁用(0:否 1:是)
|
||||
Status int `json:"status" form:"status" label:"状态" validate:"required,oneof=1 2 3"` // 状态(1:正常 2:审核中 3:审核失败)
|
||||
IsDeleted int `json:"is_deleted" form:"is_deleted" validate:"omitempty,oneof=0 1" label:"删除状态"` // 是否被删除(0:否 1:是)
|
||||
IsDisabled int `json:"is_disabled" form:"is_disabled" validate:"omitempty,oneof=0 1" label:"禁用状态"` // 是否被禁用(0:否 1:是)
|
||||
NickName string `json:"nick_name" form:"nick_name" validate:"required" label:"昵称"`
|
||||
IsAdmin int `json:"is_admin" form:"is_admin" label:"是否管理员"` // 是否管理员(0:否 1:是)
|
||||
IsAdmin int `json:"is_admin" form:"is_admin" label:"是否管理员" validate:"omitempty,oneof=0 1"` // 是否管理员(0:否 1:是)
|
||||
Phone string `json:"phone" form:"phone" validate:"required" label:"手机号"`
|
||||
Avatar string `json:"avatar" form:"avatar" label:"头像"`
|
||||
Sex int `json:"sex" form:"sex" validate:"required,oneof=1 2" label:"性别"` // (1:男 2:女)
|
||||
Sex int `json:"sex" form:"sex" validate:"omitempty,oneof=1 2" label:"性别"` // (1:男 2:女)
|
||||
Email string `json:"email" form:"email" label:"邮箱"`
|
||||
}
|
||||
|
||||
|
||||
@ -26,17 +26,18 @@ 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:"结束使用时间"` // 假设转换为字符串格式
|
||||
SystemMemberIds []*string `json:"system_member_ids" form:"system_member_ids" label:"会员id"` // 会员id
|
||||
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:会员)
|
||||
DistributionObject int `json:"distribution_object" form:"distribution_object" label:"发放对象" validate:"required,oneof=1 2 3 4"` // 发放对象(1:全部用户 2:新注册用户 3:会员 4:完善资料)
|
||||
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:"优惠券描述"`
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ type GetQuestionPageOrder struct {
|
||||
Price string `json:"price" form:"price" label:"排序"` // 价格(原价)
|
||||
DiscountPrice string `json:"discount_price" form:"discount_price" label:"排序"` // 优惠价格
|
||||
UpdatedAt string `json:"updated_at" form:"updated_at" label:"排序"`
|
||||
CreatedAt string `json:"created_at" form:"created_at" label:"排序"`
|
||||
}
|
||||
|
||||
// GetQuestionList 获取问题列表
|
||||
|
||||
@ -18,7 +18,7 @@ type GetUserPage struct {
|
||||
Sex *int `json:"sex" form:"sex" label:"性别"`
|
||||
IsMember *int `json:"is_member" form:"is_member" label:"是否会员"`
|
||||
MemberExpireDate string `json:"member_expire_date" form:"member_expire_date" label:"会员到期时间"` // 假设转换为可选字符串
|
||||
IsInfoComplete *int `json:"is_info_complete" form:"is_info_complete" label:"信息完善状态"` // 0:否 1:是
|
||||
IsInfoComplete *bool `json:"is_info_complete" form:"is_info_complete" label:"信息完善状态"` // 0:否 1:是
|
||||
Order *GetUserPageOrder `json:"order" form:"order" label:"排序"`
|
||||
}
|
||||
|
||||
|
||||
@ -284,6 +284,9 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
||||
|
||||
// 操作问题隐藏状态
|
||||
questionGroup.PUT("/hide/:question_id", api.Question.PutQuestionHideStatus)
|
||||
|
||||
// 获取问题价格
|
||||
questionGroup.GET("/price", api.Question.GetQuestionPrice)
|
||||
}
|
||||
|
||||
// 配置
|
||||
|
||||
@ -25,7 +25,7 @@ redis:
|
||||
port: 30002
|
||||
password: gdxz2022&dj.
|
||||
pool-size: 100
|
||||
db: 3
|
||||
db: 5
|
||||
|
||||
# [jwt]
|
||||
jwt:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user