38 lines
867 B
Go
38 lines
867 B
Go
package image
|
|
|
|
import (
|
|
"context"
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
|
|
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type DataSetCheckLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewDataSetCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DataSetCheckLogic {
|
|
return &DataSetCheckLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *DataSetCheckLogic) DataSetCheck(req *types.CheckReq) (resp *types.CheckResp, err error) {
|
|
resp = &types.CheckResp{}
|
|
var dataSets []models.File
|
|
l.svcCtx.DbEngin.Find(&dataSets).Where("md5", req.FileMd5)
|
|
if len(dataSets) != 0 {
|
|
resp.Exist = true
|
|
} else {
|
|
resp.Exist = false
|
|
}
|
|
return resp, nil
|
|
}
|