mirror of http://gitlab.batiao8.com/yic/film.git
price
This commit is contained in:
parent
0060d8c32a
commit
ee962053df
|
@ -23,6 +23,7 @@ type Order struct {
|
||||||
Seats string
|
Seats string
|
||||||
ShowTime int64
|
ShowTime int64
|
||||||
PayTime int64
|
PayTime int64
|
||||||
|
OrderCreateTime int64
|
||||||
CityName string
|
CityName string
|
||||||
ProvinceName string
|
ProvinceName string
|
||||||
Ting string
|
Ting string
|
||||||
|
|
|
@ -3,7 +3,9 @@ package common
|
||||||
import "film/model"
|
import "film/model"
|
||||||
|
|
||||||
type CheckInfo struct {
|
type CheckInfo struct {
|
||||||
TotalPrice int64
|
TotalOriginPrice int64
|
||||||
|
TotalRealPrice int64
|
||||||
|
TotalCouponPrice int64
|
||||||
UnitPrice int64
|
UnitPrice int64
|
||||||
BillCode string
|
BillCode string
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package dadi
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"film/base/httputil"
|
"film/base/httputil"
|
||||||
"film/base/util"
|
|
||||||
"film/model"
|
"film/model"
|
||||||
"film/worker/common"
|
"film/worker/common"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -268,10 +267,11 @@ func (p *Processor) prevOrderInfo(cinema *Cinema, seatGoods []*SeatGoods) (*Prev
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("[newPriceCalculate] response : %s", goutil.EncodeJSON(data))
|
log.Debugf("[newPriceCalculate] response : %s", goutil.EncodeJSON(data))
|
||||||
totalRealPrice := cast.ToFloat64(cast.ToStringMap(data)["totalRealPrice"])
|
realData := cast.ToStringMap(data)
|
||||||
|
|
||||||
previewOrder := new(PreviewOrder)
|
previewOrder := new(PreviewOrder)
|
||||||
previewOrder.TotalPrice = int64(totalRealPrice * 100)
|
previewOrder.TotalOriginPrice = int64(cast.ToFloat64(realData["ticketOriginPrice"]) * 100)
|
||||||
|
previewOrder.TotalRealPrice = int64(cast.ToFloat64(realData["ticketRealPrice"]) * 100)
|
||||||
|
previewOrder.TotalCouponPrice = int64(cast.ToFloat64(realData["ticketCouponPrice"]) * 100)
|
||||||
previewOrder.BillCode = billCode
|
previewOrder.BillCode = billCode
|
||||||
|
|
||||||
return previewOrder, nil
|
return previewOrder, nil
|
||||||
|
@ -296,11 +296,13 @@ func (p *Processor) CheckOrder(order *model.Order) (*common.CheckInfo, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
result := new(common.CheckInfo)
|
result := new(common.CheckInfo)
|
||||||
result.UnitPrice = previewOrder.TotalPrice / int64(order.SeatNum)
|
result.TotalRealPrice = previewOrder.TotalRealPrice
|
||||||
result.TotalPrice = previewOrder.TotalPrice
|
result.TotalRealPrice = previewOrder.TotalOriginPrice
|
||||||
|
result.TotalRealPrice = previewOrder.TotalCouponPrice
|
||||||
|
result.UnitPrice = previewOrder.TotalRealPrice / int64(order.SeatNum)
|
||||||
result.BillCode = previewOrder.BillCode
|
result.BillCode = previewOrder.BillCode
|
||||||
log.Infof("check order[%s][%s] totalPrice[%s] [%s][%s][%s] success",
|
log.Infof("check order[%s][%s] previewOrder[%s] [%s][%s][%s] success",
|
||||||
order.OrderId, result.BillCode, util.MoneyFen(previewOrder.TotalPrice),
|
order.OrderId, result.BillCode, goutil.EncodeJSON(previewOrder),
|
||||||
order.CityName, order.CinemaName, order.MovieName)
|
order.CityName, order.CinemaName, order.MovieName)
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package dadi
|
package dadi
|
||||||
|
|
||||||
type PreviewOrder struct {
|
type PreviewOrder struct {
|
||||||
|
TotalOriginPrice int64
|
||||||
|
TotalRealPrice int64
|
||||||
|
TotalCouponPrice int64
|
||||||
BillCode string
|
BillCode string
|
||||||
TotalPrice int64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SeatGoods struct {
|
type SeatGoods struct {
|
||||||
|
|
|
@ -88,6 +88,7 @@ func (s *SyncOrder) run() {
|
||||||
order.Seats = cast.ToString(data["seats"])
|
order.Seats = cast.ToString(data["seats"])
|
||||||
order.ShowTime = cast.ToInt64(data["show_time"])
|
order.ShowTime = cast.ToInt64(data["show_time"])
|
||||||
order.PayTime = cast.ToInt64(data["pay_time"])
|
order.PayTime = cast.ToInt64(data["pay_time"])
|
||||||
|
order.OrderCreateTime = cast.ToInt64(data["create_time"])
|
||||||
order.CityName = cast.ToString(data["cityName"])
|
order.CityName = cast.ToString(data["cityName"])
|
||||||
order.ProvinceName = cast.ToString(data["provinceName"])
|
order.ProvinceName = cast.ToString(data["provinceName"])
|
||||||
order.MovieName = cast.ToString(data["movieName"])
|
order.MovieName = cast.ToString(data["movieName"])
|
||||||
|
|
|
@ -75,8 +75,9 @@ func (w *Worker) Run() {
|
||||||
message = append(message, "【哈哈票订单信息】")
|
message = append(message, "【哈哈票订单信息】")
|
||||||
message = append(message, fmt.Sprintf("城市:%s", order.CityName))
|
message = append(message, fmt.Sprintf("城市:%s", order.CityName))
|
||||||
message = append(message, fmt.Sprintf("影院:%s", order.CinemaName))
|
message = append(message, fmt.Sprintf("影院:%s", order.CinemaName))
|
||||||
message = append(message, fmt.Sprintf("影厅:%s", order.Ting))
|
|
||||||
message = append(message, fmt.Sprintf("影片:%s", order.MovieName))
|
message = append(message, fmt.Sprintf("影片:%s", order.MovieName))
|
||||||
|
message = append(message, fmt.Sprintf("影厅:%s", order.Ting))
|
||||||
|
message = append(message, fmt.Sprintf("时间:%s", time.Unix(order.ShowTime, 0).Format("2006-01-02 15:04")))
|
||||||
message = append(message, fmt.Sprintf("座位:%s,%s,%s", order.Seats,
|
message = append(message, fmt.Sprintf("座位:%s,%s,%s", order.Seats,
|
||||||
goutil.If(order.IsSeat == 3, "可以调座", "不可调座"),
|
goutil.If(order.IsSeat == 3, "可以调座", "不可调座"),
|
||||||
goutil.If(order.LoverSeat == 1, "情侣座", "普通座")))
|
goutil.If(order.LoverSeat == 1, "情侣座", "普通座")))
|
||||||
|
@ -84,12 +85,16 @@ func (w *Worker) Run() {
|
||||||
message = append(message, fmt.Sprintf("编号:%s", order.OrderId))
|
message = append(message, fmt.Sprintf("编号:%s", order.OrderId))
|
||||||
message = append(message, fmt.Sprintf("总金额:%.2f(%d)", float64(order.TotalPrice)/100, order.SeatNum))
|
message = append(message, fmt.Sprintf("总金额:%.2f(%d)", float64(order.TotalPrice)/100, order.SeatNum))
|
||||||
message = append(message, fmt.Sprintf("报价范围:%.2f~%.2f", float64(order.MinPrice)/100, float64(order.MaxPrice)/100))
|
message = append(message, fmt.Sprintf("报价范围:%.2f~%.2f", float64(order.MinPrice)/100, float64(order.MaxPrice)/100))
|
||||||
message = append(message, fmt.Sprintf("订单时间:%s", time.Unix(order.PayTime, 0).Format("2006-01-02 15:04")))
|
message = append(message, fmt.Sprintf("支付时间:%s", time.Unix(order.PayTime, 0).Format("2006-01-02 15:04")))
|
||||||
message = append(message, fmt.Sprintf("放映时间:%s", time.Unix(order.ShowTime, 0).Format("2006-01-02 15:04")))
|
message = append(message, fmt.Sprintf("创建时间:%s", time.Unix(order.OrderCreateTime, 0).Format("2006-01-02 15:04")))
|
||||||
|
message = append(message, fmt.Sprintf("入库时间:%s", time.Unix(order.CreateTime, 0).Format("2006-01-02 15:04")))
|
||||||
|
|
||||||
message = append(message, "\n")
|
message = append(message, "\n")
|
||||||
message = append(message, "【大地订单信息】")
|
message = append(message, "【大地订单信息】")
|
||||||
message = append(message, fmt.Sprintf("单价:%s", util.MoneyFen(checkInfo.UnitPrice)))
|
message = append(message, fmt.Sprintf("订单原价:%s", util.MoneyFen(checkInfo.TotalOriginPrice)))
|
||||||
message = append(message, fmt.Sprintf("总价:%s", util.MoneyFen(checkInfo.TotalPrice)))
|
message = append(message, fmt.Sprintf("优惠金额:%s", util.MoneyFen(checkInfo.TotalCouponPrice)))
|
||||||
|
message = append(message, fmt.Sprintf("实际总价:%s", util.MoneyFen(checkInfo.TotalRealPrice)))
|
||||||
|
message = append(message, fmt.Sprintf("实际单价:%s", util.MoneyFen(checkInfo.UnitPrice)))
|
||||||
if err := w.qyClient.SendText([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
|
if err := w.qyClient.SendText([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
|
||||||
log.Errorf("send message error : %s", err.Error())
|
log.Errorf("send message error : %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue