package controller import ( "service/api/consts" "service/api/errcode" contact_customer_serviceproto "service/api/proto/contact_customer_service/proto" "service/app/mix/service" "service/bizcommon/util" "service/library/logger" "github.com/gin-gonic/gin" ) func OpCreateContactCustomerService(ctx *gin.Context) { req := ctx.MustGet("client_req").(*contact_customer_serviceproto.OpCreateReq) ec := service.DefaultService.OpCreateContactCustomerService(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) } func OpUpdateContactCustomerServiceByIds(ctx *gin.Context) { req := ctx.MustGet("client_req").(*contact_customer_serviceproto.OpUpdateByIdsReq) ec := service.DefaultService.OpUpdateContactCustomerServiceByIds(ctx, req) if ec != errcode.ErrCodeContactCustomerServiceSrvOk { logger.Error("OpUpdateContactCustomerService fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return } ReplyOk(ctx, nil) } func OpGetContactCustomerServiceListBySessionId(ctx *gin.Context) { req := ctx.MustGet("client_req").(*contact_customer_serviceproto.OpListBySessionIdReq) //设置默认页长 if req.Limit == 0 { req.Limit = consts.DefaultPageSize } list, ec := service.DefaultService.OpGetContactCustomerServiceListBySessionId(ctx, req) if ec != errcode.ErrCodeContactCustomerServiceSrvOk { logger.Error("OpGetContactCustomerServiceListBySessionId fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return } data := &contact_customer_serviceproto.OpListBySessionIdData{ List: list, Offset: req.Offset + len(list), } if len(list) >= req.Limit { data.More = 1 } ReplyOk(ctx, data) } func OpGetContactCustomerServiceListUnreadGroupByMid(ctx *gin.Context) { req := ctx.MustGet("client_req").(*contact_customer_serviceproto.OpListUnreadReq) list, ec := service.DefaultService.OpGetContactCustomerServiceListUnreadGroupByMid(ctx, req) if ec != errcode.ErrCodeContactCustomerServiceSrvOk { logger.Error("OpGetContactCustomerServiceList fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return } data := &contact_customer_serviceproto.OpListUnreadData{ List: list, } ReplyOk(ctx, data) }