作者 yangfu

增加:fix 统计

@@ -167,10 +167,10 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont @@ -167,10 +167,10 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont
167 } 167 }
168 if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderType: domain.OrderReal}); e == nil { 168 if bonus, e := OrderBaseDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, OrderType: domain.OrderReal}); e == nil {
169 Statistics["careerOrdersMoney"] = bonus.TotalOrderAmount 169 Statistics["careerOrdersMoney"] = bonus.TotalOrderAmount
170 - Statistics["careerDividend"] = bonus.BonusExpense 170 + Statistics["careerDividend"] = bonus.Bonus
171 } 171 }
172 if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, IsDisable: 1}); e == nil { 172 if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: partnerIds, IsDisable: 1}); e == nil {
173 - Statistics["businessDividend"] = businessBonus.BonusExpense 173 + Statistics["businessDividend"] = businessBonus.Bonus
174 Statistics["businessOrdersMoney"] = businessBonus.TotalOrderAmount 174 Statistics["businessOrdersMoney"] = businessBonus.TotalOrderAmount
175 } 175 }
176 Statistics["developDividend"] = 0 176 Statistics["developDividend"] = 0
@@ -251,7 +251,7 @@ func getPartners(userId int64, request *protocolx.PartnersRequest, transactionCo @@ -251,7 +251,7 @@ func getPartners(userId int64, request *protocolx.PartnersRequest, transactionCo
251 mapPartners["district"] = protocolx.Districts{Id: p.RegionInfo.RegionId, Name: p.RegionInfo.RegionName} 251 mapPartners["district"] = protocolx.Districts{Id: p.RegionInfo.RegionId, Name: p.RegionInfo.RegionName}
252 } 252 }
253 mapPartners["cooperationTime"] = p.CooperateTime.Unix() * 1000 253 mapPartners["cooperationTime"] = p.CooperateTime.Unix() * 1000
254 - mapPartners["dividend"] = p.BonusExpense 254 + mapPartners["dividend"] = utils.Decimal(p.Bonus)
255 mapPartners["ordersCount"] = p.Total 255 mapPartners["ordersCount"] = p.Total
256 mapPartners["ordersMoney"] = utils.Decimal(p.Amount) 256 mapPartners["ordersMoney"] = utils.Decimal(p.Amount)
257 array = append(array, mapPartners) 257 array = append(array, mapPartners)
@@ -55,7 +55,7 @@ func (dao *OrderBaseDao) OrderBonusStatics(option domain.OrderBonusQuery) (rsp d @@ -55,7 +55,7 @@ func (dao *OrderBaseDao) OrderBonusStatics(option domain.OrderBonusQuery) (rsp d
55 q.ColumnExpr("count(*) count") 55 q.ColumnExpr("count(*) count")
56 q.ColumnExpr("sum((case when use_order_count>0 then use_partner_bonus else plan_partner_bonus end)) bonus") 56 q.ColumnExpr("sum((case when use_order_count>0 then use_partner_bonus else plan_partner_bonus end)) bonus")
57 q.ColumnExpr("sum(partner_bonus_expense) bonus_expense") 57 q.ColumnExpr("sum(partner_bonus_expense) bonus_expense")
58 - q.ColumnExpr("sum((case when use_order_count>0 then use_order_amount else plan_order_amount end)) total_order_amount") 58 + q.ColumnExpr("sum(plan_order_amount) total_order_amount")
59 if option.PartnerId > 0 { 59 if option.PartnerId > 0 {
60 q.Where(`"order_base".partner_id =?`, option.PartnerId) 60 q.Where(`"order_base".partner_id =?`, option.PartnerId)
61 } 61 }
@@ -106,11 +106,11 @@ A left join @@ -106,11 +106,11 @@ A left join
106 SELECT partner_id,count(*) total,sum(amount) amount,sum(bonus) bonus,sum(bonus_expense) bonus_expense FROM 106 SELECT partner_id,count(*) total,sum(amount) amount,sum(bonus) bonus,sum(bonus_expense) bonus_expense FROM
107 ( 107 (
108 SELECT partner_id, 108 SELECT partner_id,
109 - (case when use_order_count>0 then use_order_amount else plan_order_amount end) amount, 109 + (case when use_order_count>0 then plan_order_amount else plan_order_amount end) amount,
110 (case when use_order_count>0 then use_partner_bonus else plan_partner_bonus end) bonus, 110 (case when use_order_count>0 then use_partner_bonus else plan_partner_bonus end) bonus,
111 partner_bonus_expense bonus_expense FROM "order_base" AS "order_base" 111 partner_bonus_expense bonus_expense FROM "order_base" AS "order_base"
112 WHERE (partner_id in (?)) and order_type =1 112 WHERE (partner_id in (?)) and order_type =1
113 - UNION 113 + UNION ALL
114 SELECT partner_info_id partner_id, 114 SELECT partner_info_id partner_id,
115 0 amount, bonus bonus, bonus_expense bonus_expense FROM business_bonus 115 0 amount, bonus bonus, bonus_expense bonus_expense FROM business_bonus
116 WHERE (partner_info_id in (?)) and is_disable=1 116 WHERE (partner_info_id in (?)) and is_disable=1