update
This commit is contained in:
@@ -62,6 +62,7 @@ func (p DefParty) RegisterList() []web_iris.Party {
|
||||
//系统
|
||||
p.systemConfigInfo(),
|
||||
p.systemBanners(),
|
||||
p.getPayoff(),
|
||||
}
|
||||
return ps
|
||||
}
|
||||
|
||||
+25
-18
@@ -95,9 +95,9 @@ func (p DefParty) orderCreatePreCheck() web_iris.Party {
|
||||
}
|
||||
}
|
||||
var systemConfigPay models.SystemConfig
|
||||
database.Instance().Model(&models.SystemConfig{}).Where("config_type = 3").Order(clause.OrderByColumn{Column: clause.Column{Name: "sort"}, Desc: true}).Limit(1).Find(&systemConfigPay)
|
||||
database.Instance().Model(&models.SystemConfig{}).Where("config_type = 4").Order(clause.OrderByColumn{Column: clause.Column{Name: "sort"}, Desc: true}).Limit(1).Find(&systemConfigPay)
|
||||
if systemConfigPay.Name == "payOff" {
|
||||
orderCreatePreCheckResponse.PayType = 0
|
||||
orderCreatePreCheckResponse.PayType = 1
|
||||
}
|
||||
|
||||
Success(ctx, orderCreateRequest, orderCreatePreCheckResponse)
|
||||
@@ -478,14 +478,15 @@ func GetOrderDetail(orderId string) OrderDetail {
|
||||
}
|
||||
|
||||
orderSubR1 := SubOrder{
|
||||
OrderId: orderSub.OrderId,
|
||||
Status: orderSub.OrderStatus,
|
||||
UserPetInfo: GetUserPet(orderMain.Uid, orderSub.PetId),
|
||||
TotalAmount: orderSub.TotalAmount,
|
||||
PayAmount: strconv.Itoa(orderSub.PayAmount),
|
||||
Discount: float64(orderSub.Discount),
|
||||
Goods: goods,
|
||||
Coupons: nil,
|
||||
OrderId: orderSub.OrderId,
|
||||
Status: orderSub.OrderStatus,
|
||||
UserPetInfo: GetUserPet(orderMain.Uid, orderSub.PetId),
|
||||
TotalAmount: orderSub.TotalAmount,
|
||||
PayAmount: strconv.Itoa(orderSub.PayAmount),
|
||||
Discount: float64(orderSub.Discount),
|
||||
Goods: goods,
|
||||
Coupons: nil,
|
||||
CouponsAmount: "0",
|
||||
}
|
||||
if coupons.Id > 0 {
|
||||
orderSubR1.Coupons = &models.Coupons{
|
||||
@@ -545,7 +546,7 @@ func GetOrderDetail(orderId string) OrderDetail {
|
||||
}
|
||||
|
||||
func checkOrderServiceTime(serviceTime string, projectionServiceTime int) bool {
|
||||
type orderMainTmp struct {
|
||||
/*type orderMainTmp struct {
|
||||
ServiceTime string
|
||||
ProjectionServiceTime int
|
||||
}
|
||||
@@ -564,7 +565,7 @@ func checkOrderServiceTime(serviceTime string, projectionServiceTime int) bool {
|
||||
//时间点订单数量<服务车辆*车辆单次服务数量 才可接受预约
|
||||
if len(orderMainTmpList) > 0 {
|
||||
return len(orderMainTmpList) >= len(CarMap)*CarServiceNum
|
||||
}
|
||||
}*/
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -804,11 +805,12 @@ func (p DefParty) orderServiceTime() web_iris.Party {
|
||||
database.Instance().Model(&models.OrderMain{}).Where("service_time >= DATE_SUB(NOW(), INTERVAL 7 DAY) and order_status != 3 and order_status != 4 and status = 1").Find(&orderMainTmpList)
|
||||
// 执行查询
|
||||
var orderMainTmp1 []struct {
|
||||
ServiceTime string
|
||||
Count int
|
||||
ServiceTime string
|
||||
Count int
|
||||
ProjectionServiceTime int
|
||||
}
|
||||
err := database.Instance().Raw(`
|
||||
SELECT service_time, COUNT(1) AS count
|
||||
SELECT service_time, COUNT(1) AS count, projection_service_time
|
||||
FROM order_mains
|
||||
WHERE service_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
|
||||
AND order_status != 3
|
||||
@@ -825,8 +827,10 @@ func (p DefParty) orderServiceTime() web_iris.Party {
|
||||
var orderTimeMap = make(map[string]string)
|
||||
var orderTimeNum = make(map[string]int)
|
||||
var orderTimeCount = make(map[string]int)
|
||||
var orderProjectionTime = make(map[string]int)
|
||||
for _, val := range orderMainTmp1 {
|
||||
orderTimeCount[val.ServiceTime] = val.Count
|
||||
orderProjectionTime[val.ServiceTime] = val.ProjectionServiceTime
|
||||
}
|
||||
|
||||
for _, value := range orderMainTmpList {
|
||||
@@ -838,15 +842,18 @@ func (p DefParty) orderServiceTime() web_iris.Party {
|
||||
lastDate := date.Add(time.Minute * time.Duration(value.ProjectionServiceTime))
|
||||
for t := date; t.Before(lastDate); t = t.Add(time.Hour) {
|
||||
timeStr := t.Format("2006-01-02 15:04")
|
||||
orderTimeMap[timeStr] = timeStr
|
||||
orderTimeNum[timeStr] = orderTimeNum[timeStr] + 1
|
||||
if timeStr != value.ServiceTime {
|
||||
orderTimeMap[timeStr] = timeStr
|
||||
orderTimeNum[timeStr] = orderTimeNum[timeStr] + 1
|
||||
orderTimeCount[timeStr] = orderTimeCount[timeStr] + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
serviceTime := AddrServiceMap[orderServiceTimeRequest.ServiceAddrId]
|
||||
times := strings.Split(serviceTime.Times, ",")
|
||||
carNum := len(CarMap)
|
||||
daysMap := utils.GetStrDays(7, 60, ReserveMap, orderTimeMap, carNum, orderTimeNum, CarServiceNum, times, orderTimeCount)
|
||||
daysMap := utils.GetStrDays(7, 60, ReserveMap, orderTimeMap, carNum, orderTimeNum, CarServiceNum, times, orderTimeCount, orderProjectionTime)
|
||||
var dayHoursMap = make(map[string][]TimeObject)
|
||||
for day, values := range daysMap {
|
||||
key := day
|
||||
|
||||
@@ -42,3 +42,18 @@ func (p DefParty) systemBanners() web_iris.Party {
|
||||
})
|
||||
}}
|
||||
}
|
||||
|
||||
type PayoffResponse struct {
|
||||
Payoff bool `json:"payoff"`
|
||||
}
|
||||
|
||||
// 获取支付开关
|
||||
func (p DefParty) getPayoff() web_iris.Party {
|
||||
return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
|
||||
index.Post(System+"/getPayoff", func(ctx *context.Context) {
|
||||
var systemConfigPayOnOff models.SystemConfig
|
||||
database.Instance().Model(&models.SystemConfig{}).Where("config_type = 4").Order(clause.OrderByColumn{Column: clause.Column{Name: "sort"}, Desc: true}).Limit(1).Find(&systemConfigPayOnOff)
|
||||
Success(ctx, nil, PayoffResponse{systemConfigPayOnOff.Name == "payOff"})
|
||||
})
|
||||
}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user