|
|
@@ -18,7 +18,7 @@ type DistributorHandler struct{}
|
|
|
func (p *DistributorHandler) GetList(ctx context.Context, req *model.BaseDistributorSearchReq, rsp *comm_def.CommonMsg) error {
|
|
|
distributorServer, err := server.NewDistributorService(ctx)
|
|
|
if err != nil {
|
|
|
- g.Log().Error(err)
|
|
|
+
|
|
|
return err
|
|
|
}
|
|
|
total, list, err := distributorServer.GetList(req)
|
|
|
@@ -31,7 +31,7 @@ func (p *DistributorHandler) GetList(ctx context.Context, req *model.BaseDistrib
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// 创建
|
|
|
+//Create 创建
|
|
|
func (p *DistributorHandler) Create(ctx context.Context, req *model.AddDistributor, rsp *comm_def.CommonMsg) error {
|
|
|
|
|
|
if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
|
|
|
@@ -39,19 +39,19 @@ func (p *DistributorHandler) Create(ctx context.Context, req *model.AddDistribut
|
|
|
}
|
|
|
distributorServer, err := server.NewDistributorService(ctx)
|
|
|
if err != nil {
|
|
|
- g.Log().Error(err)
|
|
|
+
|
|
|
return err
|
|
|
}
|
|
|
distributorServer.Create(req)
|
|
|
_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
|
|
|
if err != nil {
|
|
|
- g.Log().Error(err)
|
|
|
+
|
|
|
return err
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//详情
|
|
|
+//GetEntityById 详情
|
|
|
func (p *DistributorHandler) GetEntityById(ctx context.Context, req *comm_def.IdReq, rsp *comm_def.CommonMsg) error {
|
|
|
|
|
|
if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
|
|
|
@@ -59,22 +59,20 @@ func (p *DistributorHandler) GetEntityById(ctx context.Context, req *comm_def.Id
|
|
|
}
|
|
|
distributorServer, err := server.NewDistributorService(ctx)
|
|
|
if err != nil {
|
|
|
- g.Log().Error(err)
|
|
|
+
|
|
|
return err
|
|
|
}
|
|
|
list, err := distributorServer.GetEntityById(req.Id)
|
|
|
_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
|
|
|
if err != nil {
|
|
|
- g.Log().Error(err)
|
|
|
+
|
|
|
return err
|
|
|
}
|
|
|
rsp.Data = g.Map{"list": list}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//删掉
|
|
|
-
|
|
|
-// 编辑
|
|
|
+//UpdateById 编辑
|
|
|
func (p *DistributorHandler) UpdateById(ctx context.Context, req *model.UpdateDistributorReq, rsp *comm_def.CommonMsg) error {
|
|
|
|
|
|
if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
|
|
|
@@ -82,27 +80,27 @@ func (p *DistributorHandler) UpdateById(ctx context.Context, req *model.UpdateDi
|
|
|
}
|
|
|
distributorServer, err := server.NewDistributorService(ctx)
|
|
|
if err != nil {
|
|
|
- g.Log().Error(err)
|
|
|
+
|
|
|
return err
|
|
|
}
|
|
|
distributorServer.UpdateById(req)
|
|
|
_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
|
|
|
if err != nil {
|
|
|
- g.Log().Error(err)
|
|
|
+
|
|
|
return err
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//删掉
|
|
|
+//DeleteByIds 删掉
|
|
|
func (p *DistributorHandler) DeleteByIds(ctx context.Context, req *model.DeleteDistributorReq, rsp *comm_def.CommonMsg) error {
|
|
|
distributorServer, err := server.NewDistributorService(ctx)
|
|
|
if err != nil {
|
|
|
- g.Log().Error(err)
|
|
|
+
|
|
|
return err
|
|
|
}
|
|
|
err = distributorServer.DeleteByIds(req.Ids)
|
|
|
- g.Log().Info("req", req)
|
|
|
+
|
|
|
_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
|
|
|
if err != nil {
|
|
|
g.Log().Error(err)
|