fix
This commit is contained in:
parent
973df7a901
commit
7f4f8dddad
@ -29,7 +29,7 @@ func (c *FsCanteenProductModel) GetAllByCanteenTypeId(ctx context.Context, typeI
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, err
|
return
|
||||||
}
|
}
|
||||||
func (c *FsCanteenProductModel) UpdateById(ctx context.Context, id int64, data *FsCanteenProduct) error {
|
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
|
return c.db.WithContext(ctx).Model(&FsCanteenProduct{}).Where("`id` = ? ", id).Updates(&data).Error
|
||||||
|
@ -108,7 +108,7 @@ func (l *GetCanteenDetailLogic) GetCanteenDetail(req *types.GetCanteenDetailReq,
|
|||||||
if !ok {
|
if !ok {
|
||||||
continue
|
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)
|
list = append(list, data)
|
||||||
}
|
}
|
||||||
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetCanteenDetailRsp{
|
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetCanteenDetailRsp{
|
||||||
|
@ -2,7 +2,6 @@ package logic
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
@ -51,7 +50,6 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
|
|||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product size list")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product size list")
|
||||||
}
|
}
|
||||||
fmt.Println(len(productSizeList))
|
|
||||||
mapProductSize := make(map[int64]gmodel.FsProductSize)
|
mapProductSize := make(map[int64]gmodel.FsProductSize)
|
||||||
for _, v := range productSizeList {
|
for _, v := range productSizeList {
|
||||||
mapProductSize[v.Id] = v
|
mapProductSize[v.Id] = v
|
||||||
@ -83,10 +81,12 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
//新增
|
//新增
|
||||||
|
addStatus := int64(1)
|
||||||
err = canteenProductModel.Create(l.ctx, &gmodel.FsCanteenProduct{
|
err = canteenProductModel.Create(l.ctx, &gmodel.FsCanteenProduct{
|
||||||
SizeId: &v.SizeId,
|
SizeId: &v.SizeId,
|
||||||
Sid: &v.SId,
|
Sid: &v.SId,
|
||||||
Sort: &sort,
|
Sort: &sort,
|
||||||
|
Status: &addStatus,
|
||||||
Ctime: &now,
|
Ctime: &now,
|
||||||
CanteenType: &req.Id,
|
CanteenType: &req.Id,
|
||||||
ProductId: sizeInfo.ProductId,
|
ProductId: sizeInfo.ProductId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user