作者 yangfu

修改:去掉订单状态(开启,关闭)

@@ -23,7 +23,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis @@ -23,7 +23,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis
23 defer func() { 23 defer func() {
24 transactionContext.RollbackTransaction() 24 transactionContext.RollbackTransaction()
25 }() 25 }()
26 - _, orderAll, e := OrderBaseResponsitory.Find(utils.ObjectJsonToMap(domain.OrderQueryOption{PartnerId: header.UserId, EndTime: time.Now(), SortByCreateTime: domain.DESC, OrderType: domain.OrderReal, IsDisable: "0"})) 26 + _, orderAll, e := OrderBaseResponsitory.Find(utils.ObjectJsonToMap(domain.OrderQueryOption{PartnerId: header.UserId, EndTime: time.Now(), SortByCreateTime: domain.DESC, OrderType: domain.OrderReal}))
27 if e != nil { 27 if e != nil {
28 log.Error(e) 28 log.Error(e)
29 } 29 }
@@ -105,11 +105,11 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR @@ -105,11 +105,11 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR
105 rsp = &protocol.DividendOrdersResponse{List: make([]*protocol.DividendOrderListItem, 0)} 105 rsp = &protocol.DividendOrdersResponse{List: make([]*protocol.DividendOrderListItem, 0)}
106 106
107 count, orders, err = OrderDao.DividendOrders(&domain.DividendOrdersQueryOption{ 107 count, orders, err = OrderDao.DividendOrders(&domain.DividendOrdersQueryOption{
108 - OrderType: domain.OrderReal,  
109 - PartnerId: header.UserId,  
110 - DetailAction: request.DetailAction,  
111 - DividendAction: request.DividendAction,  
112 - IsDisable: "0", 108 + OrderType: domain.OrderReal,
  109 + PartnerId: header.UserId,
  110 + DetailAction: request.DetailAction,
  111 + DividendAction: request.DividendAction,
  112 + //IsDisable: "0",
113 StartTime: request.StartTime, 113 StartTime: request.StartTime,
114 EndTime: request.EndTime, 114 EndTime: request.EndTime,
115 Offset: request.PageIndex * request.PageSize, 115 Offset: request.PageIndex * request.PageSize,
@@ -175,7 +175,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r @@ -175,7 +175,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
175 Limit: request.PageSize, 175 Limit: request.PageSize,
176 Offset: request.PageSize * request.PageIndex, 176 Offset: request.PageSize * request.PageIndex,
177 SortByUpdateTime: domain.DESC, 177 SortByUpdateTime: domain.DESC,
178 - IsDisable: "0", 178 + //IsDisable: "0",
179 } 179 }
180 if request.StartTime > 0 { 180 if request.StartTime > 0 {
181 queryOption.BeginTime = time.Unix(request.StartTime/1000, 0) 181 queryOption.BeginTime = time.Unix(request.StartTime/1000, 0)
@@ -53,6 +53,8 @@ type OrderBase struct { @@ -53,6 +53,8 @@ type OrderBase struct {
53 PartnerBonusExpense float64 53 PartnerBonusExpense float64
54 //是否关闭【0;否】【1:是】 54 //是否关闭【0;否】【1:是】
55 IsDisable int8 55 IsDisable int8
  56 + //1:待支付分红 2:已支付分红
  57 + BonusStatus int8
56 //货物列表 58 //货物列表
57 OrderGood []*OrderGood 59 OrderGood []*OrderGood
58 } 60 }
@@ -67,8 +69,8 @@ func (m *OrderBase) Identify() interface{} { @@ -67,8 +69,8 @@ func (m *OrderBase) Identify() interface{} {
67 //合伙人 69 //合伙人
68 //订单累计分红 70 //订单累计分红
69 func (m *OrderBase) OrderTotalBonus() float64 { 71 func (m *OrderBase) OrderTotalBonus() float64 {
70 - if m.UsePartnerBonus >= 0 {  
71 - return utils.Decimal(m.UsePartnerBonus) 72 + if m.UseOrderCount >= 0 {
  73 + return utils.Decimal(m.UsePartnerBonus + m.PartnerBonusExpense)
72 } 74 }
73 return utils.Decimal(m.PlanPartnerBonus) 75 return utils.Decimal(m.PlanPartnerBonus)
74 } 76 }
@@ -120,16 +122,16 @@ func (m *OrderBase) IsRead() int { @@ -120,16 +122,16 @@ func (m *OrderBase) IsRead() int {
120 } 122 }
121 123
122 type OrderQueryOption struct { 124 type OrderQueryOption struct {
123 - PartnerId int64 `json:"partnerId,omitempty"`  
124 - OrderType int `json:"orderType,omitempty"`  
125 - OrderStatus int `json:"orderStatus,omitempty"`  
126 - BeginTime time.Time `json:"beginTime,omitempty"`  
127 - EndTime time.Time `json:"endTime,omitempty"`  
128 - IsDisable string `json:"isDisable,omitempty"`  
129 - SortByCreateTime string `json:"sortByCreateTime,omitempty"`  
130 - SortByUpdateTime string `json:"sortByUpdateTime,omitempty"`  
131 - Offset int `json:"offset,omitempty"`  
132 - Limit int `json:"limit,omitempty"` 125 + PartnerId int64 `json:"partnerId,omitempty"`
  126 + OrderType int `json:"orderType,omitempty"`
  127 + OrderStatus int `json:"orderStatus,omitempty"`
  128 + BeginTime time.Time `json:"beginTime,omitempty"`
  129 + EndTime time.Time `json:"endTime,omitempty"`
  130 + //IsDisable string `json:"isDisable,omitempty"`
  131 + SortByCreateTime string `json:"sortByCreateTime,omitempty"`
  132 + SortByUpdateTime string `json:"sortByUpdateTime,omitempty"`
  133 + Offset int `json:"offset,omitempty"`
  134 + Limit int `json:"limit,omitempty"`
133 } 135 }
134 136
135 type DividendOrdersQueryOption struct { 137 type DividendOrdersQueryOption struct {
@@ -11,7 +11,7 @@ type OrderStaticQuery struct { @@ -11,7 +11,7 @@ type OrderStaticQuery struct {
11 EndTime int64 `json:"endTime,omitempty"` 11 EndTime int64 `json:"endTime,omitempty"`
12 OrderStatus int `json:"orderStatus,omitempty"` 12 OrderStatus int `json:"orderStatus,omitempty"`
13 OrderType int `json:"orderType,omitempty"` 13 OrderType int `json:"orderType,omitempty"`
14 - IsDisable int `json:"isDisable,omitempty"` 14 + //IsDisable int `json:"isDisable,omitempty"`
15 } 15 }
16 16
17 type DividendOrdersQuery struct { 17 type DividendOrdersQuery struct {
@@ -6,7 +6,6 @@ import ( @@ -6,7 +6,6 @@ import (
6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models" 6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction" 7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction"
8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
9 - "strconv"  
10 "time" 9 "time"
11 ) 10 )
12 11
@@ -35,7 +34,7 @@ func (dao *OrderBaseDao) OrderStatics(option *domain.OrderStaticQuery) (count in @@ -35,7 +34,7 @@ func (dao *OrderBaseDao) OrderStatics(option *domain.OrderStaticQuery) (count in
35 if option.EndTime > 0 { 34 if option.EndTime > 0 {
36 q.Where(`"order_base".create_time <?`, time.Unix(option.EndTime/1000, 0)) 35 q.Where(`"order_base".create_time <?`, time.Unix(option.EndTime/1000, 0))
37 } 36 }
38 - q.Where(`"order_base".is_disable =?`, 0) 37 + //q.Where(`"order_base".is_disable =?`, 0)
39 err = q.Select(&count, &amount, &orderAmount) 38 err = q.Select(&count, &amount, &orderAmount)
40 if option.OrderType == domain.OrderIntention { //意向订单值只有 order_amount order_actual_amount还未赋值 39 if option.OrderType == domain.OrderIntention { //意向订单值只有 order_amount order_actual_amount还未赋值
41 amount = orderAmount 40 amount = orderAmount
@@ -61,10 +60,10 @@ func (dao *OrderBaseDao) DividendOrders(option *domain.DividendOrdersQueryOption @@ -61,10 +60,10 @@ func (dao *OrderBaseDao) DividendOrders(option *domain.DividendOrdersQueryOption
61 if option.EndTime > 0 { 60 if option.EndTime > 0 {
62 q.Where(`"order_base".create_time <?`, time.Unix(option.EndTime/1000, 0)) 61 q.Where(`"order_base".create_time <?`, time.Unix(option.EndTime/1000, 0))
63 } 62 }
64 - if len(option.IsDisable) > 0 {  
65 - value, _ := strconv.Atoi(option.IsDisable)  
66 - q.Where(`"order_base".is_disable =?`, value)  
67 - } 63 + //if len(option.IsDisable) > 0 {
  64 + // value, _ := strconv.Atoi(option.IsDisable)
  65 + // q.Where(`"order_base".is_disable =?`, value)
  66 + //}
68 if option.DividendAction == 0 { //累计分红 67 if option.DividendAction == 0 { //累计分红
69 if option.DetailAction == 0 { //已收明细 68 if option.DetailAction == 0 { //已收明细
70 q.Where(`"order_base".partner_bonus_has>0`) 69 q.Where(`"order_base".partner_bonus_has>0`)
@@ -54,6 +54,8 @@ type OrderBase struct { @@ -54,6 +54,8 @@ type OrderBase struct {
54 PartnerBonusExpense float64 54 PartnerBonusExpense float64
55 //是否关闭【0;否】【1:是】 55 //是否关闭【0;否】【1:是】
56 IsDisable int8 56 IsDisable int8
  57 + //1:待支付分红 2:已支付分红
  58 + BonusStatus int8
57 //货物列表 59 //货物列表
58 OrderGood []*OrderGood `pg:"fk:order_id"` 60 OrderGood []*OrderGood `pg:"fk:order_id"`
59 } 61 }
@@ -79,7 +79,7 @@ func (repository *OrderBaseRepository) Find(queryOptions map[string]interface{}) @@ -79,7 +79,7 @@ func (repository *OrderBaseRepository) Find(queryOptions map[string]interface{})
79 SetWhere(`"order_base".order_type= ?`, "orderType"). 79 SetWhere(`"order_base".order_type= ?`, "orderType").
80 SetWhere(`"order_base".create_time >= ?`, "beginTime"). 80 SetWhere(`"order_base".create_time >= ?`, "beginTime").
81 SetWhere(`"order_base".create_time < ?`, "endTime"). 81 SetWhere(`"order_base".create_time < ?`, "endTime").
82 - SetWhere(`"order_base".is_disable = ?`, "isDisable"). 82 + //SetWhere(`"order_base".is_disable = ?`, "isDisable").
83 SetLimit(). 83 SetLimit().
84 SetOrder(`order_base.create_time`, "sortByCreateTime"). 84 SetOrder(`order_base.create_time`, "sortByCreateTime").
85 SetOrder(`order_base.update_time`, "sortByUpdateTime") 85 SetOrder(`order_base.update_time`, "sortByUpdateTime")