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,41 @@
// Code generated by protoc-gen-slc. DO NOT EDIT.
package server
import (
"context"
"bsm/full/module/ec/mall/internal/logic/ads"
pb "bsm/full/module/ec/mall/pb"
)
type AdsServer struct {
pb.UnimplementedAdsServer
}
func NewAdsServer() *AdsServer {
return &AdsServer{}
}
// 通过广告位获取广告信息
func (s *AdsServer) ByPos(ctx context.Context, in *pb.ByPosRequest) (*pb.AdsListReply, error) {
return ads.ByPos(ctx, in)
}
// 广告列表
func (s *AdsServer) Fetch(ctx context.Context, in *pb.FetchRequest) (*pb.AdsListReply, error) {
return ads.Fetch(ctx, in)
}
// 新建广告
func (s *AdsServer) Create(ctx context.Context, in *pb.AdsItem) (*pb.StatusReply, error) {
return ads.Create(ctx, in)
}
// 修改广告
func (s *AdsServer) Modify(ctx context.Context, in *pb.AdsItem) (*pb.StatusReply, error) {
return ads.Modify(ctx, in)
}
// 删除广告
func (s *AdsServer) Delete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return ads.Delete(ctx, in)
}

View File

@@ -0,0 +1,36 @@
// Code generated by protoc-gen-slc. DO NOT EDIT.
package server
import (
"context"
"bsm/full/module/ec/mall/internal/logic/category"
pb "bsm/full/module/ec/mall/pb"
)
type CategoryServer struct {
pb.UnimplementedCategoryServer
}
func NewCategoryServer() *CategoryServer {
return &CategoryServer{}
}
// 获取分类数据
func (s *CategoryServer) Fetch(ctx context.Context, in *pb.CategoryFetchRequest) (*pb.CategoryReply, error) {
return category.Fetch(ctx, in)
}
// 添加分类
func (s *CategoryServer) Create(ctx context.Context, in *pb.CategoryItem) (*pb.StatusReply, error) {
return category.Create(ctx, in)
}
// 删除分类
func (s *CategoryServer) Delete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return category.Delete(ctx, in)
}
// 修改分类
func (s *CategoryServer) Modify(ctx context.Context, in *pb.CategoryItem) (*pb.StatusReply, error) {
return category.Modify(ctx, in)
}

View File

@@ -0,0 +1,61 @@
// Code generated by protoc-gen-slc. DO NOT EDIT.
package server
import (
"context"
"bsm/full/module/ec/mall/internal/logic/freight"
pb "bsm/full/module/ec/mall/pb"
)
type FreightServer struct {
pb.UnimplementedFreightServer
}
func NewFreightServer() *FreightServer {
return &FreightServer{}
}
// 运费模板列表
func (s *FreightServer) Fetch(ctx context.Context, in *pb.FetchRequest) (*pb.FreightReply, error) {
return freight.Fetch(ctx, in)
}
// 运费模板修改
func (s *FreightServer) Modify(ctx context.Context, in *pb.FreightItem) (*pb.StatusReply, error) {
return freight.Modify(ctx, in)
}
// 运费模板删除
func (s *FreightServer) Delete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return freight.Delete(ctx, in)
}
// 运费模板创建
func (s *FreightServer) Create(ctx context.Context, in *pb.FreightItem) (*pb.StatusReply, error) {
return freight.Create(ctx, in)
}
// 运费模板详情
func (s *FreightServer) Detail(ctx context.Context, in *pb.IdentRequest) (*pb.FreightItem, error) {
return freight.Detail(ctx, in)
}
// 限制区域列表
func (s *FreightServer) DenyRegionFetch(ctx context.Context, in *pb.FetchRequest) (*pb.DenyRegionReply, error) {
return freight.DenyRegionFetch(ctx, in)
}
// 新建限制区域
func (s *FreightServer) DenyRegionCreate(ctx context.Context, in *pb.DenyRegionItem) (*pb.StatusReply, error) {
return freight.DenyRegionCreate(ctx, in)
}
// 移除限制区域
func (s *FreightServer) DenyRegionDelete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return freight.DenyRegionDelete(ctx, in)
}
// 编辑限制区域
func (s *FreightServer) DenyRegionModify(ctx context.Context, in *pb.DenyRegionItem) (*pb.StatusReply, error) {
return freight.DenyRegionModify(ctx, in)
}

