This commit is contained in:
laodaming 2023-06-12 18:06:47 +08:00
parent 973df7a901
commit 7f4f8dddad
3 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ func (c *FsCanteenProductModel) GetAllByCanteenTypeId(ctx context.Context, typeI
if err != nil {
return nil, err
}
return nil, err
return
}
func (c *FsCanteenProductModel) UpdateById(ctx context.Context, id int64, data *FsCanteenProduct) error {
return c.db.WithContext(ctx).Model(&FsCanteenProduct{}).Where("`id` = ? ", id).Updates(&data).Error

View File

@ -108,7 +108,7 @@ func (l *GetCanteenDetailLogic) GetCanteenDetail(req *types.GetCanteenDetailReq,
if !ok {
continue
}
data.Name = fmt.Sprintf("%s-%s-%s", tag.Title, p.Title, size.Title)
data.Name = fmt.Sprintf("%s-%s-%s", *tag.Title, *p.Title, *size.Title)
list = append(list, data)
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetCanteenDetailRsp{

View File

@ -2,7 +2,6 @@ package logic
import (
"context"
"fmt"
"fusenapi/model/gmodel"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
@ -51,7 +50,6 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product size list")
}
fmt.Println(len(productSizeList))
mapProductSize := make(map[int64]gmodel.FsProductSize)
for _, v := range productSizeList {
mapProductSize[v.Id] = v
@ -83,10 +81,12 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
continue
}
//新增
addStatus := int64(1)
err = canteenProductModel.Create(l.ctx, &gmodel.FsCanteenProduct{
SizeId: &v.SizeId,
Sid: &v.SId,
Sort: &sort,
Status: &addStatus,
Ctime: &now,
CanteenType: &req.Id,
ProductId: sizeInfo.ProductId,