diff --git a/services/express/internal/logic/expressJdBackLogic.go b/services/express/internal/logic/expressJdBackLogic.go index a48a28f..9017ee8 100644 --- a/services/express/internal/logic/expressJdBackLogic.go +++ b/services/express/internal/logic/expressJdBackLogic.go @@ -31,19 +31,6 @@ func NewExpressJdBackLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Exp } func (l *ExpressJdBackLogic) ExpressJdBack(in *express.JdRequest) (*express.SfResponse, error) { - //TODO 透传数据还是获取? - l.Logger.Error(in) - //routers.POST("/transit/jd", obj.JdBack) - //appKey := c.Query("app_key") - //timestamp := c.Query("timestamp") - //sign := c.Query("sign") - //path := c.Query("path") - // - //l.Logger.Info("JD back params : app_key=", appKey, - // " timestamp=", timestamp, " sign=", sign, " path=", path) - - //JD back params : app_key=e99f6232b45c4c3e871780f5a9b1a555 timestamp=Tue, 26 May 2026 01:41:06 GMT sign=2640A486A4A529AAD722FED2E5C7E0BB path= - //JD back data:{"carrierId":2087,"customerOrderNo":"JD2026052609395822530404255","extend":{"curSiteName":"张家口涿鹿汽车点部项目小站","curSiteId":"1929145","siteTelephone":"15732381119","siteId":"4989","remark":"【实时调度-路区排班】揽收任务已分配给李晓龙,配送员电话13833376743","operatorPhone":"13833376743","curJDCode":"34512","requireTime":"2026-05-27 22:00:00"},"nextLocation":{},"operateLocation":{"lat":"40.459022","lon":"115.276425","routeAddress":" 河北省张家口市下花园区S342(张家口农商银行苏家坊信用社南)","routeCityName":"张家口市","routeDistrictName":"涿鹿县","routeProvinceName":"河北","routeStreetName":"涿鹿镇"},"operateSite":"张家口涿鹿汽车点部项目小站","operateSiteId":"1929145","operationCode":"200034","operationTime":"2026-05-26 09:40:11","operationType":"2013","operatorName":"李晓龙","orderNo":"JD2026052609395822530404255","remark":"您的快件将由快递员李晓龙上门取件,快递员电话:13833376743,营业部电话:15732381119","waybillNo":"JDVA44161571823"} body := utils.GetBody(l.ctx) ret := express.SfResponse{ ReturnCode: "1001", diff --git a/services/message/internal/logic/apiMessageLogic.go b/services/message/internal/logic/apiMessageLogic.go index 515921a..4796e78 100644 --- a/services/message/internal/logic/apiMessageLogic.go +++ b/services/message/internal/logic/apiMessageLogic.go @@ -48,7 +48,7 @@ func (l *ApiMessageLogic) ApiMessage(in *message.ItemsRequest) (*message.Respons items, err := model.MessageModel{}.Init().Page(w, &info) if err != nil { - l.Logger.Error(err) + l.Logger.Error("get message list failed", err) return l.fail(utils.Fail) } var ids []string diff --git a/services/store/internal/logic/verifyStatusLogic.go b/services/store/internal/logic/verifyStatusLogic.go index 37b426b..9ed5a79 100644 --- a/services/store/internal/logic/verifyStatusLogic.go +++ b/services/store/internal/logic/verifyStatusLogic.go @@ -7,6 +7,7 @@ import ( "lone-services/pkg/utils" "lone-services/pkg/validate" chore "lone-services/rpc/chore/pb" + message "lone-services/rpc/message/pb" user "lone-services/rpc/user/pb" "lone-services/services/store/internal/dao" "lone-services/services/store/internal/model" @@ -122,12 +123,8 @@ func (l *VerifyStatusLogic) VerifyStatus(in *store.StatusRequest) (*store.Respon //} } - //TODO 站内消息 - //mErr := MessageService{}.Add(dao.TargetTypeAgent, dao.ObjTypeStore, status, info.SaleId, info.Id, content) - //if mErr != nil { - // model.Rollback() - // return mErr - //} + l.message(utils.NumberOne, utils.NumberTwo, int32(status), info.SaleId, info.Id, content) + modelObj.Commit() return l.ok(utils.NumberOne) @@ -184,3 +181,33 @@ func (l *VerifyStatusLogic) sendPassword(mobile, password string) utils.Status { return utils.Ok } + +func (l *VerifyStatusLogic) message(targetType, Type, typeStatus int32, targetId, objId int64, content string) { + //TargetTypeAgent uint8 = 1 //代理 + //TargetTypeStore uint8 = 2 //门店 + //TargetTypeUser uint8 = 3 //个人 + //// 类型 + //ObjTypeAgent uint8 = 1 //添加代理 + //ObjTypeStore uint8 = 2 //加门店 + //ObjTypeSupply uint8 = 3 //审核补货 + cli, err := svc.GetRpcClient(l.svcCtx.MessageName) + if err != nil { + logx.Errorf("get user err: %v", err) + return + } + + client := message.NewMessageClient(cli.Conn()) + + _, err = client.MessageAdd(context.Background(), &message.AddRequest{ + Content: content, + TargetType: targetType, + TargetId: targetId, + TypeStatus: typeStatus, + Type: Type, + ObjId: objId, + }) + if err != nil { + logx.Errorf("get order err: %v", err) + return + } +} diff --git a/services/store/internal/svc/servicecontext.go b/services/store/internal/svc/servicecontext.go index b8de272..bd99f2b 100644 --- a/services/store/internal/svc/servicecontext.go +++ b/services/store/internal/svc/servicecontext.go @@ -72,13 +72,14 @@ func GetRpcClient(serviceName string) (zrpc.Client, error) { } type ServiceContext struct { - Config config.Config - DB *gorm.DB - Prefix string - SaleName string - OrderName string - UserName string - ChoreName string + Config config.Config + DB *gorm.DB + Prefix string + SaleName string + OrderName string + UserName string + ChoreName string + MessageName string } func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext { @@ -102,7 +103,10 @@ func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext { if ChoreSvc == utils.StringEmpty { logx.Error("config services.chore empty") } - + MessageSvc := utils.GetConfigString("services.message") + if MessageSvc == utils.StringEmpty { + logx.Error("config services.message empty") + } svcCtx := &ServiceContext{ Config: c, DB: db,