View File

@@ -0,0 +1,83 @@
// Code generated by protoc-gen-slc. DO NOT EDIT.
package server
import (
"context"
pb "bsm/full/module/ec/mall/pb"
"git.apinb.com/bsm-sdk/core/vars"
gwRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/proto"
"net/http"
"os"
"strings"
)
type Server struct {
Grpc *grpc.Server
Ctx context.Context
Mux *gwRuntime.ServeMux
}
func New(addr string) *Server {
srv := &Server{Ctx: context.Background(), Grpc: grpc.NewServer(), Mux: gwRuntime.NewServeMux(
gwRuntime.WithForwardResponseRewriter(responseEnvelope),
)}
// register service to grpc.Server
pb.RegisterAdsServer(srv.Grpc, NewAdsServer())
pb.RegisterCategoryServer(srv.Grpc, NewCategoryServer())
pb.RegisterFreightServer(srv.Grpc, NewFreightServer())
pb.RegisterNoticeServer(srv.Grpc, NewNoticeServer())
pb.RegisterProductServer(srv.Grpc, NewProductServer())
pb.RegisterStaffServer(srv.Grpc, NewStaffServer())
pb.RegisterStoreServer(srv.Grpc, NewStoreServer())
reflection.Register(srv.Grpc)
// 将服务注册到Gateway
opts := []grpc.DialOption{grpc.WithInsecure()}
pb.RegisterAdsHandlerFromEndpoint(srv.Ctx, srv.Mux, addr, opts)
pb.RegisterCategoryHandlerFromEndpoint(srv.Ctx, srv.Mux, addr, opts)
pb.RegisterFreightHandlerFromEndpoint(srv.Ctx, srv.Mux, addr, opts)
pb.RegisterNoticeHandlerFromEndpoint(srv.Ctx, srv.Mux, addr, opts)
pb.RegisterProductHandlerFromEndpoint(srv.Ctx, srv.Mux, addr, opts)
pb.RegisterStaffHandlerFromEndpoint(srv.Ctx, srv.Mux, addr, opts)
pb.RegisterStoreHandlerFromEndpoint(srv.Ctx, srv.Mux, addr, opts)
// Register services swagger
srv.RegisterSwagger()
return srv
}
// RegisterSwagger 注册swagger
func (s *Server) RegisterSwagger() {
srvKey := strings.ToLower(vars.ServiceKey)
s.Mux.HandlePath("GET", "/"+srvKey+".swagger.json", func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {
w.Header().Set("Content-Type", "application/json")
bytes, err := os.ReadFile("./swagger/" + srvKey + ".swagger.json")
if err != nil {
w.WriteHeader(http.StatusNotFound)
w.Write([]byte(err.Error()))
return
}
w.Write(bytes)
return
})
}
// response envelope
func responseEnvelope(_ context.Context, response proto.Message) (interface{}, error) {
name := string(response.ProtoReflect().Descriptor().Name())
if name == "Status" || name == "Error" || name == "StatusReply" {
return response, nil
}
return map[string]any{
"code": 0,
"message": "OK",
"result": response,
}, nil
}

View File

@@ -0,0 +1,36 @@
// Code generated by protoc-gen-slc. DO NOT EDIT.
package server
import (
"context"
"bsm/full/module/ec/mall/internal/logic/notice"
pb "bsm/full/module/ec/mall/pb"
)
type NoticeServer struct {
pb.UnimplementedNoticeServer
}
func NewNoticeServer() *NoticeServer {
return &NoticeServer{}
}
// 公告列表
func (s *NoticeServer) Fetch(ctx context.Context, in *pb.FetchRequest) (*pb.NoticeListReply, error) {
return notice.Fetch(ctx, in)
}
// 新建公告
func (s *NoticeServer) Create(ctx context.Context, in *pb.NoticeItem) (*pb.StatusReply, error) {
return notice.Create(ctx, in)
}
// 修改公告
func (s *NoticeServer) Modify(ctx context.Context, in *pb.NoticeItem) (*pb.StatusReply, error) {
return notice.Modify(ctx, in)
}
// 删除公告
func (s *NoticeServer) Delete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return notice.Delete(ctx, in)
}

