factroy store
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"lone-services/pkg/modelbase"
|
||||
"lone-services/pkg/utils"
|
||||
"lone-services/services/order/internal/dao"
|
||||
"lone-services/services/order/internal/model"
|
||||
"strconv"
|
||||
|
||||
"lone-services/rpc/order/pb"
|
||||
"lone-services/services/order/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type UpdateAddressSaleInfoLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUpdateAddressSaleInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateAddressSaleInfoLogic {
|
||||
return &UpdateAddressSaleInfoLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateAddressSaleInfoLogic) UpdateAddressSaleInfo(in *order.UpdateAddressSaleInfoRequest) (*order.UpdateAddressSaleInfoResponse, error) {
|
||||
data := dao.AddressSaleInfo{
|
||||
GroupId: in.GroupId,
|
||||
SaleId: in.SaleId,
|
||||
}
|
||||
|
||||
w := modelbase.Params{Eq: map[string]string{
|
||||
"target_id": strconv.FormatInt(in.Id, utils.NumberTen),
|
||||
"type": strconv.Itoa(dao.AddressTypeStore),
|
||||
}}
|
||||
|
||||
row, err := model.AddressModel{}.Init().Edit(w, &data)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
return &order.UpdateAddressSaleInfoResponse{Num: int32(row)}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user