Skip to content

Commit

Permalink
Merge pull request #267 from ArtisanCloud/dev/michaelhu
Browse files Browse the repository at this point in the history
feat(product): add disable product status with api
  • Loading branch information
Matrix-X committed Oct 11, 2023
2 parents 9b85ace + 6913e85 commit 615c250
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.iml
.DS_Store

logs
*.log
.logs/
.var
Expand Down
8 changes: 3 additions & 5 deletions internal/logic/admin/crm/product/disableproductlogic.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package product

import (
product2 "PowerX/internal/model/crm/product"
fmt "PowerX/pkg/printx"
"context"

"PowerX/internal/svc"
Expand All @@ -26,10 +24,10 @@ func NewDisableProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Di
}

func (l *DisableProductLogic) DisableProduct(req *types.DisableProductRequest) (resp *types.DisableProductReply, err error) {
p := &product2.Product{
IsActivated: false,
p := &map[string]interface{}{
"is_activated": false,
}
fmt.Dump(p)
//fmt.Dump(p)
l.svcCtx.PowerX.Product.PatchProduct(l.ctx, req.ProductId, p)

return &types.DisableProductReply{
Expand Down
7 changes: 3 additions & 4 deletions internal/uc/powerx/crm/product/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"PowerX/internal/model/powermodel"
"PowerX/internal/types"
"PowerX/internal/types/errorx"
fmt "PowerX/pkg/printx"
"PowerX/pkg/slicex"
"context"
"encoding/json"
Expand Down Expand Up @@ -185,9 +184,9 @@ func (uc *ProductUseCase) UpsertProducts(ctx context.Context, products []*model.
return products, err
}

func (uc *ProductUseCase) PatchProduct(ctx context.Context, id int64, product *model.Product) {
fmt.Dump(product)
if err := uc.db.WithContext(ctx).Model(&model.Product{}).
func (uc *ProductUseCase) PatchProduct(ctx context.Context, id int64, product interface{}) {
if err := uc.db.WithContext(ctx).
Model(&model.Product{}).
Where(id).
Debug().
Updates(product).
Expand Down

0 comments on commit 615c250

Please sign in to comment.