This commit is contained in:
2026-09-24 08:34:32 +08:00
parent 9b876701c3
commit e5fff985cf
15 changed files with 616 additions and 55 deletions
@@ -5,6 +5,7 @@ import (
"lone-services/pkg/modelbase"
"lone-services/pkg/utils"
"lone-services/pkg/validate"
"lone-services/pkg/wecomrpc"
"lone-services/services/sale/internal/dao"
"lone-services/services/sale/internal/model"
"lone-services/services/sale/validator"
@@ -159,6 +160,14 @@ func (l *ApiSaleAddLogic) ApiSaleAdd(in *sale.ApiSaleAddReq) (*sale.Response, er
return failResponse(utils.Fail), nil
}
m.Commit()
Time := utils.Now().String()
md5 := utils.MD5Encrypt(strconv.Itoa(int(data.Id)) + data.Name + Time)
wecomrpc.SendMessage(l.ctx, l.svcCtx.WecomSvcName, wecomrpc.SendMessageJob{
BizId: int(data.Id), // 门店ID
BizType: wecomrpc.BizTypeSales,
Type: wecomrpc.ProductSubmitReview,
Key: md5,
})
return okResponse(nil), nil
}
@@ -14,6 +14,7 @@ type ServiceContext struct {
Prefix string
ChoreSvcName string
UserSvcName string
WecomSvcName string
}
func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
@@ -25,6 +26,10 @@ func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
if userSvc == utils.StringEmpty {
logx.Error("config services.user empty")
}
wecomSvc := utils.GetConfigString("services.wecom")
if wecomSvc == utils.StringEmpty {
logx.Error("config services.wecom empty")
}
return &ServiceContext{
Config: c,
@@ -32,5 +37,6 @@ func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
Prefix: utils.GetConfigString("mysql.prefix"),
ChoreSvcName: choreSvc,
UserSvcName: userSvc,
WecomSvcName: wecomSvc,
}
}