change order pais

This commit is contained in:
2026-08-27 17:12:00 +08:00
parent 433a17140c
commit e23bf8dea3
9 changed files with 109 additions and 8 deletions
+1
View File
@@ -108,6 +108,7 @@ require (
github.com/richardlehane/mscfb v1.0.7 // indirect github.com/richardlehane/mscfb v1.0.7 // indirect
github.com/richardlehane/msoleps v1.0.6 // indirect github.com/richardlehane/msoleps v1.0.6 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/samber/lo v1.53.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.15.0 // indirect github.com/spf13/afero v1.15.0 // indirect
+2
View File
@@ -304,6 +304,8 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik= github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/samber/lo v1.53.0 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM=
github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
Binary file not shown.
+2
View File
@@ -98,6 +98,8 @@ message AddressByStoreItemsRequest {
message OrderAuditingItemsRequest { message OrderAuditingItemsRequest {
int32 page = 1; int32 page = 1;
int32 size = 2; int32 size = 2;
int32 status = 3;
repeated string time = 8;
} }
message OrderAuditingRequest { message OrderAuditingRequest {
+20 -2
View File
@@ -906,6 +906,8 @@ type OrderAuditingItemsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
Status int32 `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
Time []string `protobuf:"bytes,8,rep,name=time,proto3" json:"time,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@@ -954,6 +956,20 @@ func (x *OrderAuditingItemsRequest) GetSize() int32 {
return 0 return 0
} }
func (x *OrderAuditingItemsRequest) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *OrderAuditingItemsRequest) GetTime() []string {
if x != nil {
return x.Time
}
return nil
}
type OrderAuditingRequest struct { type OrderAuditingRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
@@ -1144,10 +1160,12 @@ const file_order_order_proto_rawDesc = "" +
"\asale_id\x18\a \x01(\x03R\x06saleId\x12\x12\n" + "\asale_id\x18\a \x01(\x03R\x06saleId\x12\x12\n" +
"\x04time\x18\b \x03(\tR\x04time\"7\n" + "\x04time\x18\b \x03(\tR\x04time\"7\n" +
"\x1aAddressByStoreItemsRequest\x12\x19\n" + "\x1aAddressByStoreItemsRequest\x12\x19\n" +
"\bstore_id\x18\x01 \x01(\x03R\astoreId\"C\n" + "\bstore_id\x18\x01 \x01(\x03R\astoreId\"o\n" +
"\x19OrderAuditingItemsRequest\x12\x12\n" + "\x19OrderAuditingItemsRequest\x12\x12\n" +
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x12\n" + "\x04page\x18\x01 \x01(\x05R\x04page\x12\x12\n" +
"\x04size\x18\x02 \x01(\x05R\x04size\"V\n" + "\x04size\x18\x02 \x01(\x05R\x04size\x12\x16\n" +
"\x06status\x18\x03 \x01(\x05R\x06status\x12\x12\n" +
"\x04time\x18\b \x03(\tR\x04time\"V\n" +
"\x14OrderAuditingRequest\x12\x0e\n" + "\x14OrderAuditingRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" +
"\x06status\x18\x02 \x01(\x05R\x06status\x12\x16\n" + "\x06status\x18\x02 \x01(\x05R\x06status\x12\x16\n" +
+1
View File
@@ -187,6 +187,7 @@ type OrderImitateInfo struct {
type OrderImitateItems struct { type OrderImitateItems struct {
OrderImitateInfo OrderImitateInfo
ProductItems []OrderProducts `gorm:"-" json:"product_items"` ProductItems []OrderProducts `gorm:"-" json:"product_items"`
AesMobile string `gorm:"-" json:"aes_mobile"`
} }
type OrderDownInfo struct { type OrderDownInfo struct {
+18 -2
View File
@@ -12,6 +12,7 @@ import (
order "lone-services/rpc/order/pb" order "lone-services/rpc/order/pb"
"lone-services/services/order/internal/svc" "lone-services/services/order/internal/svc"
"github.com/samber/lo"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
) )
@@ -80,18 +81,33 @@ func (l *ItemsLogic) Items(in *order.OrderItemsRequest) (*order.Response, error)
w.Other["create_time < ?"] = strconv.Itoa(int(in.Time[utils.NumberOne])) w.Other["create_time < ?"] = strconv.Itoa(int(in.Time[utils.NumberOne]))
} }
err := model.OrderModel{}.Init().Items(w, &info) items, err := model.OrderModel{}.Init().Page(w, &info)
if err != nil { if err != nil {
l.Logger.Error(err) l.Logger.Error(err)
return l.fail(utils.ErrorNotFund) return l.fail(utils.ErrorNotFund)
} }
var productItems []dao.OrderProducts
err = model.OrderProductModel{}.Init().Items(w, &productItems)
if err != nil {
utils.Logger.Error("product err:", err)
return l.fail(utils.ErrorNotFund)
}
productMap := lo.GroupBy(productItems, func(item dao.OrderProducts) string {
return item.OrderSn
})
for key, v := range info { for key, v := range info {
mobile, aErr := utils.DecryptPhone(v.Mobile) mobile, aErr := utils.DecryptPhone(v.Mobile)
if aErr == nil { if aErr == nil {
if _, ok := productMap[v.OrderSn]; ok {
info[key].ProductItems = productMap[v.OrderSn]
}
info[key].AesMobile = v.Mobile info[key].AesMobile = v.Mobile
info[key].Mobile = utils.DecryptPhoneReplace(mobile) info[key].Mobile = utils.DecryptPhoneReplace(mobile)
} }
} }
return l.ok(info) items.Items = info
return l.ok(items)
} }
@@ -2,10 +2,17 @@ package logic
import ( import (
"context" "context"
"lone-services/pkg/modelbase"
"lone-services/pkg/utils"
"lone-services/services/order/internal/dao"
"lone-services/services/order/internal/model"
"lone-services/services/order/validator"
"strconv"
"lone-services/rpc/order/pb" "lone-services/rpc/order/pb"
"lone-services/services/order/internal/svc" "lone-services/services/order/internal/svc"
"github.com/samber/lo"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
) )
@@ -25,7 +32,59 @@ func NewOrderAuditingItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
} }
func (l *OrderAuditingItemsLogic) OrderAuditingItems(in *order.OrderAuditingItemsRequest) (*order.Response, error) { func (l *OrderAuditingItemsLogic) OrderAuditingItems(in *order.OrderAuditingItemsRequest) (*order.Response, error) {
// todo: add your logic here and delete this line var v validator.AdminOrderAuditingItemsValidator
if fail := l.checkParams(in, &v); fail != nil {
return fail, nil
}
adminInfo := utils.GetUserFromCtx(l.ctx)
if adminInfo.ID < utils.NumberOne {
return l.fail(utils.ErrorNoLoginInfo)
}
return &order.Response{}, nil var info []dao.OrderImitateItems
w := modelbase.Params{
Page: int(v.Page),
Size: int(v.Size),
Order: "id desc",
Eq: map[string]string{},
Other: map[string]string{"verify_status > ?": strconv.Itoa(utils.NumberZero)},
}
if v.Status > utils.NumberZero {
w.Eq = map[string]string{"verify_status": strconv.Itoa(int(v.Status))}
}
if len(in.Time) > utils.NumberZero {
w.Other["create_time > ?"] = in.Time[utils.NumberZero]
w.Other["create_time < ?"] = in.Time[utils.NumberOne]
}
items, err := model.OrderModel{}.Init().Page(w, &info)
if err != nil {
l.Logger.Error(err)
return l.fail(utils.ErrorNotFund)
}
var productItems []dao.OrderProducts
err = model.OrderProductModel{}.Init().Items(w, &productItems)
if err != nil {
utils.Logger.Error("product err:", err)
return l.fail(utils.ErrorNotFund)
}
productMap := lo.GroupBy(productItems, func(item dao.OrderProducts) string {
return item.OrderSn
})
for key, v := range info {
mobile, aErr := utils.DecryptPhone(v.Mobile)
if aErr == nil {
if _, ok := productMap[v.OrderSn]; ok {
info[key].ProductItems = productMap[v.OrderSn]
}
info[key].AesMobile = v.Mobile
info[key].Mobile = utils.DecryptPhoneReplace(mobile)
}
}
items.Items = info
return l.ok(items)
} }
+4 -2
View File
@@ -3,8 +3,10 @@ package validator
import "lone-services/pkg/validate" import "lone-services/pkg/validate"
type AdminOrderAuditingItemsValidator struct { type AdminOrderAuditingItemsValidator struct {
Page int32 Page int32
Size int32 Size int32
Time []string
Status int32
} }
// GetMessage 查看列表 - 提示消息 // GetMessage 查看列表 - 提示消息