28 lines
816 B
Go
28 lines
816 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
sysModel "sundynix-micro-go/app/system/model"
|
|
"sundynix-micro-go/app/system/rpc/internal/svc"
|
|
"sundynix-micro-go/app/system/rpc/system"
|
|
)
|
|
|
|
type DeleteClientLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewDeleteClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteClientLogic {
|
|
return &DeleteClientLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
|
|
}
|
|
|
|
func (l *DeleteClientLogic) DeleteClient(in *system.IdsReq) (*system.CommonResp, error) {
|
|
if err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&sysModel.SundynixClient{}).Error; err != nil {
|
|
return nil, fmt.Errorf("删除客户端失败")
|
|
}
|
|
return &system.CommonResp{Code: 200, Msg: "success"}, nil
|
|
}
|