by Robin at 20240730; add delay

This commit is contained in:
Leufolium 2024-07-30 12:15:01 +08:00
parent ae595246be
commit c6e1a41288
2 changed files with 15 additions and 13 deletions

View File

@ -3,5 +3,6 @@ package apollostruct
type AutoResponseCfg struct { type AutoResponseCfg struct {
StartTime string `json:"start_time"` StartTime string `json:"start_time"`
EndTime string `json:"end_time"` EndTime string `json:"end_time"`
Delay int64 `json:"delay"`
Message string `json:"message"` Message string `json:"message"`
} }

View File

@ -2022,19 +2022,20 @@ func (s *Service) ApiCreateContactCustomerService(ctx *gin.Context, req *contact
return return
} }
if createTimes.CreateTimes == 0 { if createTimes.CreateTimes == 0 {
err := _DefaultContactCustomerService.OpCreate(ctx, &contact_customer_service_proto.OpCreateReq{ go func() {
ContactCustomerService: &dbstruct.ContactCustomerService{ time.Sleep(time.Duration(cfg.Delay) * time.Second)
SessionId: req.ContactCustomerService.SessionId, err := _DefaultContactCustomerService.OpCreate(ctx, &contact_customer_service_proto.OpCreateReq{
Predicate: goproto.Int64(consts.ContactCustomerService_FromSupportor), ContactCustomerService: &dbstruct.ContactCustomerService{
Message: goproto.String(cfg.Message), SessionId: req.ContactCustomerService.SessionId,
IsRead: goproto.Int64(consts.ContactCustomerService_NotRead), Predicate: goproto.Int64(consts.ContactCustomerService_FromSupportor),
}, Message: goproto.String(cfg.Message),
}) IsRead: goproto.Int64(consts.ContactCustomerService_NotRead),
if err != nil { },
logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err) })
ec = errcode.ErrCodeContactCustomerServiceSrvFail if err != nil {
return logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err)
} }
}()
isAutoResponsed = consts.ContactCustomerService_AutoResponsed isAutoResponsed = consts.ContactCustomerService_AutoResponsed
} }
} }