作者 yangfu

订单详情/列表修改

... ... @@ -15,8 +15,8 @@ func DividendStatistics(header *protocol.RequestHeader, request *protocol.Divide
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
OrderResponsitory, _ = factory.CreateOrderRepository(transactionContext)
beginTime = time.Unix(request.StartTime/1000, 0)
endTime = time.Unix(request.EndTime/1000, 0)
//beginTime = time.Unix(request.StartTime/1000, 0)
//endTime = time.Unix(request.EndTime/1000, 0)
)
if err = transactionContext.StartTransaction(); err != nil {
return nil, err
... ... @@ -26,16 +26,16 @@ func DividendStatistics(header *protocol.RequestHeader, request *protocol.Divide
}()
_, orderAll, e := OrderResponsitory.Find(utils.ObjectJsonToMap(domain.OrderQueryOption{PartnerId: header.UserId, EndTime: time.Now(), SortByCreateTime: domain.DESC}))
if e != nil {
log.Error(e, beginTime, endTime)
log.Error(e)
}
var orderBetween []*domain.Order
for i := range orderAll {
if orderAll[i].CreateAt.After(beginTime) && orderAll[i].CreateAt.Before(endTime) {
if orderAll[i].CreateAt.Unix() >= (request.StartTime/1000) && orderAll[i].CreateAt.Unix() < (request.EndTime/1000) {
orderBetween = append(orderBetween, orderAll[i])
}
}
bonusAll := AllBonusStatics(orderAll, request.DividendAction)
bonusQuarters := QuartersBonusStatics(orderBetween, request.DividendAction)
bonusAll := AllBonusStatics(orderAll, 0)
bonusQuarters := QuartersBonusStatics(orderBetween, 0)
rsp = &protocol.DividendStatisticsResponse{}
rsp.Statistics = protocol.DividendStatistics{
Received: bonusAll.Received,
... ... @@ -51,13 +51,13 @@ func AllBonusStatics(orders []*domain.Order, action int) (bonus protocol.Bonus)
bonus = protocol.Bonus{}
for i := range orders {
o := orders[i]
if action == protocol.BonusTotal {
bonus.Received += o.OrderBonusReceive()
bonus.Outstanding += o.OrderBonusWait()
}
if action == protocol.BonusOutstanding {
bonus.Outstanding += o.OrderBonusOutstanding()
}
//if action == protocol.BonusTotal {
bonus.Received += o.OrderBonusReceive()
bonus.Outstanding += o.OrderBonusWait()
//}
//if action == protocol.BonusOutstanding {
// bonus.Outstanding += o.OrderBonusOutstanding()
//}
}
return
}
... ... @@ -68,13 +68,16 @@ func QuartersBonusStatics(orders []*domain.Order, action int) (bonus []protocol.
for i := range orders {
o := orders[i]
quarter := o.CreateAt.Month() / 4
if action == protocol.BonusTotal {
bonus[quarter].Received += o.OrderBonusReceive()
bonus[quarter].Outstanding += o.OrderBonusWait()
}
if action == protocol.BonusOutstanding {
bonus[quarter].Expend += o.OrderBonusOutstanding()
}
bonus[quarter].Received += o.OrderBonusReceive()
bonus[quarter].Outstanding += o.OrderBonusWait()
bonus[quarter].Expend += o.OrderBonusOutstanding()
//if action == protocol.BonusTotal {
//bonus[quarter].Received += o.OrderBonusReceive()
//bonus[quarter].Outstanding += o.OrderBonusWait()
//}
//if action == protocol.BonusOutstanding {
//bonus[quarter].Expend += o.OrderBonusOutstanding()
//}
}
return
}
... ...
... ... @@ -50,8 +50,8 @@ func OrderDetail(header *protocol.RequestHeader, request *protocol.OrderDetailRe
OrderStatus: order.OrderStatus,
CreateTime: order.CreateAt.Unix() * 1000,
UpdateTime: order.UpdateAt.Unix() * 1000,
OrderQuantity: order.OrderCount,
OrderAmount: order.OrderAmount,
OrderQuantity: order.OrderActualCount,
OrderAmount: order.OrderActualAmount,
OrderAmountCancel: order.OrderAmountCancel(),
OrderDistrict: map[string]interface{}{"id": order.OrderRegionInfo.RegionId, "name": order.OrderRegionInfo.RegionName},
Customer: protocol.Customer{Uname: order.Buyer.BuyerName, Phone: order.Buyer.ContactInfo},
... ...
... ... @@ -27,6 +27,10 @@ func (this *AuthController) Login() {
msg = m
return
}
if request.ClientId != clientId {
msg = protocol.NewResponseMessage(101, "clientId无效")
return
}
header := this.GetRequestHeader(this.Ctx)
data, err := auth.Login(header, request)
if err != nil {
... ...
... ... @@ -10,7 +10,7 @@ type DividendStatisticsRequest struct {
StartTime int64 `json:"startTime" valid:"Required"`
EndTime int64 `json:"endTime" valid:"Required"`
//分红类型(0累计分红、1分红支出)
DividendAction int `json:"dividendAction"`
//DividendAction int `json:"dividendAction"`
}
type DividendStatisticsResponse struct {
Statistics DividendStatistics `json:"statistics"`
... ...