54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
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)
|
|
isAutoResponsed, 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
|
|
}
|
|
|
|
data := &contact_customer_serviceproto.ApiCreateData{
|
|
IsAutoResponsed: isAutoResponsed,
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
}
|
|
|
|
func ApiGetContactCustomerServiceListBySessionId(ctx *gin.Context) {
|
|
req := ctx.MustGet("client_req").(*contact_customer_serviceproto.ApiListBySessionIdReq)
|
|
|
|
//设置默认页长
|
|
if req.Limit == 0 {
|
|
req.Limit = consts.DefaultPageSize
|
|
}
|
|
|
|
list, ec := service.DefaultService.ApiGetContactCustomerServiceListBySessionId(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.ApiListBySessionIdData{
|
|
List: list,
|
|
Offset: req.Offset + len(list),
|
|
}
|
|
if len(list) >= req.Limit {
|
|
data.More = 1
|
|
}
|
|
ReplyOk(ctx, data)
|
|
}
|