Merge pull request 'by Robin at 20240912' (#735) from feat-IRONFANS-212-Robin into test
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/735
This commit is contained in:
commit
7b807a421c
|
@ -40,3 +40,18 @@ func ApiGetContactCustomerServiceSessionListByMid(ctx *gin.Context) {
|
|||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
||||
func ApiGetUnreadContactCustomerServiceCountByMid(ctx *gin.Context) {
|
||||
req := ctx.MustGet("client_req").(*contact_customer_service_sessionproto.ApiCountUnreadByMidReq)
|
||||
unreadCount, ec := service.DefaultService.ApiGetUnreadContactCustomerServiceCountByMid(ctx, req)
|
||||
if ec != errcode.ErrCodeContactCustomerServiceSessionSrvOk {
|
||||
logger.Error("ApiGetUnreadContactCustomerServiceCountByMid fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
}
|
||||
|
||||
data := &contact_customer_service_sessionproto.ApiCountUnreadByMidData{
|
||||
UnreadCount: unreadCount,
|
||||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
|
|
@ -70,3 +70,18 @@ func OpGetContactCustomerServiceSessionList(ctx *gin.Context) {
|
|||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
||||
func OpGetUnreadContactCustomerServiceCountByMid(ctx *gin.Context) {
|
||||
req := ctx.MustGet("client_req").(*contact_customer_service_sessionproto.OpCountUnreadByMidReq)
|
||||
unreadCount, ec := service.DefaultService.OpGetUnreadContactCustomerServiceCountByMid(ctx, req)
|
||||
if ec != errcode.ErrCodeContactCustomerServiceSessionSrvOk {
|
||||
logger.Error("OpGetUnreadContactCustomerServiceCountByMid fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
}
|
||||
|
||||
data := &contact_customer_service_sessionproto.OpCountUnreadByMidData{
|
||||
UnreadCount: unreadCount,
|
||||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
|
|
@ -207,6 +207,7 @@ func Init(r *gin.Engine) {
|
|||
apiContactCustomerServiceSessionGroup := r.Group("/api/contact_customer_service_session", PrepareToC())
|
||||
apiContactCustomerServiceSessionGroup.POST("create", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateContactCustomerServiceSession)
|
||||
apiContactCustomerServiceSessionGroup.POST("list_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetContactCustomerServiceSessionListByMid)
|
||||
apiContactCustomerServiceSessionGroup.POST("get_unread_count_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.ApiCountUnreadByMidReq{}), middleware.JwtAuthenticator(), ApiGetUnreadContactCustomerServiceCountByMid)
|
||||
|
||||
// 应用配置表
|
||||
apiAppConfigGroup := r.Group("/api/app_config", PrepareToC())
|
||||
|
@ -507,6 +508,7 @@ func Init(r *gin.Engine) {
|
|||
opContactCustomerServiceSessionGroup.POST("create", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateContactCustomerServiceSession)
|
||||
opContactCustomerServiceSessionGroup.POST("list_by_mid", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpListByMidReq{}), middleware.JwtAuthenticator(), OpGetContactCustomerServiceSessionListByMid)
|
||||
opContactCustomerServiceSessionGroup.POST("list", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetContactCustomerServiceSessionList)
|
||||
opContactCustomerServiceSessionGroup.POST("get_unread_count", middleware.JSONParamValidator(contact_customer_service_sessionproto.OpCountUnreadByMidReq{}), middleware.JwtAuthenticator(), OpGetUnreadContactCustomerServiceCountByMid)
|
||||
|
||||
// 图片审核任务
|
||||
opImageAuditTaskGroup := r.Group("/op/image_audit_task", PrepareOp())
|
||||
|
|
|
@ -2090,7 +2090,7 @@ func (s *Service) ApiCreateContactCustomerService(ctx *gin.Context, req *contact
|
|||
ec = errcode.ErrCodeContactCustomerServiceCountRedisCacheInvalid
|
||||
return
|
||||
}
|
||||
_, err = redis.GetRedisClient().Incr(consts.RedisContactCustomerServicePrefix + "sup_total_unread_count")
|
||||
_, err = redis.GetRedisClient().Incr(consts.RedisContactCustomerServicePrefix + "from_sup_total_unread_count")
|
||||
if err != nil {
|
||||
logger.Error("Redis Incr fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeContactCustomerServiceCountRedisCacheInvalid
|
||||
|
@ -2254,6 +2254,15 @@ func (s *Service) ApiGetContactCustomerServiceSessionListByMid(ctx *gin.Context,
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Service) ApiGetUnreadContactCustomerServiceCountByMid(ctx *gin.Context, req *contact_customer_service_sessionproto.ApiCountUnreadByMidReq) (unreadCount int64, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeContactCustomerServiceSessionSrvOk
|
||||
|
||||
key := logic.GetCreateContactCustomerServiceCountIdForRedis(util.DerefInt64(req.SessionId), consts.ContactCustomerService_FromSupportor)
|
||||
unreadCount, _ = redis.GetRedisClient().GetInt64(key)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Moment
|
||||
func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateReq) (ec errcode.ErrCode, acctPunEndTime string) {
|
||||
ec = errcode.ErrCodeMomentSrvOk
|
||||
|
|
|
@ -3160,7 +3160,7 @@ func (s *Service) OpUpdateContactCustomerServiceByIds(ctx *gin.Context, req *con
|
|||
}
|
||||
}
|
||||
// 去掉总量
|
||||
_, err = redis.GetRedisClient().DecrBy(consts.RedisContactCustomerServicePrefix+"sup_total_unread_count", int64(len(req.Ids)))
|
||||
_, err = redis.GetRedisClient().DecrBy(consts.RedisContactCustomerServicePrefix+"from_sup_total_unread_count", int64(len(req.Ids)))
|
||||
if err != nil {
|
||||
logger.Error("Redis DecrBy fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeContactCustomerServiceCountRedisCacheInvalid
|
||||
|
@ -3673,6 +3673,19 @@ func (s *Service) OpGetContactCustomerServiceSessionList(ctx *gin.Context, req *
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Service) OpGetUnreadContactCustomerServiceCountByMid(ctx *gin.Context, req *contact_customer_service_sessionproto.OpCountUnreadByMidReq) (unreadCount int64, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeContactCustomerServiceSessionSrvOk
|
||||
|
||||
if req.SessionId != nil {
|
||||
key := logic.GetCreateContactCustomerServiceCountIdForRedis(util.DerefInt64(req.SessionId), consts.ContactCustomerService_FromUser)
|
||||
unreadCount, _ = redis.GetRedisClient().GetInt64(key)
|
||||
} else {
|
||||
unreadCount, _ = redis.GetRedisClient().GetInt64(consts.RedisContactCustomerServicePrefix + "from_sup_total_unread_count")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DailyStatement
|
||||
func (s *Service) OpGetDailyStatementList(ctx *gin.Context, req *daily_statementproto.OpListReq) (list []*dbstruct.DailyStatement, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeDailyStatementSrvOk
|
||||
|
|
Loading…
Reference in New Issue