service/app/mix/controller/contact_customer_service_ap...

50 lines
1.4 KiB
Go
Raw Normal View History

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 ApiCreateContactCustomerService(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*contact_customer_serviceproto.ApiCreateReq)
ec := service.DefaultService.ApiCreateContactCustomerService(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)
}
2023-12-23 22:03:53 +08:00
func ApiGetContactCustomerServiceListBySessionId(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*contact_customer_serviceproto.ApiListBySessionIdReq)
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.ApiGetContactCustomerServiceListBySessionId(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.ApiListBySessionIdData{
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)
}