View File

@@ -0,0 +1,121 @@
// Code generated by protoc-gen-slc. DO NOT EDIT.
package server
import (
"context"
"bsm/full/module/ec/mall/internal/logic/product"
pb "bsm/full/module/ec/mall/pb"
)
type ProductServer struct {
pb.UnimplementedProductServer
}
func NewProductServer() *ProductServer {
return &ProductServer{}
}
// 获取产品列表
func (s *ProductServer) ItemFetch(ctx context.Context, in *pb.FetchRequest) (*pb.ListReply, error) {
return product.ItemFetch(ctx, in)
}
// 获取产品详情
func (s *ProductServer) ItemDetail(ctx context.Context, in *pb.IdentRequest) (*pb.ProductItem, error) {
return product.ItemDetail(ctx, in)
}
// 通过产品序列获取产品详情
func (s *ProductServer) ItemDetailBySerial(ctx context.Context, in *pb.StoreSerialRequest) (*pb.ListReply, error) {
return product.ItemDetailBySerial(ctx, in)
}
// 通过规格编号获取产品详情
func (s *ProductServer) ItemDetailBySpec(ctx context.Context, in *pb.DetailBySpecRequest) (*pb.ListItem, error) {
return product.ItemDetailBySpec(ctx, in)
}
// 添加产品
func (s *ProductServer) ItemCreate(ctx context.Context, in *pb.ProductItem) (*pb.StatusReply, error) {
return product.ItemCreate(ctx, in)
}
// 删除产品
func (s *ProductServer) ItemDelete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return product.ItemDelete(ctx, in)
}
// 发布/取消发布 产品
func (s *ProductServer) ItemModify(ctx context.Context, in *pb.ModifyRequest) (*pb.StatusReply, error) {
return product.ItemModify(ctx, in)
}
// 批量操作
func (s *ProductServer) ItemBatchOp(ctx context.Context, in *pb.OpRequest) (*pb.StatusReply, error) {
return product.ItemBatchOp(ctx, in)
}
// 产品规格列表
func (s *ProductServer) SpecFetch(ctx context.Context, in *pb.FetchRequest) (*pb.SpecReply, error) {
return product.SpecFetch(ctx, in)
}
// 添加产品规格
func (s *ProductServer) SpecCreate(ctx context.Context, in *pb.SpecItem) (*pb.StatusReply, error) {
return product.SpecCreate(ctx, in)
}
// 修改产品规格
func (s *ProductServer) SpecModify(ctx context.Context, in *pb.SpecItem) (*pb.StatusReply, error) {
return product.SpecModify(ctx, in)
}
// 删除产品规格
func (s *ProductServer) SpecDelete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return product.SpecDelete(ctx, in)
}
// 产品详情
func (s *ProductServer) SpecDetail(ctx context.Context, in *pb.IdentRequest) (*pb.SpecItem, error) {
return product.SpecDetail(ctx, in)
}
// 添加产品图片
func (s *ProductServer) PhotoCreate(ctx context.Context, in *pb.PhotoItem) (*pb.StatusReply, error) {
return product.PhotoCreate(ctx, in)
}
// 删除产品图片
func (s *ProductServer) PhotoDelete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return product.PhotoDelete(ctx, in)
}
// 产品图片列表
func (s *ProductServer) PhotoList(ctx context.Context, in *pb.PhotoItem) (*pb.PhotoReply, error) {
return product.PhotoList(ctx, in)
}
// 产品的评论列表
func (s *ProductServer) CommentFetch(ctx context.Context, in *pb.FetchRequest) (*pb.CommentListReply, error) {
return product.CommentFetch(ctx, in)
}
// 评论
func (s *ProductServer) CommentCreate(ctx context.Context, in *pb.CommentItem) (*pb.StatusReply, error) {
return product.CommentCreate(ctx, in)
}
// 回复评论
func (s *ProductServer) CommentRe(ctx context.Context, in *pb.CommentItem) (*pb.StatusReply, error) {
return product.CommentRe(ctx, in)
}
// 删除评论
func (s *ProductServer) CommentDelete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return product.CommentDelete(ctx, in)
}
// 修改评论
func (s *ProductServer) CommentModify(ctx context.Context, in *pb.CommentItem) (*pb.StatusReply, error) {
return product.CommentModify(ctx, in)
}

