41 lines
1.5 KiB
Go
41 lines
1.5 KiB
Go
package sys
|
|
|
|
import (
|
|
"context"
|
|
|
|
"hotgo/api/admin/customerservice"
|
|
"hotgo/internal/model/entity"
|
|
"hotgo/internal/service"
|
|
)
|
|
|
|
var CustomerService = cCustomerService{}
|
|
|
|
type cCustomerService struct{}
|
|
|
|
func (c *cCustomerService) List(ctx context.Context, req *customerservice.ListReq) (res *customerservice.ListRes, err error) {
|
|
list, total, err := service.SysCustomerService().List(ctx, &req.CustomerServiceListInp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if list == nil {
|
|
list = []*entity.CustomerService{}
|
|
}
|
|
res = new(customerservice.ListRes)
|
|
res.List = list
|
|
res.PageRes.Pack(req, total)
|
|
return
|
|
}
|
|
func (c *cCustomerService) View(ctx context.Context, req *customerservice.ViewReq) (*customerservice.ViewRes, error) {
|
|
v, err := service.SysCustomerService().View(ctx, &req.CustomerServiceViewInp)
|
|
return &customerservice.ViewRes{CustomerService: v}, err
|
|
}
|
|
func (c *cCustomerService) Edit(ctx context.Context, req *customerservice.EditReq) (*customerservice.EditRes, error) {
|
|
return &customerservice.EditRes{}, service.SysCustomerService().Edit(ctx, &req.CustomerServiceEditInp)
|
|
}
|
|
func (c *cCustomerService) Status(ctx context.Context, req *customerservice.StatusReq) (*customerservice.StatusRes, error) {
|
|
return &customerservice.StatusRes{}, service.SysCustomerService().Status(ctx, &req.CustomerServiceStatusInp)
|
|
}
|
|
func (c *cCustomerService) Delete(ctx context.Context, req *customerservice.DeleteReq) (*customerservice.DeleteRes, error) {
|
|
return &customerservice.DeleteRes{}, service.SysCustomerService().Delete(ctx, &req.CustomerServiceDeleteInp)
|
|
}
|