2023-12-21 22:17:40 +08:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2023-12-23 22:03:53 +08:00
|
|
|
func OpGetContactCustomerServiceListBySessionId(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*contact_customer_serviceproto.OpListBySessionIdReq)
|
2023-12-21 22:17:40 +08:00
|
|
|
|
|
|
|
//设置默认页长
|
|
|
|
if req.Limit == 0 {
|
|
|
|
req.Limit = consts.DefaultPageSize
|
|
|
|
}
|
|
|
|
|
2023-12-23 22:03:53 +08:00
|
|
|
list, ec := service.DefaultService.OpGetContactCustomerServiceListBySessionId(ctx, req)
|
2023-12-21 22:17:40 +08:00
|
|
|
if ec != errcode.ErrCodeContactCustomerServiceSrvOk {
|
2023-12-23 22:03:53 +08:00
|
|
|
logger.Error("OpGetContactCustomerServiceListBySessionId fail, req: %v, ec: %v", util.ToJson(req), ec)
|
2023-12-21 22:17:40 +08:00
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-12-23 22:03:53 +08:00
|
|
|
data := &contact_customer_serviceproto.OpListBySessionIdData{
|
2023-12-21 22:17:40 +08:00
|
|
|
List: list,
|
|
|
|
Offset: req.Offset + len(list),
|
|
|
|
}
|
|
|
|
if len(list) >= req.Limit {
|
|
|
|
data.More = 1
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|
|
|
|
|
|
|
|
func OpGetContactCustomerServiceListUnreadGroupByMid(ctx *gin.Context) {
|
2023-12-23 22:03:53 +08:00
|
|
|
req := ctx.MustGet("client_req").(*contact_customer_serviceproto.OpListUnreadReq)
|
2023-12-21 22:17:40 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-12-23 22:03:53 +08:00
|
|
|
data := &contact_customer_serviceproto.OpListUnreadData{
|
2023-12-21 22:17:40 +08:00
|
|
|
List: list,
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|