-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): add category create with transformation
- Loading branch information
Showing
20 changed files
with
203 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
internal/logic/web/infoOrganization/category/createCategoryLogic.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package category | ||
|
||
import ( | ||
customerDomain2 "PowerX/internal/model/crm/customerDomain" | ||
"PowerX/internal/uc/powerx/crm/customerDomain" | ||
"context" | ||
|
||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
|
||
"github.com/zeromicro/go-zero/core/logx" | ||
) | ||
|
||
type CreateCategoryLogic struct { | ||
logx.Logger | ||
ctx context.Context | ||
svcCtx *svc.ServiceContext | ||
} | ||
|
||
func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateCategoryLogic { | ||
return &CreateCategoryLogic{ | ||
Logger: logx.WithContext(ctx), | ||
ctx: ctx, | ||
svcCtx: svcCtx, | ||
} | ||
} | ||
|
||
func (l *CreateCategoryLogic) CreateCategory(req *types.CreateCategoryRequest) (resp *types.CreateCategoryReply, err error) { | ||
vAuthCustomer := l.ctx.Value(customerDomain.AuthCustomerKey) | ||
authCustomer := vAuthCustomer.(*customerDomain2.Customer) | ||
|
||
// Web端创建用户的客户分类 | ||
category := TransformCategoryRequestToCategory(req) | ||
category.CustomerId = authCustomer.Id | ||
res, err := l.svcCtx.PowerX.Category.BaseRepository.Create(l.ctx, category) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &types.CreateCategoryReply{ | ||
Category: TransformCategoryToReplyForWeb(res), | ||
}, nil | ||
} |
30 changes: 0 additions & 30 deletions
30
internal/logic/web/infoOrganization/category/createcategorylogic.go
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.