73 lines
2.5 KiB
Go
73 lines
2.5 KiB
Go
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)
|
|
}
|
|
|
|
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)
|
|
}
|