作者 yangfu

Merge branch 'dev' into test

... ... @@ -32,6 +32,7 @@ func (l *ArticleCategoryUpdateLogic) ArticleCategoryUpdate(req *types.ArticleCat
var (
conn = l.svcCtx.DefaultDBConn()
dm *domain.ArticleCategory
dupDm *domain.ArticleCategory
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
)
if dm, err = l.svcCtx.ArticleCategoryRepository.FindOne(l.ctx, conn, req.Id); err != nil {
... ... @@ -39,8 +40,8 @@ func (l *ArticleCategoryUpdateLogic) ArticleCategoryUpdate(req *types.ArticleCat
}
// 不可编辑判断
if dm.Name != req.ArticleCategory.Name {
if dm, err = l.svcCtx.ArticleCategoryRepository.FindOneByName(l.ctx, conn, userToken.CompanyId, req.ArticleCategory.Name); err == nil && dm != nil {
return nil, xerr.NewErrMsg(fmt.Sprintf("已存在分类`%s`", dm.Name))
if dupDm, err = l.svcCtx.ArticleCategoryRepository.FindOneByName(l.ctx, conn, userToken.CompanyId, req.ArticleCategory.Name); err == nil && dupDm != nil {
return nil, xerr.NewErrMsg(fmt.Sprintf("已存在分类`%s`", dupDm.Name))
}
}
// 赋值
... ...