refactor: reorganize modules and add Linux build tooling
This commit is contained in:
29
module/ec/mall/internal/logic/ads/by_pos.go
Normal file
29
module/ec/mall/internal/logic/ads/by_pos.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user