service/app/mix/controller/contact_customer_service_se...

73 lines
2.5 KiB
Go
Raw Permalink Normal View History

2023-12-23 22:03:53 +08:00
package controller
import (
"service/api/errcode"
contact_customer_service_sessionproto "service/api/proto/contact_customer_service_session/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"github.com/gin-gonic/gin"
)
func OpCreateContactCustomerServiceSession(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*contact_customer_service_sessionproto.OpCreateReq)
ec := service.DefaultService.OpCreateContactCustomerServiceSession(ctx, req)
if ec != errcode.ErrCodeContactCustomerServiceSessionSrvOk {
logger.Error("OpCreateContactCustomerServiceSession fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrorMsg(ctx, "server error")
return
}
data := &contact_customer_service_sessionproto.OpCreateData{
SessionId: util.DerefInt64(req.Id),
}
ReplyOk(ctx, data)
}
func OpGetContactCustomerServiceSessionListByMid(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*contact_customer_service_sessionproto.OpListByMidReq)
session, ec := service.DefaultService.OpGetContactCustomerServiceSessionListByMid(ctx, req)
if ec != errcode.ErrCodeContactCustomerServiceSessionSrvOk {
logger.Error("OpGetContactCustomerServiceSessionListByMid fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &contact_customer_service_sessionproto.OpListByMidData{
Session: session,
}
ReplyOk(ctx, data)
}
func OpGetContactCustomerServiceSessionListBySessionId(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*contact_customer_service_sessionproto.OpListBySessionIdReq)
session, ec := service.DefaultService.OpGetContactCustomerServiceSessionListBySessionId(ctx, req)
if ec != errcode.ErrCodeContactCustomerServiceSessionSrvOk {
logger.Error("OpGetContactCustomerServiceSessionListBySessionId fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &contact_customer_service_sessionproto.OpListBySessionIdData{
Session: session,
}
ReplyOk(ctx, data)
}
2023-12-23 22:03:53 +08:00
func OpGetContactCustomerServiceSessionList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*contact_customer_service_sessionproto.OpListReq)
list, ec := service.DefaultService.OpGetContactCustomerServiceSessionList(ctx, req)
if ec != errcode.ErrCodeContactCustomerServiceSessionSrvOk {
logger.Error("OpGetContactCustomerServiceSessionList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &contact_customer_service_sessionproto.OpListData{
List: list,
}
ReplyOk(ctx, data)
}