作者 陈志颖

合并分支 'dev-v0.6.0' 到 'dev'

Dev v0.6.0



查看合并请求 !1
appname = partner
runmode = "${RUN_MODE||dev}"
httpport = "${HTTP_PORT||8080}"
httpport = "${HTTP_PORT||8082}"
#开启监控
EnableAdmin = false
... ...
... ... @@ -108,6 +108,9 @@ func newQueryOptionV2(request *protocolx.PartnersRequest) map[string]interface{}
if request.EndTime > 0 {
queryOption["endTime"] = request.EndTime / 1000
}
if request.Keyword != "" {
queryOption["keyword"] = request.Keyword
}
queryOption["limit"] = request.PageSize
queryOption["offset"] = request.PageSize * request.PageIndex
... ...
... ... @@ -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
... ...
... ... @@ -252,6 +252,10 @@ func DomainOrderToOrderListItem(order *domain.OrderBase) *protocol.OrderListItem
OrderType: order.OrderType,
OrderNo: order.OrderCode,
DeliveryNo: order.DeliveryCode,
OrderDistrict: map[string]interface{}{
"id": order.RegionInfo.RegionId,
"name": order.RegionInfo.RegionName,
},
OrderAmount: order.PlanOrderAmount,
UpdateTime: order.UpdateTime.Unix() * 1000,
MyDividend: bonusStatic.OrderTotalReceivable(),
... ...
... ... @@ -4,7 +4,7 @@ import "os"
var REDIS_HOST = "127.0.0.1"
var REDIS_PORT = "6379"
var REDIS_AUTH = "123456"
var REDIS_AUTH = ""
func init() {
if os.Getenv("REDIS_HOST") != "" {
... ...
... ... @@ -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)
... ...
... ... @@ -96,6 +96,9 @@ func (dao *PartnerInfoDao) Partners(partnerIds []int64, queryOptions map[string]
if endTime, ok := queryOptions["endTime"]; ok {
filterPartners.WriteString(fmt.Sprintf(" and cooperate_time<to_timestamp(%v)", endTime))
}
if keyword, ok := queryOptions["keyword"]; ok && keyword.(string) != "" {
filterPartners.WriteString(fmt.Sprintf(` and partner_name LIKE '%v'`, fmt.Sprintf("%%%s%%", "%%" + keyword.(string) + "%")))
}
sql.WriteString(fmt.Sprintf(`
SELECT A.*,B.total,B.amount,COALESCE(B.bonus,0) bonus,B.bonus_expense
... ...
... ... @@ -77,8 +77,7 @@ func (repository *OrderBaseRepository) Find(queryOptions map[string]interface{})
var OrderBaseModels []*models.OrderBase
OrderBases := make([]*domain.OrderBase, 0)
query := NewQuery(tx.Model(&OrderBaseModels), queryOptions)
query.
SetWhere(`"order_base".partner_id= ?`, "partnerId").
query.SetWhere(`"order_base".partner_id= ?`, "partnerId").
SetWhere(`"order_base".order_type= ?`, "orderType").
SetWhere(`"order_base".create_time >= ?`, "beginTime").
SetWhere(`"order_base".create_time < ?`, "endTime").
... ...
... ... @@ -26,8 +26,8 @@ func CreateResponseLogFilter(logger *logs.BeeLogger) func(ctx *context.Context)
return func(ctx *context.Context) {
requestId := ctx.Request.Header.Get("requestId")
body, _ := json.Marshal(ctx.Input.GetData("outputData"))
if len(body) > 1000 {
body = body[:1000]
if len(body) > 10000 {
body = body[:10000]
}
logger.Debug(fmt.Sprintf("<====Send RequestId:%v BodyData:%s", requestId, body))
}
... ...
... ... @@ -15,4 +15,6 @@ type PartnersRequest struct {
JoinWays []JoinWays `json:"joinWays"`
// 分红排序(0.从多到少 1.从少到多)
SortBy int `json:"sortBy"`
// 合伙人姓名
Keyword string `json:"keyword"`
}
... ...
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"`
... ...
... ... @@ -24,6 +24,7 @@ type OrderDetailResponse struct {
// MyDividend float64 `json:"myDividend"`
// MyDividendPercent float64 `json:"myDividendPercent"`
//}
type OrderDetail struct {
Id int64 `json:"id"`
OrderNo string `json:"orderNo"` //订单号
... ... @@ -36,6 +37,7 @@ type OrderDetail struct {
Products interface{} `json:"products"`
Total interface{} `json:"total"`
}
type Customer struct {
Uname string `json:"uname"`
Phone string `json:"phone"`
... ... @@ -110,8 +112,11 @@ type OrderListItem struct {
OrderStatus int `json:"-"`
//实际订单数量
OrderActualCount int `json:"-"`
// 订单区域
OrderDistrict map[string]interface{} `json:"orderDistrict"`
//订单金额
OrderAmount float64 `json:"orderAmount"`
// 订单更新时间
UpdateTime int64 `json:"updateTime"`
//我的分红
MyDividend float64 `json:"dividendReceivable"`
... ...