mirror of http://gitlab.batiao8.com/yic/film.git
price
This commit is contained in:
parent
0060d8c32a
commit
ee962053df
|
@ -10,31 +10,32 @@ var (
|
|||
)
|
||||
|
||||
type Order struct {
|
||||
Id int64
|
||||
OrderId string
|
||||
StartTime string
|
||||
StartDate string
|
||||
TotalPrice int64
|
||||
PayPrice int64
|
||||
MinPrice int64
|
||||
MaxPrice int64
|
||||
MaoyanPrice int64
|
||||
SeatNum int
|
||||
Seats string
|
||||
ShowTime int64
|
||||
PayTime int64
|
||||
CityName string
|
||||
ProvinceName string
|
||||
Ting string
|
||||
CinemaName string
|
||||
MovieName string
|
||||
Address string
|
||||
Count int
|
||||
IsSeat int
|
||||
LoverSeat int
|
||||
CreateDate string
|
||||
CreateTime int64
|
||||
UpdateTime int64
|
||||
Id int64
|
||||
OrderId string
|
||||
StartTime string
|
||||
StartDate string
|
||||
TotalPrice int64
|
||||
PayPrice int64
|
||||
MinPrice int64
|
||||
MaxPrice int64
|
||||
MaoyanPrice int64
|
||||
SeatNum int
|
||||
Seats string
|
||||
ShowTime int64
|
||||
PayTime int64
|
||||
OrderCreateTime int64
|
||||
CityName string
|
||||
ProvinceName string
|
||||
Ting string
|
||||
CinemaName string
|
||||
MovieName string
|
||||
Address string
|
||||
Count int
|
||||
IsSeat int
|
||||
LoverSeat int
|
||||
CreateDate string
|
||||
CreateTime int64
|
||||
UpdateTime int64
|
||||
}
|
||||
|
||||
func AddOrder(o *Order) (int64, error) {
|
||||
|
|
|
@ -3,9 +3,11 @@ package common
|
|||
import "film/model"
|
||||
|
||||
type CheckInfo struct {
|
||||
TotalPrice int64
|
||||
UnitPrice int64
|
||||
BillCode string
|
||||
TotalOriginPrice int64
|
||||
TotalRealPrice int64
|
||||
TotalCouponPrice int64
|
||||
UnitPrice int64
|
||||
BillCode string
|
||||
}
|
||||
|
||||
type OrderInfo struct {
|
||||
|
|
|
@ -3,7 +3,6 @@ package dadi
|
|||
import (
|
||||
"encoding/json"
|
||||
"film/base/httputil"
|
||||
"film/base/util"
|
||||
"film/model"
|
||||
"film/worker/common"
|
||||
"fmt"
|
||||
|
@ -268,10 +267,11 @@ func (p *Processor) prevOrderInfo(cinema *Cinema, seatGoods []*SeatGoods) (*Prev
|
|||
}
|
||||
|
||||
log.Debugf("[newPriceCalculate] response : %s", goutil.EncodeJSON(data))
|
||||
totalRealPrice := cast.ToFloat64(cast.ToStringMap(data)["totalRealPrice"])
|
||||
|
||||
realData := cast.ToStringMap(data)
|
||||
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
|
||||
|
||||
return previewOrder, nil
|
||||
|
@ -296,11 +296,13 @@ func (p *Processor) CheckOrder(order *model.Order) (*common.CheckInfo, error) {
|
|||
}
|
||||
|
||||
result := new(common.CheckInfo)
|
||||
result.UnitPrice = previewOrder.TotalPrice / int64(order.SeatNum)
|
||||
result.TotalPrice = previewOrder.TotalPrice
|
||||
result.TotalRealPrice = previewOrder.TotalRealPrice
|
||||
result.TotalRealPrice = previewOrder.TotalOriginPrice
|
||||
result.TotalRealPrice = previewOrder.TotalCouponPrice
|
||||
result.UnitPrice = previewOrder.TotalRealPrice / int64(order.SeatNum)
|
||||
result.BillCode = previewOrder.BillCode
|
||||
log.Infof("check order[%s][%s] totalPrice[%s] [%s][%s][%s] success",
|
||||
order.OrderId, result.BillCode, util.MoneyFen(previewOrder.TotalPrice),
|
||||
log.Infof("check order[%s][%s] previewOrder[%s] [%s][%s][%s] success",
|
||||
order.OrderId, result.BillCode, goutil.EncodeJSON(previewOrder),
|
||||
order.CityName, order.CinemaName, order.MovieName)
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package dadi
|
||||
|
||||
type PreviewOrder struct {
|
||||
BillCode string
|
||||
TotalPrice int64
|
||||
TotalOriginPrice int64
|
||||
TotalRealPrice int64
|
||||
TotalCouponPrice int64
|
||||
BillCode string
|
||||
}
|
||||
|
||||
type SeatGoods struct {
|
||||
|
|
|
@ -88,6 +88,7 @@ func (s *SyncOrder) run() {
|
|||
order.Seats = cast.ToString(data["seats"])
|
||||
order.ShowTime = cast.ToInt64(data["show_time"])
|
||||
order.PayTime = cast.ToInt64(data["pay_time"])
|
||||
order.OrderCreateTime = cast.ToInt64(data["create_time"])
|
||||
order.CityName = cast.ToString(data["cityName"])
|
||||
order.ProvinceName = cast.ToString(data["provinceName"])
|
||||
order.MovieName = cast.ToString(data["movieName"])
|
||||
|
|
|
@ -75,8 +75,9 @@ func (w *Worker) Run() {
|
|||
message = append(message, "【哈哈票订单信息】")
|
||||
message = append(message, fmt.Sprintf("城市:%s", order.CityName))
|
||||
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.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,
|
||||
goutil.If(order.IsSeat == 3, "可以调座", "不可调座"),
|
||||
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("总金额:%.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("订单时间:%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.PayTime, 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, "【大地订单信息】")
|
||||
message = append(message, fmt.Sprintf("单价:%s", util.MoneyFen(checkInfo.UnitPrice)))
|
||||
message = append(message, fmt.Sprintf("总价:%s", util.MoneyFen(checkInfo.TotalPrice)))
|
||||
message = append(message, fmt.Sprintf("订单原价:%s", util.MoneyFen(checkInfo.TotalOriginPrice)))
|
||||
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 {
|
||||
log.Errorf("send message error : %s", err.Error())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue