用户完善情况搜索,算一算价格修改
This commit is contained in:
parent
dcb2d6a988
commit
01aa915c30
@ -10,6 +10,7 @@ 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"
|
"time"
|
||||||
)
|
)
|
||||||
@ -569,7 +570,7 @@ func (b *Question) GetQuestionPrice(c *gin.Context) {
|
|||||||
|
|
||||||
for _, question := range questions {
|
for _, question := range questions {
|
||||||
// 总价
|
// 总价
|
||||||
price = price + question.Price
|
price = price + math.Round(question.Price*100)/100
|
||||||
|
|
||||||
// 处理折扣价格
|
// 处理折扣价格
|
||||||
if question.DiscountPrice != nil {
|
if question.DiscountPrice != nil {
|
||||||
@ -580,19 +581,24 @@ func (b *Question) GetQuestionPrice(c *gin.Context) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if discountPrice == nil {
|
d := math.Round(*question.DiscountPrice * 100)
|
||||||
discountPrice = question.DiscountPrice
|
|
||||||
} else {
|
if discountPrice == nil {
|
||||||
d := *discountPrice + *question.DiscountPrice
|
discountPrice = &d
|
||||||
discountPrice = &d
|
} else {
|
||||||
|
d = d + *discountPrice
|
||||||
|
discountPrice = &d
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var g dto.QuestionPriceDto
|
var g dto.QuestionPriceDto
|
||||||
g.Price = price
|
g.Price = price
|
||||||
g.DiscountPrice = discountPrice
|
if discountPrice != nil {
|
||||||
|
u := *discountPrice / 100
|
||||||
|
g.DiscountPrice = &u
|
||||||
|
}
|
||||||
|
|
||||||
responses.OkWithData(g, c)
|
responses.OkWithData(g, c)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -184,15 +184,25 @@ func (r *UserDao) GetUserPageSearch(req requests.GetUserPage, page, pageSize int
|
|||||||
|
|
||||||
// 信息完善状态
|
// 信息完善状态
|
||||||
if req.IsInfoComplete != nil {
|
if req.IsInfoComplete != nil {
|
||||||
subQuery := global.Db.Model(&model.UserInfo{}).
|
if *req.IsInfoComplete == true {
|
||||||
Where("user_info.user_id = user.user_id").
|
subQuery := global.Db.Model(&model.UserInfo{}).
|
||||||
Where("user_info.height != '' ").
|
Where("user_info.user_id = user.user_id").
|
||||||
Where("user_info.weight != '' ").
|
Where("user_info.height != '' ").
|
||||||
Where("user_info.is_family_history is not NULL").
|
Where("user_info.weight != '' ").
|
||||||
Where("user_info.province_id is not NULL").
|
Where("user_info.is_family_history is not NULL").
|
||||||
Select("1")
|
Where("user_info.province_id is not NULL").
|
||||||
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 排序
|
// 排序
|
||||||
|
|||||||
@ -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:"排序"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user