refactor: reorganize modules and add Linux build tooling
This commit is contained in:
36
module/ec/market/internal/logic/agency/delete.go
Normal file
36
module/ec/market/internal/logic/agency/delete.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package agency
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"bsm/full/module/ec/market/internal/models"
|
||||
pb "bsm/full/module/ec/market/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/printer"
|
||||
)
|
||||
|
||||
// 删除一个代理商
|
||||
func Delete(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
// _, err = service.ParseMetaCtx(ctx, nil)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
|
||||
if in.Id == 0 && in.Identity == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
if err := models.DBService.Where("id = ? or identity = ?", in.GetId(), in.GetIdentity()).Delete(&models.MarketAgency{}).Error; err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
Code: 0,
|
||||
Message: "OK",
|
||||
Identity: in.GetIdentity(),
|
||||
Timeseq: time.Now().UnixMilli(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user