31 Star 294 Fork 112

联犀/things

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
userDeviceCollectMultiCreateLogic.go 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
杨磊 提交于 2024-10-10 22:13 . feat: 更新mod
package userdevicelogic
import (
"context"
"gitee.com/unitedrhino/share/ctxs"
"gitee.com/unitedrhino/things/service/dmsvr/internal/repo/relationDB"
"gitee.com/unitedrhino/things/service/dmsvr/internal/svc"
"gitee.com/unitedrhino/things/service/dmsvr/pb/dm"
"github.com/zeromicro/go-zero/core/logx"
)
type UserDeviceCollectMultiCreateLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewUserDeviceCollectMultiCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserDeviceCollectMultiCreateLogic {
return &UserDeviceCollectMultiCreateLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// 用户收藏的设备
func (l *UserDeviceCollectMultiCreateLogic) UserDeviceCollectMultiCreate(in *dm.UserDeviceCollectSave) (*dm.Empty, error) {
uc := ctxs.GetUserCtx(l.ctx)
var ucds []*relationDB.DmUserDeviceCollect
for _, v := range in.Devices {
ucds = append(ucds, &relationDB.DmUserDeviceCollect{
UserID: uc.UserID,
ProductID: v.ProductID,
DeviceName: v.DeviceName,
})
}
err := relationDB.NewUserDeviceCollectRepo(l.ctx).MultiInsert(l.ctx, ucds)
return &dm.Empty{}, err
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/unitedrhino/things.git
git@gitee.com:unitedrhino/things.git
unitedrhino
things
things
v1.0.2

搜索帮助

0d507c66 1850385 C8b1a773 1850385