|
|
package order
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
|
...
|
...
|
@@ -117,8 +118,11 @@ func orderTotalStatic(order *domain.OrderBase) interface{} { |
|
|
// 订单统计
|
|
|
func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatisticsRequest) (rsp *protocol.OrderStatisticsResponse, err error) {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
OrderDao, _ = factory.CreateOrderBaseDao(transactionContext)
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
OrderDao, _ = factory.CreateOrderBaseDao(transactionContext)
|
|
|
PartnerInfoRepository, _ = factory.CreatePartnerInfoRepositoryIn(transactionContext)
|
|
|
partnerInfo *domain.PartnerInfo
|
|
|
orderBonus domain.OrderBonusResponse
|
|
|
)
|
|
|
if err = transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, err
|
...
|
...
|
@@ -127,14 +131,11 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic |
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
rsp = &protocol.OrderStatisticsResponse{Statistics: protocol.OrderStatics{}}
|
|
|
//if rsp.Statistics.TodayIntentionQuantity, rsp.Statistics.TodayIntentionMoney, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
|
|
|
// BeginTime: utils.GetDayBegin().Unix() * 1000,
|
|
|
// EndTime: utils.GetDayEnd().Unix() * 1000,
|
|
|
// OrderType: domain.OrderIntention,
|
|
|
// PartnerId: header.UserId,
|
|
|
//}); err != nil {
|
|
|
// return
|
|
|
//}
|
|
|
if partnerInfo, err := PartnerInfoRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
|
|
err = protocol.NewCustomMessage(1, fmt.Sprintf("%v %v", "用户不存在:", header.UserId))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if rsp.Statistics.TodayRealQuantity, rsp.Statistics.TodayRealMoney, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
|
|
|
BeginTime: utils.GetDayBegin().Unix() * 1000,
|
|
|
EndTime: utils.GetDayEnd().Unix() * 1000,
|
...
|
...
|
@@ -152,6 +153,12 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic |
|
|
}
|
|
|
rsp.Statistics.TodayRealMoney = utils.Decimal(rsp.Statistics.TodayRealMoney)
|
|
|
rsp.Statistics.CumulativeMoney = utils.Decimal(rsp.Statistics.CumulativeMoney)
|
|
|
|
|
|
//事业分红/业务分红
|
|
|
//var enterpriseBonus,businessBonus float64
|
|
|
//if orderBonus,err= OrderDao.OrderBonusStatics(domain.OrderBonusQuery{PartnerId:header.UserId});e==nil{
|
|
|
//
|
|
|
//}
|
|
|
err = transactionContext.CommitTransaction()
|
|
|
return
|
|
|
}
|
...
|
...
|
|