2025-02-20 12:40:39 +00:00
|
|
|
package controller
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2025-03-28 01:23:17 +00:00
|
|
|
"fmt"
|
2025-02-20 12:40:39 +00:00
|
|
|
"micro-bundle/internal/logic"
|
|
|
|
"micro-bundle/pb/bundle"
|
2025-03-28 01:23:17 +00:00
|
|
|
"micro-bundle/pkg/utils"
|
2025-02-20 12:40:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type BundleProvider struct {
|
|
|
|
bundle.UnimplementedBundleServer
|
|
|
|
}
|
|
|
|
|
|
|
|
// 套餐相关
|
|
|
|
func (b *BundleProvider) CreateBundle(_ context.Context, req *bundle.BundleProfile) (res *bundle.CommonResponse, err error) {
|
|
|
|
return logic.CreateBundle(req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *BundleProvider) UpdateBundle(_ context.Context, req *bundle.BundleProfile) (res *bundle.CommonResponse, err error) {
|
|
|
|
return logic.UpdateBundle(req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *BundleProvider) DeleteBundle(_ context.Context, req *bundle.DelBundleRequest) (res *bundle.CommonResponse, err error) {
|
|
|
|
return logic.DeleteBundle(req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *BundleProvider) BundleList(_ context.Context, req *bundle.BundleListRequest) (res *bundle.BundleListResponse, err error) {
|
|
|
|
return logic.BundleList(req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *BundleProvider) BundleDetail(_ context.Context, req *bundle.BundleDetailRequest) (res *bundle.BundleDetailResponse, err error) {
|
|
|
|
return logic.BundleDetail(req)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 订单相关
|
|
|
|
func (b *BundleProvider) CreateOrderRecord(_ context.Context, req *bundle.OrderRecord) (res *bundle.CommonResponse, err error) {
|
|
|
|
return logic.CreateOrderRecord(req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *BundleProvider) UpdateOrderRecord(_ context.Context, req *bundle.OrderRecord) (res *bundle.CommonResponse, err error) {
|
|
|
|
return logic.UpdateOrderRecord(req)
|
|
|
|
}
|
|
|
|
|
2025-02-21 13:09:54 +00:00
|
|
|
func (b *BundleProvider) UpdateOrderRecordByOrderNo(_ context.Context, req *bundle.OrderRecord) (res *bundle.CommonResponse, err error) {
|
2025-02-23 08:35:55 +00:00
|
|
|
return logic.UpdateOrderRecordByOrderNo(req)
|
2025-02-21 13:09:54 +00:00
|
|
|
}
|
|
|
|
|
2025-02-20 12:40:39 +00:00
|
|
|
func (b *BundleProvider) OrderRecordsList(_ context.Context, req *bundle.OrderRecordsRequest) (res *bundle.OrderRecordsResponse, err error) {
|
|
|
|
return logic.OrderRecordsList(req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *BundleProvider) OrderRecordsDetail(_ context.Context, req *bundle.OrderRecordsDetailRequest) (res *bundle.OrderRecordsDetailResponse, err error) {
|
|
|
|
return logic.OrderRecordsDetail(req)
|
|
|
|
}
|
2025-03-25 08:30:09 +00:00
|
|
|
|
|
|
|
// 增值套餐相关
|
2025-03-28 01:23:17 +00:00
|
|
|
func (b *BundleProvider) CreateValueAddBundle(_ context.Context, req *bundle.CreateValueAddBundleRequest) (res *bundle.CreateValueAddBundleResponse, err error) {
|
|
|
|
if err = req.Validate(); err != nil {
|
|
|
|
err = utils.SubstrError(err)
|
|
|
|
fmt.Println(err)
|
|
|
|
return nil, err
|
|
|
|
}
|
2025-03-25 08:30:09 +00:00
|
|
|
|
2025-03-28 01:23:17 +00:00
|
|
|
return logic.CreateValueAddBundle(req)
|
2025-03-25 08:30:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (b *BundleProvider) ValueAddBundleList(_ context.Context, req *bundle.ValueAddBundleListRequest) (res *bundle.ValueAddBundleListResponse, err error) {
|
|
|
|
return logic.ValueAddBundleList(req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *BundleProvider) ValueAddBundleDetail(_ context.Context, req *bundle.ValueAddBundleDetailRequest) (res *bundle.ValueAddBundleDetailResponse, err error) {
|
|
|
|
return logic.ValueAddBundleDetail(req)
|
|
|
|
}
|