View File

@@ -0,0 +1,51 @@
// Code generated by protoc-gen-slc. DO NOT EDIT.
package server
import (
"context"
"bsm/full/module/ec/mall/internal/logic/staff"
pb "bsm/full/module/ec/mall/pb"
)
type StaffServer struct {
pb.UnimplementedStaffServer
}
func NewStaffServer() *StaffServer {
return &StaffServer{}
}
// 登录
func (s *StaffServer) Login(ctx context.Context, in *pb.LoginRequest) (*pb.LoginReply, error) {
return staff.Login(ctx, in)
}
// 获取工作人员列表
func (s *StaffServer) Fetch(ctx context.Context, in *pb.FetchRequest) (*pb.StaffListReply, error) {
return staff.Fetch(ctx, in)
}
// 创建工作人员
func (s *StaffServer) Create(ctx context.Context, in *pb.StaffItem) (*pb.StatusReply, error) {
return staff.Create(ctx, in)
}
// 删除工作人员
func (s *StaffServer) Delete(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
return staff.Delete(ctx, in)
}
// 获取个人信息
func (s *StaffServer) GetProfile(ctx context.Context, in *pb.IdentRequest) (*pb.StaffItem, error) {
return staff.GetProfile(ctx, in)
}
// 设置个人信息
func (s *StaffServer) SetProfile(ctx context.Context, in *pb.StaffItem) (*pb.StatusReply, error) {
return staff.SetProfile(ctx, in)
}
// 设置账号密码
func (s *StaffServer) SetPassword(ctx context.Context, in *pb.SetAccountRequest) (*pb.StatusReply, error) {
return staff.SetPassword(ctx, in)
}

View File

@@ -0,0 +1,66 @@
// Code generated by protoc-gen-slc. DO NOT EDIT.
package server
import (
"context"
"bsm/full/module/ec/mall/internal/logic/store"
pb "bsm/full/module/ec/mall/pb"
)
type StoreServer struct {
pb.UnimplementedStoreServer
}
func NewStoreServer() *StoreServer {
return &StoreServer{}
}
// 申请加入店铺
func (s *StoreServer) ApplyJoin(ctx context.Context, in *pb.ApplyJoinRequest) (*pb.StatusReply, error) {
return store.ApplyJoin(ctx, in)
}
// 店铺许可授权
func (s *StoreServer) Licensing(ctx context.Context, in *pb.LicensingRequest) (*pb.StatusReply, error) {
return store.Licensing(ctx, in)
}
// 获取店铺基础配置
func (s *StoreServer) GetSetting(ctx context.Context, in *pb.IdentRequest) (*pb.StoreBasic, error) {
return store.GetSetting(ctx, in)
}
// 设置店铺基础配置
func (s *StoreServer) SetSetting(ctx context.Context, in *pb.StoreBasic) (*pb.StatusReply, error) {
return store.SetSetting(ctx, in)
}
// 设置支付方式配置
func (s *StoreServer) SetPayment(ctx context.Context, in *pb.SettingRequest) (*pb.StatusReply, error) {
return store.SetPayment(ctx, in)
}
// 设置邮件服务器配置
func (s *StoreServer) SetEmail(ctx context.Context, in *pb.SettingRequest) (*pb.StatusReply, error) {
return store.SetEmail(ctx, in)
}
// 获取支付方式配置
func (s *StoreServer) GetPayment(ctx context.Context, in *pb.IdentRequest) (*pb.ConfigsReply, error) {
return store.GetPayment(ctx, in)
}
// 获取邮件服务器配置
func (s *StoreServer) GetEmail(ctx context.Context, in *pb.IdentRequest) (*pb.ConfigsReply, error) {
return store.GetEmail(ctx, in)
}
// 获取小程序推荐码
func (s *StoreServer) MiniCode(ctx context.Context, in *pb.MiniCodeRequest) (*pb.MiniCodeReply, error) {
return store.MiniCode(ctx, in)
}
// 店铺搜索
func (s *StoreServer) Search(ctx context.Context, in *pb.MallSearchRequest) (*pb.MallSearchReply, error) {
return store.Search(ctx, in)
}