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,
}
}
+59
View File
@@ -0,0 +1,59 @@
[base]
login_out_time=43200 #api接口超时时间分
login_refresh_out_time=83200
name = "sale-service"
listenOn = "0.0.0.0:10700"
mode = "dev"
[log]
path = "logs"
serviceName = "sale-service"
mode = "file"
encoding = "plain"
level = "info"
keepDays = 7
maxSize = 50
maxBackups = 5
compress = false
[oss]
accessKeyId = "LTAI5t7U8KvxSiPE5auwQUuu"
accessKeySecret = "xjfgbQQRpL4TcIspNuClg6bYADa3pk"
roleArn = "acs:ram::1663896742753915:role/oss-upload"
roleSessionName = "oss-upload"
region = "oss-cn-hangzhou"
bucketName = "lone-images"
endpoint = "https://oss-accelerate.aliyuncs.com"
host = "https://images.ailuowan.com"
dir = "upload/"
expireSeconds = 3600
[mysql]
host = '39.106.171.204'
port = 33066
user = 'root'
password = 'MOLXRZNOU4Y4'
database = 'dms-sale'
charset = 'utf8mb4'
prefix = ''
debug = true
[mysql_read]
host = '39.106.171.204'
port = 33066
user = 'root'
password = 'MOLXRZNOU4Y4'
database = 'dms-sale'
charset = 'utf8mb4'
prefix = ''
[redis]
host = '39.106.171.204'
password = 'lLMLcuPpzSj'
port = 6379
db = 0
[encrypt]
data_key = "u2t9T3luZtoRfhBstkFN6TiIMW38BA8a"
[services]
chore = "chore-service"
user = "user-service"
wecom = "wecom-service"