package ads import ( "context" "bsm/full/module/ec/mall/internal/impl" "bsm/full/module/ec/mall/internal/models" pb "bsm/full/module/ec/mall/pb" "git.apinb.com/bsm-sdk/core/errcode" ) // 通过广告位获取广告信息 func ByPos(ctx context.Context, in *pb.ByPosRequest) (reply *pb.AdsListReply, err error) { if in.GetStoreIdentity() == "" { return nil, errcode.ErrInvalidArgument } result := make([]*pb.AdsItem, 0) err = impl.DBService.Model(&models.MallAds{}).Where("store_identity=? and pos_key in ?", in.StoreIdentity, in.PosKey).Find(&result).Error if err != nil { return nil, errcode.ErrDB } return &pb.AdsListReply{ Data: result, Count: int64(len(result)), }, nil }