From ae595246beccbbd799fe6cc7133fc89c71f7f807 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 26 Jul 2024 12:58:48 +0800 Subject: [PATCH] by Robin at 20240726 --- api/consts/status.go | 6 ++++++ .../proto/contact_customer_service_api.go | 1 + app/mix/controller/contact_customer_service_api.go | 8 ++++++-- app/mix/service/apiservice.go | 8 ++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/api/consts/status.go b/api/consts/status.go index 77423235..4ce638fd 100644 --- a/api/consts/status.go +++ b/api/consts/status.go @@ -36,6 +36,12 @@ const ( ContactCustomerService_Read = 1 //已读 ) +// 联系客服表是否自动回复 +const ( + ContactCustomerService_NotAutoResponsed = 0 //未读 + ContactCustomerService_AutoResponsed = 1 //未读 +) + // 图像审核表状态 const ( ImageAudit_Created = 0 //已创建 diff --git a/api/proto/contact_customer_service/proto/contact_customer_service_api.go b/api/proto/contact_customer_service/proto/contact_customer_service_api.go index 7ecf9fe8..3a4d48be 100644 --- a/api/proto/contact_customer_service/proto/contact_customer_service_api.go +++ b/api/proto/contact_customer_service/proto/contact_customer_service_api.go @@ -12,6 +12,7 @@ type ApiCreateReq struct { } type ApiCreateData struct { + IsAutoResponsed int64 `json:"is_auto_responsed"` } type ApiCreateResp struct { diff --git a/app/mix/controller/contact_customer_service_api.go b/app/mix/controller/contact_customer_service_api.go index 972f00ed..3eadc6c6 100644 --- a/app/mix/controller/contact_customer_service_api.go +++ b/app/mix/controller/contact_customer_service_api.go @@ -13,14 +13,18 @@ import ( func ApiCreateContactCustomerService(ctx *gin.Context) { req := ctx.MustGet("client_req").(*contact_customer_serviceproto.ApiCreateReq) - ec := service.DefaultService.ApiCreateContactCustomerService(ctx, req) + isAutoResponsed, ec := service.DefaultService.ApiCreateContactCustomerService(ctx, req) if ec != errcode.ErrCodeContactCustomerServiceSrvOk { logger.Error("OpCreateContactCustomerService fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrorMsg(ctx, "server error") return } - ReplyOk(ctx, nil) + data := &contact_customer_serviceproto.ApiCreateData{ + IsAutoResponsed: isAutoResponsed, + } + + ReplyOk(ctx, data) } func ApiGetContactCustomerServiceListBySessionId(ctx *gin.Context) { diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 1268adea..6f15069e 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -1975,8 +1975,10 @@ func (s *Service) ApiGetRealNameAuthenticationListByMid(ctx *gin.Context, req *r } // ContactCustomerService -func (s *Service) ApiCreateContactCustomerService(ctx *gin.Context, req *contact_customer_service_proto.ApiCreateReq) (ec errcode.ErrCode) { +func (s *Service) ApiCreateContactCustomerService(ctx *gin.Context, req *contact_customer_service_proto.ApiCreateReq) (isAutoResponsed int64, ec errcode.ErrCode) { ec = errcode.ErrCodeContactCustomerServiceSrvOk + isAutoResponsed = consts.ContactCustomerService_NotAutoResponsed + err := _DefaultContactCustomerService.OpCreate(ctx, &contact_customer_service_proto.OpCreateReq{ ContactCustomerService: req.ContactCustomerService, }) @@ -2003,7 +2005,8 @@ func (s *Service) ApiCreateContactCustomerService(ctx *gin.Context, req *contact err = apollo.GetJson(consts.AutoResponseKey, &cfg, apollo.ApolloOpts().SetNamespace("application")) if err != nil { logger.Error("Apollo read failed : %v", err) - return errcode.ErrCodeApolloReadFail + ec = errcode.ErrCodeApolloReadFail + return } //如果在自动回复时间段,则创建一条自动回复信息 @@ -2032,6 +2035,7 @@ func (s *Service) ApiCreateContactCustomerService(ctx *gin.Context, req *contact ec = errcode.ErrCodeContactCustomerServiceSrvFail return } + isAutoResponsed = consts.ContactCustomerService_AutoResponsed } } return