Compare commits
10 Commits
f1b66e7d14
...
64d0305e32
| Author | SHA1 | Date | |
|---|---|---|---|
| 64d0305e32 | |||
| 9c7c53f93c | |||
| ac74c0d59f | |||
| 6a0aa360f3 | |||
| 7cbe9beaba | |||
| d46244ea0c | |||
| 01aa915c30 | |||
| dcb2d6a988 | |||
| 79de15f061 | |||
| 3eaeddfd38 |
@ -242,6 +242,7 @@ func (r *Coupon) AddSystemCoupon(c *gin.Context) {
|
|||||||
CouponType: req.CouponType,
|
CouponType: req.CouponType,
|
||||||
CouponStatus: 1,
|
CouponStatus: 1,
|
||||||
ApplicationScope: req.ApplicationScope,
|
ApplicationScope: req.ApplicationScope,
|
||||||
|
DistributionObject: req.DistributionObject,
|
||||||
IsMutex: req.IsMutex,
|
IsMutex: req.IsMutex,
|
||||||
CouponCount: req.CouponCount,
|
CouponCount: req.CouponCount,
|
||||||
CouponTakeCount: 0,
|
CouponTakeCount: 0,
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import (
|
|||||||
"hepa-calc-admin-api/extend/aliyun"
|
"hepa-calc-admin-api/extend/aliyun"
|
||||||
"hepa-calc-admin-api/global"
|
"hepa-calc-admin-api/global"
|
||||||
"hepa-calc-admin-api/utils"
|
"hepa-calc-admin-api/utils"
|
||||||
|
"math"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -200,7 +201,7 @@ func (b *Public) GetIndex(c *gin.Context) {
|
|||||||
MemberBuyCount: memberBuyCount,
|
MemberBuyCount: memberBuyCount,
|
||||||
MemberAmountTotal: memberAmountTotal,
|
MemberAmountTotal: memberAmountTotal,
|
||||||
SingleAmountTotal: singleAmountTotal,
|
SingleAmountTotal: singleAmountTotal,
|
||||||
AmountTotal: memberAmountTotal + singleAmountTotal,
|
AmountTotal: math.Round((memberAmountTotal+singleAmountTotal)*100) / 100,
|
||||||
}
|
}
|
||||||
|
|
||||||
responses.OkWithData(g, c)
|
responses.OkWithData(g, c)
|
||||||
|
|||||||
@ -10,7 +10,9 @@ import (
|
|||||||
"hepa-calc-admin-api/api/service"
|
"hepa-calc-admin-api/api/service"
|
||||||
"hepa-calc-admin-api/global"
|
"hepa-calc-admin-api/global"
|
||||||
"hepa-calc-admin-api/utils"
|
"hepa-calc-admin-api/utils"
|
||||||
|
"math"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Question struct{}
|
type Question struct{}
|
||||||
@ -549,3 +551,54 @@ func (b *Question) PutQuestionHideStatus(c *gin.Context) {
|
|||||||
tx.Commit()
|
tx.Commit()
|
||||||
responses.Ok(c)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if loginUserId == userId && (req.Status == 1 || req.Status == 2 || req.Status == 3) {
|
||||||
|
responses.FailWithMessage("不可修改自己用户状态", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if loginUserId != userId && loginAdminUser.IsAdmin != 1 {
|
if loginUserId != userId && loginAdminUser.IsAdmin != 1 {
|
||||||
responses.FailWithMessage("非管理员用户只可修改自己数据", c)
|
responses.FailWithMessage("非管理员用户只可修改自己数据", c)
|
||||||
return
|
return
|
||||||
@ -285,6 +290,7 @@ func (r *AdminUser) PutAdminUser(c *gin.Context) {
|
|||||||
|
|
||||||
data := make(map[string]interface{})
|
data := make(map[string]interface{})
|
||||||
data["access"] = req.Access
|
data["access"] = req.Access
|
||||||
|
data["status"] = req.Status
|
||||||
data["is_deleted"] = req.IsDeleted
|
data["is_deleted"] = req.IsDeleted
|
||||||
data["is_disabled"] = req.IsDisabled
|
data["is_disabled"] = req.IsDisabled
|
||||||
data["nick_name"] = req.NickName
|
data["nick_name"] = req.NickName
|
||||||
|
|||||||
@ -140,6 +140,11 @@ func (r *AdminUserDao) GetAdminUserPageSearch(req requests.GetAdminUserPage, pag
|
|||||||
query = query.Where("is_disabled = ?", req.IsDisabled)
|
query = query.Where("is_disabled = ?", req.IsDisabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 是否管理员
|
||||||
|
if req.IsAdmin != nil {
|
||||||
|
query = query.Where("is_admin = ?", req.IsAdmin)
|
||||||
|
}
|
||||||
|
|
||||||
// 手机号
|
// 手机号
|
||||||
if req.Phone != "" {
|
if req.Phone != "" {
|
||||||
query = query.Where("phone LIKE ?", "%"+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)
|
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 != "" {
|
||||||
if req.Order.UpdatedAt != "desc" && req.Order.UpdatedAt != "asc" {
|
if req.Order.UpdatedAt != "desc" && req.Order.UpdatedAt != "asc" {
|
||||||
return nil, 0, errors.New("排序字段错误")
|
return nil, 0, errors.New("排序字段错误")
|
||||||
|
|||||||
@ -184,6 +184,7 @@ func (r *UserDao) GetUserPageSearch(req requests.GetUserPage, page, pageSize int
|
|||||||
|
|
||||||
// 信息完善状态
|
// 信息完善状态
|
||||||
if req.IsInfoComplete != nil {
|
if req.IsInfoComplete != nil {
|
||||||
|
if *req.IsInfoComplete == true {
|
||||||
subQuery := global.Db.Model(&model.UserInfo{}).
|
subQuery := global.Db.Model(&model.UserInfo{}).
|
||||||
Where("user_info.user_id = user.user_id").
|
Where("user_info.user_id = user.user_id").
|
||||||
Where("user_info.height != '' ").
|
Where("user_info.height != '' ").
|
||||||
@ -191,8 +192,17 @@ func (r *UserDao) GetUserPageSearch(req requests.GetUserPage, page, pageSize int
|
|||||||
Where("user_info.is_family_history is not NULL").
|
Where("user_info.is_family_history is not NULL").
|
||||||
Where("user_info.province_id is not NULL").
|
Where("user_info.province_id is not NULL").
|
||||||
Select("1")
|
Select("1")
|
||||||
|
|
||||||
query = query.Where("EXISTS (?)", subQuery)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 排序
|
// 排序
|
||||||
|
|||||||
@ -12,6 +12,7 @@ type CouponDto struct {
|
|||||||
CouponType int `json:"coupon_type"` // 优惠券类型(1:无门槛 2:满减)
|
CouponType int `json:"coupon_type"` // 优惠券类型(1:无门槛 2:满减)
|
||||||
CouponStatus int `json:"coupon_status"` // 状态(1:正常 2:强制失效 3:结束 4:删除)
|
CouponStatus int `json:"coupon_status"` // 状态(1:正常 2:强制失效 3:结束 4:删除)
|
||||||
ApplicationScope int `json:"application_scope"` // 适用范围(1:全场通用)
|
ApplicationScope int `json:"application_scope"` // 适用范围(1:全场通用)
|
||||||
|
DistributionObject int `json:"distribution_object"` // 发放对象(1:全部用户 2:新注册用户 3:会员 4:完善资料)
|
||||||
IsMutex int `json:"is_mutex"` // 是否互斥(0:否 1:是)
|
IsMutex int `json:"is_mutex"` // 是否互斥(0:否 1:是)
|
||||||
CouponCount int `json:"coupon_count"` // 发放数量
|
CouponCount int `json:"coupon_count"` // 发放数量
|
||||||
CouponTakeCount int `json:"coupon_take_count"` // 已领取数量
|
CouponTakeCount int `json:"coupon_take_count"` // 已领取数量
|
||||||
@ -41,6 +42,7 @@ func GetCouponListDto(m []*model.Coupon) []*CouponDto {
|
|||||||
CouponType: v.CouponType,
|
CouponType: v.CouponType,
|
||||||
CouponStatus: v.CouponStatus,
|
CouponStatus: v.CouponStatus,
|
||||||
ApplicationScope: v.ApplicationScope,
|
ApplicationScope: v.ApplicationScope,
|
||||||
|
DistributionObject: v.DistributionObject,
|
||||||
IsMutex: v.IsMutex,
|
IsMutex: v.IsMutex,
|
||||||
CouponCount: v.CouponCount,
|
CouponCount: v.CouponCount,
|
||||||
CouponTakeCount: v.CouponTakeCount,
|
CouponTakeCount: v.CouponTakeCount,
|
||||||
@ -83,6 +85,7 @@ func GetCouponDto(m *model.Coupon) *CouponDto {
|
|||||||
CouponType: m.CouponType,
|
CouponType: m.CouponType,
|
||||||
CouponStatus: m.CouponStatus,
|
CouponStatus: m.CouponStatus,
|
||||||
ApplicationScope: m.ApplicationScope,
|
ApplicationScope: m.ApplicationScope,
|
||||||
|
DistributionObject: m.DistributionObject,
|
||||||
IsMutex: m.IsMutex,
|
IsMutex: m.IsMutex,
|
||||||
CouponCount: m.CouponCount,
|
CouponCount: m.CouponCount,
|
||||||
CouponTakeCount: m.CouponTakeCount,
|
CouponTakeCount: m.CouponTakeCount,
|
||||||
|
|||||||
@ -27,6 +27,12 @@ type QuestionDto struct {
|
|||||||
BaseClass []*BaseClassDto `json:"base_class"` // 关联分类
|
BaseClass []*BaseClassDto `json:"base_class"` // 关联分类
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QuestionPriceDto 问题价格
|
||||||
|
type QuestionPriceDto struct {
|
||||||
|
Price float64 `json:"price"` // 价格(原价)
|
||||||
|
DiscountPrice *float64 `json:"discount_price"` // 优惠价格
|
||||||
|
}
|
||||||
|
|
||||||
// GetQuestionDto 详情-问题
|
// GetQuestionDto 详情-问题
|
||||||
func GetQuestionDto(m *model.Question) *QuestionDto {
|
func GetQuestionDto(m *model.Question) *QuestionDto {
|
||||||
return &QuestionDto{
|
return &QuestionDto{
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"hepa-calc-admin-api/api/dao"
|
"hepa-calc-admin-api/api/dao"
|
||||||
"hepa-calc-admin-api/api/responses"
|
"hepa-calc-admin-api/api/responses"
|
||||||
|
"hepa-calc-admin-api/consts"
|
||||||
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Auth Auth认证
|
// Auth Auth认证
|
||||||
@ -21,31 +23,51 @@ func Auth() gin.HandlerFunc {
|
|||||||
adminUserDao := dao.AdminUserDao{}
|
adminUserDao := dao.AdminUserDao{}
|
||||||
adminUser, err := adminUserDao.GetAdminUserById(adminUserId)
|
adminUser, err := adminUserDao.GetAdminUserById(adminUserId)
|
||||||
if err != nil || adminUser == nil {
|
if err != nil || adminUser == nil {
|
||||||
responses.FailWithMessage("用户数据错误", c)
|
c.JSON(http.StatusUnauthorized, gin.H{
|
||||||
|
"message": "用户数据错误",
|
||||||
|
"code": consts.UserStatusError,
|
||||||
|
"data": "",
|
||||||
|
})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if adminUser.Status == 2 {
|
if adminUser.Status == 2 {
|
||||||
responses.FailWithMessage("用户审核中", c)
|
c.JSON(http.StatusUnauthorized, gin.H{
|
||||||
|
"message": "用户审核中",
|
||||||
|
"code": consts.UserStatusError,
|
||||||
|
"data": "",
|
||||||
|
})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if adminUser.Status == 3 {
|
if adminUser.Status == 3 {
|
||||||
responses.FailWithMessage("用户状态异常", c)
|
c.JSON(http.StatusUnauthorized, gin.H{
|
||||||
|
"message": "用户状态异常",
|
||||||
|
"code": consts.UserStatusError,
|
||||||
|
"data": "",
|
||||||
|
})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if adminUser.IsDisabled == 1 {
|
if adminUser.IsDisabled == 1 {
|
||||||
responses.FailWithMessage("用户已被禁用", c)
|
c.JSON(http.StatusUnauthorized, gin.H{
|
||||||
|
"message": "用户已被禁用",
|
||||||
|
"code": consts.UserStatusError,
|
||||||
|
"data": "",
|
||||||
|
})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if adminUser.IsDeleted == 1 {
|
if adminUser.IsDeleted == 1 {
|
||||||
responses.FailWithMessage("用户状态异常", c)
|
c.JSON(http.StatusUnauthorized, gin.H{
|
||||||
|
"message": "用户状态异常",
|
||||||
|
"code": consts.UserStatusError,
|
||||||
|
"data": "",
|
||||||
|
})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ type Coupon struct {
|
|||||||
CouponType int `gorm:"column:coupon_type;type:varchar(255);comment:优惠卷类型(1:无门槛 2:满减)" json:"coupon_type"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
CouponTakeCount int `gorm:"column:coupon_take_count;type:int(10);comment:已领取数量" json:"coupon_take_count"`
|
||||||
|
|||||||
@ -14,7 +14,7 @@ type AdminUserRequest struct {
|
|||||||
type GetAdminUserPage struct {
|
type GetAdminUserPage struct {
|
||||||
Access string `json:"access" form:"access" label:"账号"`
|
Access string `json:"access" form:"access" label:"账号"`
|
||||||
NickName string `json:"nick_name" form:"nick_name" 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:审核失败)
|
Status *int `json:"status" form:"status" label:"状态"` // 状态(1:正常 2:审核中 3:审核失败)
|
||||||
IsDeleted *int `json:"is_deleted" form:"is_deleted" label:"是否被删除"` // 是否被删除(0:否 1:是)
|
IsDeleted *int `json:"is_deleted" form:"is_deleted" label:"是否被删除"` // 是否被删除(0:否 1:是)
|
||||||
IsDisabled *int `json:"is_disabled" form:"is_disabled" label:"是否被禁用"` // 是否被禁用(0:否 1:是)
|
IsDisabled *int `json:"is_disabled" form:"is_disabled" label:"是否被禁用"` // 是否被禁用(0:否 1:是)
|
||||||
@ -25,14 +25,14 @@ type GetAdminUserPage struct {
|
|||||||
|
|
||||||
// AddAdminUser 新增
|
// AddAdminUser 新增
|
||||||
type AddAdminUser struct {
|
type AddAdminUser struct {
|
||||||
Access string `json:"access" form:"access" label:"账号"`
|
Access string `json:"access" form:"access" label:"账号" validate:"required"`
|
||||||
Password string `json:"password" form:"password" label:"密码"`
|
Password string `json:"password" form:"password" label:"密码" validate:"required"`
|
||||||
NickName string `json:"nick_name" form:"nick_name" label:"昵称"`
|
NickName string `json:"nick_name" form:"nick_name" label:"昵称" validate:"required"`
|
||||||
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:是)
|
||||||
Status *int `json:"status" form:"status" label:"状态"` // 状态(1:正常 2:审核中 3:审核失败)
|
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:"是否被删除"` // 是否被删除(0:否 1:是)
|
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:"是否被禁用"` // 是否被禁用(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:"手机号"`
|
Phone string `json:"phone" form:"phone" label:"手机号" validate:"required"`
|
||||||
Avatar string `json:"avatar" form:"avatar" label:"头像"`
|
Avatar string `json:"avatar" form:"avatar" label:"头像"`
|
||||||
Sex int `json:"sex" form:"sex" label:"性别"`
|
Sex int `json:"sex" form:"sex" label:"性别"`
|
||||||
Email string `json:"email" form:"email" label:"邮箱"`
|
Email string `json:"email" form:"email" label:"邮箱"`
|
||||||
@ -41,13 +41,14 @@ type AddAdminUser struct {
|
|||||||
// PutAdminUser 修改
|
// PutAdminUser 修改
|
||||||
type PutAdminUser struct {
|
type PutAdminUser struct {
|
||||||
Access string `json:"access" form:"access" validate:"required" label:"账号"`
|
Access string `json:"access" form:"access" validate:"required" label:"账号"`
|
||||||
IsDeleted int `json:"is_deleted" form:"is_deleted" validate:"oneof=0 1" label:"删除状态"` // 是否被删除(0:否 1:是)
|
Status int `json:"status" form:"status" label:"状态" validate:"required,oneof=1 2 3"` // 状态(1:正常 2:审核中 3:审核失败)
|
||||||
IsDisabled int `json:"is_disabled" form:"is_disabled" validate:"oneof=0 1" label:"禁用状态"` // 是否被禁用(0:否 1:是)
|
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:"昵称"`
|
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:"手机号"`
|
Phone string `json:"phone" form:"phone" validate:"required" label:"手机号"`
|
||||||
Avatar string `json:"avatar" form:"avatar" 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:"邮箱"`
|
Email string `json:"email" form:"email" label:"邮箱"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,7 @@ type AddSystemCoupon struct {
|
|||||||
CouponName string `json:"coupon_name" form:"coupon_name" label:"优惠券名称" validate:"required"`
|
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:满减)
|
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:会员)
|
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:是)
|
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"`
|
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"`
|
CouponPrice float64 `json:"coupon_price" form:"coupon_price" label:"优惠券金额" validate:"required,numeric,gt=0"`
|
||||||
|
|||||||
@ -34,6 +34,7 @@ type GetQuestionPageOrder struct {
|
|||||||
Price string `json:"price" form:"price" label:"排序"` // 价格(原价)
|
Price string `json:"price" form:"price" label:"排序"` // 价格(原价)
|
||||||
DiscountPrice string `json:"discount_price" form:"discount_price" label:"排序"` // 优惠价格
|
DiscountPrice string `json:"discount_price" form:"discount_price" label:"排序"` // 优惠价格
|
||||||
UpdatedAt string `json:"updated_at" form:"updated_at" label:"排序"`
|
UpdatedAt string `json:"updated_at" form:"updated_at" label:"排序"`
|
||||||
|
CreatedAt string `json:"created_at" form:"created_at" label:"排序"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetQuestionList 获取问题列表
|
// GetQuestionList 获取问题列表
|
||||||
|
|||||||
@ -18,7 +18,7 @@ type GetUserPage struct {
|
|||||||
Sex *int `json:"sex" form:"sex" label:"性别"`
|
Sex *int `json:"sex" form:"sex" label:"性别"`
|
||||||
IsMember *int `json:"is_member" form:"is_member" label:"是否会员"`
|
IsMember *int `json:"is_member" form:"is_member" label:"是否会员"`
|
||||||
MemberExpireDate string `json:"member_expire_date" form:"member_expire_date" 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:"排序"`
|
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.PUT("/hide/:question_id", api.Question.PutQuestionHideStatus)
|
||||||
|
|
||||||
|
// 获取问题价格
|
||||||
|
questionGroup.GET("/price", api.Question.GetQuestionPrice)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 配置
|
// 配置
|
||||||
|
|||||||
@ -25,7 +25,7 @@ redis:
|
|||||||
port: 30002
|
port: 30002
|
||||||
password: gdxz2022&dj.
|
password: gdxz2022&dj.
|
||||||
pool-size: 100
|
pool-size: 100
|
||||||
db: 3
|
db: 5
|
||||||
|
|
||||||
# [jwt]
|
# [jwt]
|
||||||
jwt:
|
jwt:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user