订单下载。jd下单。。
CI / changes (push) Successful in 37s
CI / ad (push) Successful in 29s
CI / admin (push) Successful in 17s
CI / bff (push) Successful in 13s
CI / chore (push) Successful in 15s
CI / equipment (push) Successful in 14s
CI / express (push) Successful in 14s
CI / product (push) Successful in 13s
CI / record (push) Successful in 13s
CI / sale (push) Successful in 13s
CI / task (push) Successful in 13s
CI / user (push) Successful in 14s
CI / wecom (push) Successful in 13s

This commit is contained in:
2026-09-09 17:52:07 +08:00
parent bcb8743eca
commit 38e040af07
51 changed files with 2572 additions and 350 deletions
+23
View File
@@ -3,9 +3,12 @@ package svc
import (
"context"
"fmt"
"lone-services/pkg/modelbase"
"lone-services/pkg/utils"
product "lone-services/rpc/product/pb"
"lone-services/services/order/internal/dao"
"math/rand"
"strconv"
"time"
jsoniter "github.com/json-iterator/go"
@@ -72,3 +75,23 @@ func GetOneData(name string, id int64) (*product.Item, utils.Status) {
return productInfo, utils.Ok
}
func SetGroupWhere(w *modelbase.Params, adminInfo utils.UserInfo, checkProvince bool) {
if w.Eq == nil {
w.Eq = make(map[string]string)
}
if adminInfo.GroupId < utils.NumberOne {
return
}
//如果是公司销售
if adminInfo.Type == dao.TypeSale {
w.Eq["group_id"] = strconv.FormatInt(adminInfo.GroupId, utils.NumberTen)
} else if adminInfo.SaleProvince > utils.NumberZero {
if checkProvince {
w.Eq["sale_province"] = strconv.FormatInt(adminInfo.SaleProvince, utils.NumberTen)
} else {
w.Eq["group_id"] = strconv.FormatInt(adminInfo.GroupId, utils.NumberTen)
}
}
}
@@ -80,6 +80,7 @@ type ServiceContext struct {
ProductSvcName string //服务名
ExpressSvcName string
ChoreSvcName string
SaleName string
}
func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
@@ -87,6 +88,7 @@ func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
productSvc := utils.GetConfigString("services.product")
ExpressSvc := utils.GetConfigString("services.express")
ChoreSvc := utils.GetConfigString("services.chore")
SaleSvc := utils.GetConfigString("services.sale")
if productSvc == utils.StringEmpty {
logx.Error("config services.product empty")
@@ -97,6 +99,9 @@ func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
if ChoreSvc == utils.StringEmpty {
logx.Error("config services.chore empty")
}
if SaleSvc == utils.StringEmpty {
logx.Error("config services.sale empty")
}
svcCtx := &ServiceContext{
Config: c,
@@ -105,6 +110,7 @@ func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
ProductSvcName: productSvc,
ExpressSvcName: ExpressSvc,
ChoreSvcName: ChoreSvc,
SaleName: SaleSvc,
}
return svcCtx