refactor: reorganize modules and add Linux build tooling
This commit is contained in:
40
module/ec/mall/internal/logic/freight/remove.go
Normal file
40
module/ec/mall/internal/logic/freight/remove.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package freight
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"bsm/full/module/ec/mall/internal/impl"
|
||||
"bsm/full/module/ec/mall/internal/models"
|
||||
pb "bsm/full/module/ec/mall/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/printer"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
)
|
||||
|
||||
// FreightRemove 运费模板删除
|
||||
func Remove(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// valildate request id,identity.
|
||||
if in.Id == 0 && in.Identity == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
err = impl.DBService.Where("id=? or identity=?", in.GetId(), in.GetIdentity()).Delete(&models.MallFreight{}).Error
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixMilli(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user