diff --git a/model/gmodel/fs_order_logic.go b/model/gmodel/fs_order_logic.go index b068a734..f2a7439a 100644 --- a/model/gmodel/fs_order_logic.go +++ b/model/gmodel/fs_order_logic.go @@ -95,12 +95,12 @@ type OrderStatus struct { // 订单商品 type OrderProduct struct { - TotalPrice AmountInfo `json:"amount"` // 商品总价 + TotalPrice AmountInfo `json:"total_price"` // 商品总价 ExpectedDeliveryTime *time.Time `json:"expected_delivery_time"` // 预计到货时间 PurchaseQuantity PurchaseQuantity `json:"purchase_quantity"` // 购买数量 ProductID int64 `json:"product_id"` // 商品ID ProductName string `json:"product_name"` // 商品名称 - ItemPrice AmountInfo `json:"product_price"` // 商品单价 + ItemPrice AmountInfo `json:"item_price"` // 商品单价 ProductSnapshot interface{} `json:"product_snapshot"` // 商品快照 ShoppingCartSnapshot *FsShoppingCartData `json:"shopping_cart_snapshot"` // 购物车快照 ProductCover string `json:"product_cover"` // 商品封面 diff --git a/server/home-user-auth/internal/logic/userlogosetlogic.go b/server/home-user-auth/internal/logic/userlogosetlogic.go index 36d62183..7fc085f4 100644 --- a/server/home-user-auth/internal/logic/userlogosetlogic.go +++ b/server/home-user-auth/internal/logic/userlogosetlogic.go @@ -45,8 +45,31 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth // 如果是,返回未授权的错误码 return resp.SetStatus(basic.CodeUnAuth) } + var nowTime = time.Now().UTC() if req.LogoSelectedId == 0 { - return resp.SetStatus(basic.CodeLogoSetCategory, "logo logo_selected_id not null") + NewFsUserMaterialModel1 := gmodel.NewFsUserMaterialModel(l.svcCtx.MysqlConn) + NewFsUserMaterialModelRow1 := NewFsUserMaterialModel1.RowSelectBuilder(nil).Where("id = ?", 0) + + defaultMaterialInfo, err := NewFsUserMaterialModel1.FindOne(l.ctx, NewFsUserMaterialModelRow1.Model(&gmodel.FsUserMaterial{})) + if err != nil { + logc.Errorf(l.ctx, "defaultMaterialInfo FindOne err:%+v", err) + return resp.SetStatus(basic.CodeLogoSetCategory, "logo not find") + } + var defaultMaterial = gmodel.FsUserMaterial{ + Module: defaultMaterialInfo.Module, + UserId: &userinfo.UserId, + GuestId: &userinfo.GuestId, + ResourceId: defaultMaterialInfo.ResourceId, + ResourceUrl: defaultMaterialInfo.ResourceUrl, + Ctime: &nowTime, + } + MaterialCreateRes := l.svcCtx.MysqlConn.Create(&defaultMaterial) + err = MaterialCreateRes.Error + if err != nil { + logc.Errorf(l.ctx, "defaultMaterialInfo Create err:%+v", err) + return resp.SetStatus(basic.CodeLogoSetCategory, "logo not find") + } + req.LogoSelectedId = defaultMaterial.Id } if req.SetLogoCategory == 1 && req.CategoryId == 0 { return resp.SetStatus(basic.CodeLogoSetCategory, "logo category_id not null") @@ -73,7 +96,6 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth return resp.SetStatus(basic.CodeLogoSetCategory, "logo not find") } - var nowTime = time.Now().UTC() err = l.svcCtx.MysqlConn.WithContext(l.ctx).Transaction(func(tx *gorm.DB) error { var metadataMapOldUserMaterial map[string]interface{} if userMaterialInfo.Metadata != nil {