refactor: reorganize modules and add Linux build tooling
This commit is contained in:
34
module/ec/address/internal/logic/library/delete.go
Normal file
34
module/ec/address/internal/logic/library/delete.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package library
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"bsm/full/module/ec/address/internal/models"
|
||||
pb "bsm/full/module/ec/address/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/printer"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
)
|
||||
|
||||
// 删除一个地址
|
||||
func Delete(ctx context.Context, in *pb.AddressDeleteRequest) (reply *pb.StatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = models.DBService.Delete(&models.AddressLibrary{}, "id in ?", in.Id).Error
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixNano(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user