refactor: reorganize modules and add Linux build tooling

This commit is contained in:
2026-08-09 12:41:08 +08:00
parent 86024fa81d
commit 5cc5fd92ed
1461 changed files with 4054 additions and 4724 deletions

View File

@@ -0,0 +1,50 @@
package ads
import (
"context"
"time"
"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"
"git.apinb.com/bsm-sdk/core/printer"
"git.apinb.com/bsm-sdk/core/service"
"git.apinb.com/bsm-sdk/core/types"
)
// 修改广告
func Modify(ctx context.Context, in *pb.AdsItem) (reply *pb.StatusReply, err error) {
// parse authorization meta.
_, err = service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
if err != nil {
return nil, err
}
// valid must params.
if in.GetId() == 0 {
return nil, errcode.ErrInvalidArgument
}
data := models.MallAds{
Title: in.Title,
PosKey: in.PosKey,
Content: in.Content,
Type: models.ContentType(in.Type),
ToUrl: in.ToUrl,
Std_IICUDS: types.Std_IICUDS{Status: int8(in.GetStatus())},
}
err = impl.DBService.Select("title", "pos_key", "content", "type", "to_url").Where("id=?", in.GetId()).Updates(&data).Error
if err != nil {
printer.Error(err.Error())
return nil, errcode.ErrDB
}
return &pb.StatusReply{
Code: 0,
Message: "OK",
Timeseq: time.Now().Unix(),
}, nil
}