...
|
...
|
@@ -149,10 +149,10 @@ func getJoinWays(transactionContext *transaction.TransactionContext) (joinWays [ |
|
|
// 获取公司统计
|
|
|
func getStatistics(userId int64, transactionContext *transaction.TransactionContext) (interface{}, error) {
|
|
|
var (
|
|
|
UsersRepository, _ = factory.CreateUsersRepository(transactionContext)
|
|
|
PartnerInfoDao, _ = factory.CreatePartnerInfoDao(transactionContext)
|
|
|
OrderBaseDao, _ = factory.CreateOrderBaseDao(transactionContext)
|
|
|
BusinessBonusDao, _ = factory.CreateBusinessBonusDao(transactionContext)
|
|
|
UsersRepository, _ = factory.CreateUsersRepository(transactionContext)
|
|
|
PartnerInfoDao, _ = factory.CreatePartnerInfoDao(transactionContext)
|
|
|
OrderBaseDao, _ = factory.CreateOrderBaseDao(transactionContext)
|
|
|
//BusinessBonusDao, _ = factory.CreateBusinessBonusDao(transactionContext)
|
|
|
//user *domain.Users
|
|
|
partnerIds []int64
|
|
|
)
|
...
|
...
|
@@ -163,6 +163,10 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont |
|
|
partnerIds = user.AccessPartnerIds()
|
|
|
}
|
|
|
Statistics := make(map[string]interface{})
|
|
|
//Statistics["developDividend"] = 0
|
|
|
//Statistics["developOrdersMoney"] = 0
|
|
|
//Statistics["appDividend"] = 0
|
|
|
//Statistics["appOrdersMoney"] = 0
|
|
|
if count, e := PartnerInfoDao.PartnerStatic(map[string]interface{}{"inPartnerIds": partnerIds, "inPartnerCategory": domain.Career}); e == nil {
|
|
|
Statistics["careerCount"] = count
|
|
|
}
|
...
|
...
|
@@ -175,18 +179,27 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont |
|
|
if count, e := PartnerInfoDao.PartnerStatic(map[string]interface{}{"inPartnerIds": partnerIds, "inPartnerCategory": domain.App}); e == nil {
|
|
|
Statistics["appCount"] = count
|
|
|
}
|
|
|
if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career)}); e == nil {
|
|
|
if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career), PartnerCategoryId: domain.Career}); e == nil {
|
|
|
Statistics["careerOrdersMoney"] = bonus.TotalOrderAmount
|
|
|
Statistics["careerDividend"] = bonus.Bonus
|
|
|
}
|
|
|
if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, IsDisable: 1}); e == nil {
|
|
|
Statistics["businessDividend"] = businessBonus.Bonus
|
|
|
Statistics["businessOrdersMoney"] = businessBonus.TotalOrderAmount
|
|
|
if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career), PartnerCategoryId: domain.Business}); e == nil {
|
|
|
Statistics["businessOrdersMoney"] = bonus.TotalOrderAmount
|
|
|
Statistics["businessDividend"] = bonus.Bonus
|
|
|
}
|
|
|
Statistics["developDividend"] = 0
|
|
|
Statistics["developOrdersMoney"] = 0
|
|
|
Statistics["appDividend"] = 0
|
|
|
Statistics["appOrdersMoney"] = 0
|
|
|
if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career), PartnerCategoryId: domain.Develop}); e == nil {
|
|
|
Statistics["developOrdersMoney"] = bonus.TotalOrderAmount
|
|
|
Statistics["developDividend"] = bonus.Bonus
|
|
|
}
|
|
|
if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderTypes: domain.UserOrderTypes(domain.Career), PartnerCategoryId: domain.App}); e == nil {
|
|
|
Statistics["appOrdersMoney"] = bonus.TotalOrderAmount
|
|
|
Statistics["appDividend"] = bonus.Bonus
|
|
|
}
|
|
|
//if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, IsDisable: 1}); e == nil {
|
|
|
// Statistics["businessDividend"] = businessBonus.Bonus
|
|
|
// Statistics["businessOrdersMoney"] = businessBonus.TotalOrderAmount
|
|
|
//}
|
|
|
|
|
|
Statistics["totalCount"] = len(partnerIds)
|
|
|
return Statistics, nil
|
|
|
}
|
...
|
...
|
|