作者 陈志颖

refactor:添加合伙人类型筛选

... ... @@ -133,6 +133,7 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR
Offset: request.PageIndex * request.PageSize,
Limit: request.PageSize,
SortByUpdateTime: domain.DESC,
JoinWays: request.JoinWays,
})
if err != nil {
return
... ...
... ... @@ -2,6 +2,7 @@ package domain
import (
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/company"
"time"
)
... ... @@ -173,6 +174,7 @@ type DividendOrdersQueryOption struct {
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
SortByUpdateTime string `json:"sortByUpdateTime,omitempty"`
JoinWays []*company.JoinWays `json:"joinWays,omitempty"` // 合伙类型
}
//买家
... ...
... ... @@ -7,6 +7,7 @@ import (
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
"strings"
"time"
)
... ... @@ -109,6 +110,20 @@ func (dao *OrderBaseDao) DividendOrders(option *domain.DividendOrdersQueryOption
if option.EndTime > 0 {
q.Where(`"order_base".create_time <?`, time.Unix(option.EndTime/1000, 0))
}
if len(option.JoinWays) > 0 {
var joinWays []int64
for i := 0; i < len(option.JoinWays); i++ {
joinWays = append(joinWays, option.JoinWays[i].Type)
}
var filterJoinWays = strings.Builder{}
for i := range joinWays {
filterJoinWays.WriteString(fmt.Sprintf(` partner_category @>'{"id":%v}'`, joinWays[i]))
if i != (len(joinWays) - 1) {
filterJoinWays.WriteString(" or ")
}
}
q.Where(filterJoinWays.String())
}
//if len(option.IsDisable) > 0 {
// value, _ := strconv.Atoi(option.IsDisable)
// q.Where(`"order_base".is_disable =?`, value)
... ...
package protocol
import "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/company"
const (
BonusTotal = iota //0 累计分红
BonusOutstanding //1 分红支出
... ... @@ -38,6 +40,9 @@ type DividendOrdersRequest struct {
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime" valid:"Required"`
// 合作类型(空或不传,即所有类型)
JoinWays []*company.JoinWays `json:"joinWays"`
PageIndex int `json:"pageIndex,omitempty"`
PageSize int `json:"pageSize,omitempty"`
... ...