39 lines
906 B
Go
Raw Permalink Normal View History

package supplier
import (
"context"
"muyu-apiserver/gateway/internal/svc"
"muyu-apiserver/gateway/internal/types"
"muyu-apiserver/pkg/ctxdata"
"muyu-apiserver/rpc/purchase/purchaseservice"
"github.com/zeromicro/go-zero/core/logx"
)
type UpdateSupplierLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUpdateSupplierLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateSupplierLogic {
return &UpdateSupplierLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *UpdateSupplierLogic) UpdateSupplier(req *types.UpdateSupplierReq) error {
id := ctxdata.GetPathId(l.ctx)
_, err := l.svcCtx.PurchaseRpc.UpdateSupplier(l.ctx, &purchaseservice.UpdateSupplierReq{
SupplierId: id,
SupplierName: req.SupplierName,
Phone: req.Phone,
Status: req.Status,
Remark: req.Remark,
})
return err
}